- Notifications
You must be signed in to change notification settings - Fork25
提供企业级网络设备之间数据的快速,安全,可靠的P2P传输协议
License
NotificationsYou must be signed in to change notification settings
PearInc/FogConnect
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
FogConnet 是用于P2P网络中连接、调度、传输等功能于一体的组件
- 支持多种传输控制协议(UDP、QUIC、RTC、KCP、uTP、SCTP等)
- 探测NAT类型,并收集和维护用于P2P连接的
<IP:Port>
列表 - 支持双向 “打洞” 和高级端口预测
- NAT类型最优匹配组合策略
- 连接控制与物理距离最近原则
- 所有网络信号采用事件机制处理
- 对资源消耗极少(一般运行状态下内存占用3-5M,峰值不超过50M)
- API简单、易懂,支持多种方式接入
FogConnect depends on following packages:
- Linux(e.g. Ubuntu, OpenWrt), Windows, MacOS, Android, iOS
Install common deps:
sudo apt-get install git make
Install dependencies:
sudo apt-get install openssl libssl-dev libwebsockets-dev libjansson-dev libevent-dev libglib2.0-dev
make
平均P2P建立连接时间:1.2~2秒
Ubuntu 16.04.3 LTS
Intel(R) Core(TM) i5-7500 CPU @ 2.40 GHz
Mem: 7840 MB
#include"fog_connect.h"charCRLF[2]="\r\n";voidon_connect(void*arg) {}voidon_recv(void*arg) {fc_info*ud= (fc_info*)arg;size_tlen=0;char*msg=evbuffer_readln(ud->buff,&len,EVBUFFER_EOL_CRLF);if (msg!=NULL) {fc_send(ud->pr_connect,msg,len);fc_send(ud->pr_connect,CRLF,sizeof(CRLF));printf("sending: %s\n",msg);fc_free(msg); }}voidon_close(void*arg) {}intmain() {fc_setup("**:**:**:**:**:1c");fc_set_callback(on_connect,on_recv,on_close);getchar();fc_exit();return0;}
#include"fog_connect.h"voidon_connect(void*arg) {fc_info*ud= (fc_info*)arg;char*msg=strdup("hello\r\n");fc_send(ud->pr_connect,msg,strlen(msg));printf("sending: %s\n",msg);fc_free(msg);}voidon_recv(void*arg) {fc_info*ud= (fc_info*)arg;size_tlen=0;char*msg=evbuffer_readln(ud->buff,&len,EVBUFFER_EOL_CRLF);if (msg!=NULL) {printf("receiving: %s\n",msg);fc_free(msg);fc_disconnect(ud->pr_connect); }}voidon_close(void*arg) {}intmain() {fc_setup("**:**:**:**:**:2c");fc_connect_peer("**:**:**:**:**:1c",FOG_TRANSPORT_PROTOCOL_KCP,on_connect,on_recv,on_close);getchar();fc_exit();return0;}
- 吴必磊(w@pear.hk)
- 知名数据恢复软件AnyDataRecovery Pro作者、反汇编与破解专家(同时也是不知名的健身教练)
- 万昌龙(d@pear.hk)
- 陈柳州(66@pear.hk)
About
提供企业级网络设备之间数据的快速,安全,可靠的P2P传输协议
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
No releases published
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.
Contributors6
Uh oh!
There was an error while loading.Please reload this page.