All Projects → chenboxing → Punching

chenboxing / Punching

P2P TCP NAT穿透 P2P TCP NET Punching hold

Programming Languages

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

Labels

Projects that are alternatives of or similar to Punching

Roll Call
📞 Free and reliable audio calls for everyone w/ browser p2p.
Stars: ✭ 1,563 (+1000.7%)
Mutual labels:  p2p
Univoice
P2P VoIP in Unity
Stars: ✭ 128 (-9.86%)
Mutual labels:  p2p
Metastream
Watch streaming media with friends.
Stars: ✭ 1,926 (+1256.34%)
Mutual labels:  p2p
I2pd
🛡 I2P: End-to-End encrypted and anonymous Internet
Stars: ✭ 1,796 (+1164.79%)
Mutual labels:  p2p
P2plab
performance benchmark infrastructure for IPLD DAGs
Stars: ✭ 126 (-11.27%)
Mutual labels:  p2p
Particl Desktop
The GUI application for Particl Markeplace and PART coin wallet. A decentralized peer to peer marketplace –free, secure, private, untraceable.
Stars: ✭ 131 (-7.75%)
Mutual labels:  p2p
Orbit
A distributed, serverless, peer-to-peer chat application on IPFS
Stars: ✭ 1,586 (+1016.9%)
Mutual labels:  p2p
Nelson.cli
WE HAVE MOVED TO A NEW REPOSITORY
Stars: ✭ 139 (-2.11%)
Mutual labels:  p2p
Feathercoin
Stars: ✭ 126 (-11.27%)
Mutual labels:  p2p
Bitcoin Kit Ios
Full Bitcoin library for iOS, implemented on Swift. SPV wallet implementation for Bitcoin, Bitcoin Cash and Dash blockchains.
Stars: ✭ 134 (-5.63%)
Mutual labels:  p2p
Torrentinim
A very low memory-footprint, self hosted API-only torrent search engine. Sonarr + Radarr Compatible, native support for Linux, Mac and Windows.
Stars: ✭ 123 (-13.38%)
Mutual labels:  p2p
Atomicdex Desktop
atomicDEX Desktop app - project codename "Dextop"
Stars: ✭ 126 (-11.27%)
Mutual labels:  p2p
Surge
Surge is a p2p filesharing app designed to utilize blockchain technologies to enable 100% anonymous file transfers. Surge is end-to-end encrypted, decentralized and open source.
Stars: ✭ 132 (-7.04%)
Mutual labels:  p2p
Wave Share
Serverless, peer-to-peer, local file sharing through sound
Stars: ✭ 1,641 (+1055.63%)
Mutual labels:  p2p
Gotorrent
goTorrent is a torrenting server built with Go (Golang) with websocket API that comes with a React web frontend.
Stars: ✭ 135 (-4.93%)
Mutual labels:  p2p
Syncthing Android
Wrapper of syncthing for Android.
Stars: ✭ 1,812 (+1176.06%)
Mutual labels:  p2p
Hublin
DEPRECATED - An easy and free video conference service based on WebRTC
Stars: ✭ 1,614 (+1036.62%)
Mutual labels:  p2p
Yrssf
一个分布式(p2p)云教学/云课堂/直播平台系统CMS,睿易派的开源替代品
Stars: ✭ 141 (-0.7%)
Mutual labels:  p2p
Pytorrent
Simple and functional BitTorrent client made in Python - Use for learning
Stars: ✭ 135 (-4.93%)
Mutual labels:  p2p
Autodl Trackers
Tracker files for autodl-community fork of autodl-irssi
Stars: ✭ 133 (-6.34%)
Mutual labels:  p2p

使用场景

有时,我们需要在家里访问公司的电脑,但如果任一方路由器分配的IP是运营商的内网IP,而不是公网IP,双方就无法直接通信。为了让双方电脑可以通讯,我们可以借助第三方提供的tunnel服务,利用服务器转发进行通讯,比较出名的是花生壳的内网穿透服务。本项目实现是的另外的解决思路,基于P2P NAT穿透,使位于NAT网络后的计算机直接通讯,无需借助第三方服务器进行数据转发,简单,高效和安全。

项目介绍

构架图

如上图所示,在公网上部署一台跨网服务器,该服务器运行解析端(proxy), P2P客户端和服务端启动时向跨网解析端提交TCP连接请求,以便公网解析端根据请求,记录各自自连接时NAT地址,并告知对方的NAT地址。P2P客户端和服务端尝试同时连接,进行NAT穿透。在穿透成功后,P2P终端可以脱离跨网解析端独立进行TCP数据通讯,无需第三方数据转发。

如何使用

  1. 迁出源码 git clone https://github.com/chenboxing/punching.git
  2. 进入项目目录 src/punching/
  3. 编译源码 make all # 编译所在平台的所有端 make_windows # 编译windows平台的所有端 make_linux # 编译linux平台的所有端 make_darwin # 编译mac os 平台的所有端 make_arm # 编译arm嵌入式平台的所有端,arm版本基于5
编译后二进制文件放在 punching/bin/目录下
  1. 跨网解析端和P2P端配置和使用

    4.1 跨网解析端部署(如没有公网服务器,此步可跳过):

    把proxy(代理转发端)和配置文件proxy.conf 部署到公网计算机上,配置proxy.conf配置节[proxy],设置侦听端口,默认7777 运行解析端 ./proxy

    4.2 配置P2P服务端和客户端

[ThirdProxy]
address = nat.move8.cn 
email   = [email protected]   
password = xxxxxxx

先在Nat网络一端,你需要开放访问服务的计算机上部署server端,配置config.conf配置节[server],在listen项里设置你要开放的应用服务,如 192.168.1.45:80, proxy添写你的代理转发端公网地址和端口,比如 xxx.f3322.net:7777, 如果你需要使用本站提供的代理转发,此项请为空,参考上面填写节[ThirdProxy]信息。

配置好,启动Server端:
nat_server.exe 

配置在Client端
在Nat网络的另一端,部署client端,先配置config.conf,在节[client],需要先设置好要侦听的端口信息,比如listen = :8585, proxy添写你的代理转发端公网地址和端口,比如 xxx.f3322.net:7777, 如果你需要使用本站提供的代理转发,此项请为空,参考上面填写节[ThirdProxy]信息。

配置好,启动Server端:
nat_client.exe 

当前局限

  1. 只能提供一对一的P2P通讯(Client端,Server端),无法多人访问开启的P2P服务端服务.如果你想实现多人访问开启的服务,你可以使用tunnel(隧道)工具,但前提是需要架设一台线上服务器,部署tunnel服务端,在要开放服务的计算机上部署tunnel客户端。
  2. 现在,项目只实现了TCP P2P穿透方案,如果后台服务需要UDP协议通讯 ,无法工作,比如vnc服务就无法访问,需要实现UDP和TCP穿透才可以工作。windows xp sp2下的平台也不支持P2P连接的TCP同时连接特性,在xp sp2平台上无法工作。

依赖的第三方包

  1. github.com/cihub/seelog: 日志记录增加包
  2. github.com/BurntSushi/toml: toml配置文件处理包
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].