docker run --rm -it $(docker build -q .)
docker build -t gobi301/p2p-network-rust . && docker push gobi301/p2p-network-rust:latest
- nat traversal
- dht
- lan discovery
- relay comunications
- content addressed file sharing (ipfs/torrent like, as merkle-dag)
- p2p streaming (tcp, udp socket wrapper)
- topic swarm (find same app peers, supported app manifest)
- mutable topic (as dns and personal profile)
- browser
- filesystem
- chat
- micro blogging social
- music / video streaming
- file sharing
abstracions
mutable state event oriented ((state, event) -> event) goal oriented (given a goal and state, do action to go closer to the state) streams futures dependency oriented
all code supposes there is a fixed ram, and a cpu and ip addresses, and can't fail external storage as hard-disk or other adapted resources are treated as attached storage (can fail)
resource aware resource limiting resources are limited so they should be trated as that resource accounting resource usage should be counted resource sharing resources should be allocated evenly (size limit by bytes, time share by priority queues) ex (prioritize by ip (local ips has lower priority), then by port)
browser adapter given peer id, open localhost port that forwards to that peer (tcp, udp) dns server .overlay resolves to local port
server adapter creates a proxy to a localhost port
discovery messages must be signed direct messages must be encrypted
icmp is blocked sometimes too much unsolicited packets can trigger anti-flood block
discovery modes public ip bootstrap nodes lan broadcast (ipv4 broadcast, ipv6 multicast, ipv4 mutlicast dns as in dat protocol) dht custom
nat traversal tecniques holepunch same port (port mapping reuse) holepunch guess port holepunch two-stage (https://lists.gnu.org/archive/html/gnunet-developers/2015-08/pdfWmTHEBX5S1.pdf) unpn-igd nat-pmp pcp pwnat turn/stun/ice relay (peer, own, paid)
test for hairpin and loopback
nat types:
- full cone (IP only mapping, any port (same))
- address restricted (allow inbound only after contacting ip, any port (same))
- port restricted (allow inbound only after conatacting ip on port)
nat features:
- flood protection (too many unsolicited packets)
- hairpin (able to route between machines under same nat)
- port resuse from different ips (needs port guessing)
- automatic port mapping (upnp (100% support) nat-pmp (50% support)) (does not support mutlilevel nat)
nat-type no (has public ip, allow inbound connections, same ports) full cone (onyl ip gets translated, ports remain the same, allow inbound) address restricted cone (ip gets translated, ports remain same, allow inbound after outbound ip) port restricted cone (ip gets translated, ports remain same, allow inbound after outbound ip and port) simmetric nat
nat-feature hairpin port preserving | port continous
route {me: (nat-type, nat-feature), peer: (nat-type, nat-feature)}
nat scenarios nat (?, port-preserving) -> no nat nat (?, port continous) -> no nat
core abstraction: port-mapping path (from -> to) is unidirectional actions: open mantain send close (optional) state: useable unuseable (ringing up, shutdown)
a connection is generally a pair of port mappings
- https://files.ifi.uzh.ch/CSG/staff/bocek/extern/theses/BA-Jonas-Wagner.pdf
- https://samy.pl/pwnat/
- http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.455.3700&rep=rep1&type=pdf
- https://lists.gnu.org/archive/html/gnunet-developers/2015-08/pdfWmTHEBX5S1.pdf
- http://journals.sfu.ca/apan/index.php/apan/article/download/75/pdf_31
- https://docs.maidsafe.net/Whitepapers/pdf/DHTbasedNATTraversal.pdf
- https://assets.ctfassets.net/sdlntm3tthp6/resource-asset-r358/89d5d761e11fde84756615051655cb16/547cdeee-578e-46a7-9c7e-93b85aa43f5b.pdf
- http://www.rfc-editor.org/rfc/rfc5128.txt
- https://docs.rs/p2p/0.6.0/p2p/
- https://github.com/libp2p/rust-libp2p
- https://holest.com/qp2p-system/nat-traversal-fundamentals.html