Compare commits

...
2 Commits
Author SHA1 Message Date
TenderIronh 0fb3bc4e26 request peer info token wrong 2022-06-15 23:20:13 +08:00
TenderIronh df23b30d2b doc 2022-05-29 16:05:18 +08:00
6 changed files with 7 additions and 6 deletions
+1 -1
View File
@@ -23,7 +23,7 @@
### 5. 跨平台 ### 5. 跨平台
因为轻量,所以很容易支持各个平台。支持主流的操作系统:Windows,Linux,MacOS;和主流的cpu架构:386、amd64、arm、arm64、mipsle、mipsle64、mips、mips64 因为轻量,所以很容易支持各个平台。支持主流的操作系统:Windows,Linux,MacOS;和主流的cpu架构:386、amd64、arm、arm64、mipsle、mipsle64、mips、mips64
### 6. 高效 ### 6. 高效
P2P直连可以让你的设备跑满带宽。不论你的设备在任何网络环境,无论NAT1-4Cone或Symmetric),UPNP,IPv6都支持。依靠Quic协议优秀的拥塞算法,能在糟糕的网络环境获得高带宽低延时。 P2P直连可以让你的设备跑满带宽。不论你的设备在任何网络环境,无论NAT1-4Cone或Symmetric),UDP或TCP打洞,UPNP,IPv6都支持。依靠Quic协议优秀的拥塞算法,能在糟糕的网络环境获得高带宽低延时。
### 7. 二次开发 ### 7. 二次开发
基于OpenP2P只需数行代码,就能让原来只能局域网通信的程序,变成任何内网都能通信 基于OpenP2P只需数行代码,就能让原来只能局域网通信的程序,变成任何内网都能通信
+1 -1
View File
@@ -25,7 +25,7 @@ The code is open source, the P2P tunnel uses TLS1.3+AES double encryption, and t
Benefit from lightweight, it easily supports most of major OS, like Windows, Linux, MacOS, also most of CPU architecture, like 386、amd64、arm、arm64、mipsle、mipsle64、mips、mips64. Benefit from lightweight, it easily supports most of major OS, like Windows, Linux, MacOS, also most of CPU architecture, like 386、amd64、arm、arm64、mipsle、mipsle64、mips、mips64.
### 6. Efficient ### 6. Efficient
P2P direct connection lets your devices make good use of bandwidth. Your device can be connected in any network environments, even supports NAT1-4 (Cone or Symmetric),UPNP,IPv6. Relying on the excellent congestion algorithm of the Quic protocol, high bandwidth and low latency can be obtained in a bad network environment. P2P direct connection lets your devices make good use of bandwidth. Your device can be connected in any network environments, even supports NAT1-4 (Cone or Symmetric),UDP or TCP punching,UPNP,IPv6. Relying on the excellent congestion algorithm of the Quic protocol, high bandwidth and low latency can be obtained in a bad network environment.
### 7. Integration ### 7. Integration
Your applicaiton can call OpenP2P with a few code to make any internal networks communicate with each other. Your applicaiton can call OpenP2P with a few code to make any internal networks communicate with each other.
+1
View File
@@ -136,6 +136,7 @@ func (pn *P2PNetwork) runAll() {
} }
config.nextRetryTime = time.Now().Add(time.Second * time.Duration(increase)) // exponential increase retry time. 1.3^x config.nextRetryTime = time.Now().Add(time.Second * time.Duration(increase)) // exponential increase retry time. 1.3^x
config.connectTime = time.Now() config.connectTime = time.Now()
config.peerToken = pn.config.Token
gConf.mtx.Unlock() // AddApp will take a period of time gConf.mtx.Unlock() // AddApp will take a period of time
err := pn.AddApp(*config) err := pn.AddApp(*config)
gConf.mtx.Lock() gConf.mtx.Lock()
+1 -1
View File
@@ -33,7 +33,7 @@ type P2PTunnel struct {
func (t *P2PTunnel) requestPeerInfo() error { func (t *P2PTunnel) requestPeerInfo() error {
// request peer info // request peer info
t.pn.write(MsgQuery, MsgQueryPeerInfoReq, &QueryPeerInfoReq{t.pn.config.Token, t.config.PeerNode}) t.pn.write(MsgQuery, MsgQueryPeerInfoReq, &QueryPeerInfoReq{t.config.peerToken, t.config.PeerNode})
head, body := t.pn.read("", MsgQuery, MsgQueryPeerInfoRsp, time.Second*10) head, body := t.pn.read("", MsgQuery, MsgQueryPeerInfoRsp, time.Second*10)
if head == nil { if head == nil {
return ErrPeerOffline return ErrPeerOffline
+2 -2
View File
@@ -10,7 +10,7 @@ import (
"time" "time"
) )
const OpenP2PVersion = "3.1.0" const OpenP2PVersion = "3.2.0"
const ProducnName string = "openp2p" const ProducnName string = "openp2p"
const LeastSupportVersion = "3.0.0" const LeastSupportVersion = "3.0.0"
@@ -148,7 +148,7 @@ const (
PublicIPEchoTimeout = time.Second * 1 PublicIPEchoTimeout = time.Second * 1
NatTestTimeout = time.Second * 10 NatTestTimeout = time.Second * 10
ClientAPITimeout = time.Second * 10 ClientAPITimeout = time.Second * 10
MaxDirectTry = 5 MaxDirectTry = 3
) )
// NATNone has public ip // NATNone has public ip
+1 -1
View File
@@ -64,7 +64,7 @@ func Discover() (nat NAT, err error) {
var n int var n int
_, _, err = socket.ReadFromUDP(answerBytes) _, _, err = socket.ReadFromUDP(answerBytes)
if err != nil { if err != nil {
gLog.Println(LvERROR, "UPNP discover error:", err) gLog.Println(LvDEBUG, "UPNP discover error:", err)
return return
} }