wireguard-p2p icon indicating copy to clipboard operation
wireguard-p2p copied to clipboard

Looking for some docs

Open tjjh89017 opened this issue 6 years ago • 8 comments
trafficstars

Hi, I'm very interested in this project. But I found less docs about the design. Could you tell us more about this? (master branch) Thanks a lot

tjjh89017 avatar Jul 27 '19 11:07 tjjh89017

Hi @tjjh89017, I am currently working on a new version (though it's just a hobby and I do not know when it's production ready, yet).

I'm not sure what you mean by design. The software roughly works like this:

  • open a UDP socket and run STUN over the socket to determine it's public ip and port.
  • publish this public ip and port encrypted in OpenDHT.
  • lookup the other peer's public ip and port in OpenDHT.
  • try to connect to the other peer using this UDP socket.
  • open a local UDP socket and connect to the local wireguard port.
  • forward all packets between these two UDP sockets.

manuels avatar Jul 27 '19 12:07 manuels

So wg-p2p will act as a proxy between the wg port and really port?

If you are busy, plz ignore my questions. Thanks

tjjh89017 avatar Jul 27 '19 12:07 tjjh89017

Exactly, I could not find a design where this forwarding is not required. Though I might replace it with a eBPF program one day ;)

manuels avatar Jul 27 '19 12:07 manuels

I'm not sure But maybe Bittorrent UDP hole punch will help?

tjjh89017 avatar Jul 27 '19 12:07 tjjh89017

Not sure how this should help. I use STUN for that.

manuels avatar Jul 31 '19 18:07 manuels

Use hole punch, we can connect wireguard without proxy Let me think about it

tjjh89017 avatar Aug 01 '19 03:08 tjjh89017

@manuels I survey a lot for this topic I think BPF or eBPF will help this

I want to implement a similar approach using BPF or eBPF (new C++ or Golang project) (if you don't mind) Wireguard's example use a custom server to do the UDP hole punching. [1] This part may be replaced with STUN or TURN server to determine the port in use or relay the UDP traffic, and use OpenDHT or Mainline DHT to store the IP and port info.

  1. BPF or eBPF for avoiding use "proxy"
  2. TURN server for symmetric NAT

and i don't think "pubkey exchange" will be necessary. (if i'm wrong, please correct me)

[1] https://github.com/WireGuard/WireGuard/tree/master/contrib/examples/nat-hole-punching

tjjh89017 avatar Aug 03 '19 16:08 tjjh89017

Hi, I'm also interested in Docs. A simple readme with an example configuration would be enough. Just hard to use without any info.

afeiszli avatar Sep 09 '20 13:09 afeiszli