natdemo's Introduction
NAT Traversal - Peer Exchange Demo Program The basic scenario is as follows: Peer R can talk to Peer A and B at the same time. But since both Peer A and B are behind a NAT device, they cannot talk to each other. With the help of Peer R, Peer A and Peer B can talk to each other finally. Assumption: 1. EIM - Endpoint Independent Mapping: the NAT device will reuse the same mapping for the same internal host address and port number, for subsequent outgoing packets. 2. MidPeer knowledge: both peers can talk to the middle peer regardless of the presence of NAT devices for the midPeer. The demo program has the following components: 1. midPeer.py: with a public IP addr. (stage 1) or behind a NAT device (stage 2); 2. peer.py: a peer behind a NAT device; 3. config.py: configuration parameters for this demo program; midPeer.start() 1. wait(): wait for the connection of the 1st peer; 2. wait(): wait for the connection of the 2nd peer; 3. introduce(): exchange the peers' addresses, and tell both peers; peer.start() 1. connect(midPeer_addr): connects to the midPeer; 2. get(): get the target peer's address from the midPeer; 3. touch(): send a packet to the target peer reliably; --------KeepAlive Message-------- This sub-program is used to measure the NAT mapping duration. keepAliveDaemon.py: run on a public server; keepAliveClient.py: run on a host behind NAT device; interact with Daemon using two sockets. The procedure is as follows: 1. client.signal(): the client signals Daemon using 39950; 2. client.touch(): the client sends a packet to Daemon:39951; it punches a hole for Daemon using client:39951; 3. daemon.keepAlive(): the Daemon sends a packet to the client after a specific time, to probe the longest mapping duraiton.
natdemo's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.