natpunch-go icon indicating copy to clipboard operation
natpunch-go copied to clipboard

Windows Client

Open krwags opened this issue 2 years ago • 1 comments

Hello Malcolm,

I'm interested in porting your excellent Client to Windows. What would be the best way to start that effort? Do you have any prior work on it?

I will definitely push this upgrade back to your project. Just want to find out your thoughts.

Thanks, Keith

krwags avatar Mar 30 '22 20:03 krwags

I'm glad you're interested! Somebody else was too and built this: https://github.com/yinheli/udppunch. I'd recommend checking that out first, they seem to have a Windows build in their Releases.

If that doesn't work, then here's the steps I'd take to make this cross-platform:

  • Use the official wgctrl library for controlling Wireguard.
  • Use a net.IPConn with a UDP header manually serialized to spoof Wireguard's source port when contacting the server.
  • Use a separate connection for most of your communication with the server so that you never have to read from the net.IPConn. The current implementation uses Linux-only BPF and does all communication over an ipv4.RawConn.

I hope you found this helpful! Let me know if you have any other questions.

malcolmseyd avatar Mar 31 '22 00:03 malcolmseyd