mirror of
https://github.com/yago-123/wg-punch-kernel.git
synced 2026-06-21 03:23:30 +00:00
Kernel-based WireGuard extension for wg-punch library
- Go 98.2%
- Makefile 1.8%
| .github | ||
| cmd | ||
| kernel | ||
| .gitignore | ||
| .golangci.yml | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| Makefile | ||
| README.md | ||
wg-punch-kernel: WireGuard Punch Kernel Extension
wg-punch-kernel extends wg-punch to support kernel-based WireGuard tunnels
for NAT hole punching in Go.
Overview
This module provides a Tunnel implementation that uses the WireGuard kernel module instead of the userspace version.
It is a drop-in replacement for wg-punch’s userspace tunnel, using the kernel WireGuard module for native integration
with the system networking stack.
- Reuses
wg-punch’s NAT traversal logic - Uses kernel WireGuard for real tunnel setup
- Cleanly integrates with your existing Go code
- Tested with peer-to-peer TCP communication over WireGuard
Use Case
Use this project when:
- You want to establish direct peer-to-peer connections across NATs using WireGuard
- You prefer kernel WireGuard (via
wgctrlandnetlink) over userspacewireguard-go - You already use or plan to use wg-punch
Example
See cmd/peerA/main.go and cmd/peerB/main.go for a minimal example of establishing a tunnel between two peers using NAT hole punching and kernel WireGuard.
Requirements
- Linux with WireGuard kernel module installed
- Go 1.20+
Installation
go get github.com/yago-123/wg-punch-kernel