All Projects → wilfreddenton → Udp Hole Punching

wilfreddenton / Udp Hole Punching

An experimental P2P encrypted chat app created to show UDP hole punching in action

Programming Languages

javascript
184084 projects - #8 most used programming language
go
31211 projects - #10 most used programming language
golang
3204 projects

Labels

Projects that are alternatives of or similar to Udp Hole Punching

Appnet.link
Secure P2P HTTP Gateway as Tunnel Protocol
Stars: ✭ 203 (+163.64%)
Mutual labels:  p2p, udp
Spitfire
An easy to use WebRTC Datachannels library for .NET applications.
Stars: ✭ 164 (+112.99%)
Mutual labels:  p2p, udp
opengnb
GNB is open source de-centralized VPN to achieve layer3 network via p2p with the ultimate capability of NAT Traversal.GNB是一个开源的去中心化的具有极致内网穿透能力的通过P2P进行三层网络交换的VPN。
Stars: ✭ 440 (+471.43%)
Mutual labels:  udp, p2p
Python Nat Hole Punching
UDP and TCP NAT hole punching examples in python
Stars: ✭ 190 (+146.75%)
Mutual labels:  p2p, udp
Gnb
GNB is open source de-centralized VPN to achieve layer3 network via p2p with the ultimate capability of NAT Traversal.GNB是一个开源的去中心化的具有极致内网穿透能力的通过P2P进行三层网络交换的VPN。
Stars: ✭ 225 (+192.21%)
Mutual labels:  p2p, udp
Pjon
PJON (Padded Jittering Operative Network) is an experimental, arduino-compatible, multi-master, multi-media network protocol.
Stars: ✭ 2,615 (+3296.1%)
Mutual labels:  p2p, udp
udpeer
A simple UDP peer to peer networking proxy using webrtc
Stars: ✭ 19 (-75.32%)
Mutual labels:  udp, p2p
Netdynamics
Data-oriented networking playground for the reliable UDP transports
Stars: ✭ 65 (-15.58%)
Mutual labels:  udp
Cause
An EDN-like CRDT (Causal Tree) for Clojure & ClojureScript that automatically tracks history and resolves conflicts.
Stars: ✭ 68 (-11.69%)
Mutual labels:  p2p
Pytcp
PyTCP is an attempt to create fully functional TCP/IP stack in Python. It supports TCP stream based transport with reliable packet delivery based on sliding window mechanism and basic congestion control. It also supports IPv6/ICMPv6 protocols with SLAAC address configuration. It operates as user space program attached to Linux TAP interface. As of today stack is able to send and receive traffic over Internet using IPv4 and IPv6 default gateways for routing. Since goal of this project is purely educational (at least at this point) the clarity of code is preferred over its efficiency. For the same reason security features are not being implemented just yet unless they are integral part of TCP/IP suite protocols specification.
Stars: ✭ 65 (-15.58%)
Mutual labels:  udp
Waykichain
Public Blockchain as a Decentralized Finance Infrastructure Service Platform
Stars: ✭ 1,117 (+1350.65%)
Mutual labels:  p2p
Covenantsql
A decentralized, trusted, high performance, SQL database with blockchain features
Stars: ✭ 1,148 (+1390.91%)
Mutual labels:  p2p
Logbert
Logbert is an advanced log message viewer for log4net, log4j and others.
Stars: ✭ 70 (-9.09%)
Mutual labels:  udp
Oscpy
An efficient OSC implementation compatible with python2.7 and 3.5+
Stars: ✭ 65 (-15.58%)
Mutual labels:  udp
I2p.i2p
I2P is an anonymizing network, offering a simple layer that identity-sensitive applications can use to securely communicate. All data is wrapped with several layers of encryption, and the network is both distributed and dynamic, with no trusted parties.
Stars: ✭ 1,186 (+1440.26%)
Mutual labels:  p2p
Phpspidermagnetbittorrent
php实现p2p中DHT网络爬虫,并提供搜索下载
Stars: ✭ 64 (-16.88%)
Mutual labels:  p2p
Rdcli
The simple way to download and unrestrict DDL files, torrents and magnets
Stars: ✭ 75 (-2.6%)
Mutual labels:  p2p
Tinybirdnet Unity
A high level API for making networked games in Unity, utilizes https://github.com/RevenantX/LiteNetLib
Stars: ✭ 72 (-6.49%)
Mutual labels:  udp
Wenat Client Java
Wenat内网穿透,java版客户端
Stars: ✭ 70 (-9.09%)
Mutual labels:  p2p
Ca11
Multi-Protocol Webphone
Stars: ✭ 69 (-10.39%)
Mutual labels:  p2p

👊 UDP Hole Punching 👊

Yusuke punches a hole right through your NAT

udp-hole-punching

Disclaimer: This is not a production ready chat application. While it does create AES encrypted connections client <-> client and client <-> server, this code has not been audited or tested by any security specialists. This is simply an exercise for me to learn more about P2P networking and technologies as well as provide some examples of the technologies in use for others who are interested in learning. Additionally, the udp client does not implement a protocol that ensures the successful delivery of messages and so some will be lost over spotty connections.

Preview

preview

Click the above image to watch a youtube video of the chat app in action. The terminal in the top right hand corner is SSHed into a VPS which runs the rendezvous server. The terminal in the bottom right is the terminal UI. The web app on the left is the GUI.

Install

go get github.com/wilfreddenton/udp-hole-punching

Usage

1. Setup rendezvous server

The main package is the rendezvous server. Find a VPS or something to host it on. You can run everything locally but it won't really be testing whether or not hole punching works because it's on the same machine. Make sure that the server has TCP and UDP ports open to incoming traffic from 0-65535.

To run it:

  1. go install
  2. udp-hole-punching

2. Adjust UI settings

There are two UIs that you can use gui which is a web UI and term-ui which is a terminal UI. You can use any combination of UIs.

Before you use one you should open the main.go file and switch the serverTCPIP and serverUDPIP constants to the IP address of your rendezvous server (no port).

To run the web UI

  1. cd gui/ui
  2. npm install
  3. npm run build
  4. cd ..
  5. go install
  6. gui if your rendezvous server is running on locally or gui -serverIP=<server IP here>
  7. point your browser to localhost:8000

To disconnect and start a new chat simply refresh.

To run the terminal UI

  1. cd term-ui
  2. go install
  3. term-ui if your rendezvouse server is running locally term-ui -serverIP=<server IP here>

To disconnect and start a new chat ctrl-c to exit the program and run it again.

3. Find a friend

If not a friend then get access to a computer behind a different router and set up a client on there.

4. Test it out

Run the clients and provide the PeerID of one client to the other client and if the network topology permits hole punching then you will establish an encrypted connection between the clients.

Architecture

udp-hole-punching architecture

  1. Both clients register themselves using their ID with the rendezvous server
  2. Client A makes an "establish" request to the rendezvous server sending the ID of the peer it would like to being communicating with
  3. Upon receiving the "establish" request from client A and verifying that both client A and the requested peer, client B, have registered, the server sends an "establish" response back to client A as well as client B informing the peers of each other's information.
  4. The peers can now send requests directly to each other with the information they've received from the rendezvous server. They create this connection using the hole-punching algorithm described in reference 1.

Simplification of the algorithm

To make the implementation of hole punching a little simpler, the clients to not attempt to connect to each other's private IP addresses. Clients that are behind the same NAT will still be able to connect but they will do so with public IP addresses and not private ones. The routers I have tested seemed to understand that the peers were on it's local network and facilitated the connection without going to the outside internet.

References

  1. Peer-to-Peer Communication Across Network Address Translators
  2. Diffie-Hellman Key Exchange: A Non-mathematician’s explanation
  3. powered by Curve25519
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].