summaryrefslogtreecommitdiff
path: root/cmd/wg-test-peer
diff options
context:
space:
mode:
authorJames O'Doherty <james@theodohertyfamily.com>2026-05-22 09:13:16 -0400
committerJames O'Doherty <james@theodohertyfamily.com>2026-05-22 09:13:16 -0400
commit756ba94292b408cc4f23d137b2c4c52009b2b38d (patch)
tree85ed0158eef7009826c5707e976538784f10f1d8 /cmd/wg-test-peer
parenta4cd7de209fe90006b3e6e67c69dea5ed0c9f832 (diff)
Scaffold wg-wrap project structure and toolchain
Diffstat (limited to 'cmd/wg-test-peer')
-rw-r--r--cmd/wg-test-peer/main.go39
1 files changed, 39 insertions, 0 deletions
diff --git a/cmd/wg-test-peer/main.go b/cmd/wg-test-peer/main.go
new file mode 100644
index 0000000..938400d
--- /dev/null
+++ b/cmd/wg-test-peer/main.go
@@ -0,0 +1,39 @@
+package main
+
+import (
+ "flag"
+ "fmt"
+ "net/http"
+)
+
+type PeerConfig struct {
+ InternalIP string
+ ListenPort int
+ PrivateKey string
+}
+
+func main() {
+ internalIP := flag.String("internal-ip", "10.0.0.1", "Internal VPN IP for the peer")
+ listenPort := flag.Int("port", 51820, "UDP port to listen on")
+ flag.Parse()
+
+ fmt.Printf("Starting wg-test-peer on UDP port %d...\n", *listenPort)
+ fmt.Printf("Peer Internal IP: %s\n", *internalIP)
+
+ // The peer will eventually implement a userspace WireGuard device
+ // and a simple TCP/IP stack (via GVisor or similar) to handle the traffic.
+
+ // For now, we start a dummy HTTP server to demonstrate the intended flow.
+ // In a real E2E test, this server would be reached via the TUN device.
+ http.HandleFunc("/verify", func(w http.ResponseWriter, r *http.Request) {
+ token := r.URL.Query().Get("token")
+ _, _ = fmt.Fprintf(w, "Verification token received: %s\n", token)
+ })
+
+ fmt.Printf("HTTP verification server running on :%s (simulated)\n", *internalIP)
+ // Note: In final implementation, the HTTP server binds to the internal IP
+ // provided by the userspace network stack.
+
+ // This is a stub. In a real run, this would block.
+ fmt.Println("Peer is ready. Generate a matching .conf for the client.")
+}