Closed fenciu closed 6 months ago
./peer serve --cluster-key “密钥”-l 0.0.0.0:1758
1758 监听的是不安全的 ws,推荐使用 caddy 等反代服务器包装为安全的 wss,然后客户端才可以使用 wss
./peer vpn --peermap wss://<服务端>:1758/ --cidr 101.1.1.2/24 --secret “密钥”
Error: no peermap server available
--secret
不是服务器的 cluster-key
。使用 peerguard token --cluster-key 密钥 --network default
生成 NetworkSecret
我直接用http了,正常使用没有问题,
docker run -d -p 9001:80 -it badapple9/speedtest-x
当我部署了speedtest,测速的时候就报下面的错中断了。
`time=2024-02-05T11:23:31.580+08:00 level=WARN msg="STUN not set and peers direct connect is disabled" time=2024-02-05T11:23:31.581+08:00 level=INFO msg="Serving for http now" listen=0.0.0.0:80 panic: concurrent write to websocket connection
goroutine 116 [running]: github.com/gorilla/websocket.(messageWriter).flushFrame(0xc0002ce750, 0x1, {0x0?, 0x43bc2e?, 0x0?}) /home/rkonfj/.go/pkg/mod/github.com/gorilla/websocket@v1.5.1/conn.go:632 +0x4b8 github.com/gorilla/websocket.(Conn).WriteMessage(0xc0002c6000, 0x9?, {0x0, 0x0, 0x0}) /home/rkonfj/.go/pkg/mod/github.com/gorilla/websocket@v1.5.1/conn.go:785 +0x127 github.com/rkonfj/peerguard/peermap.(Peer).keepalive(0xc00028c080) /home/rkonfj/Documents/peerguard/peermap/peermap.go:141 +0x3f created by github.com/rkonfj/peerguard/peermap.(Peer).Start in goroutine 113 /home/rkonfj/Documents/peerguard/peermap/peermap.go:58 +0xa9`
@fenciu 这个 commit 修复了这个问题 edb7171e31cabd5ab4007a2f1a77abc91fa006c7
@fenciu
不过我部署一个在云电脑,另外一个手机热点的电脑,两个互连走的好像是我中转服务器的浏览
peermap 需要指定 stun 参数(指定多个更健壮),否则客户端之间总是走中继。比如可以使用公开的 STUN 服务器:
./peerguard serve --cluster-key “密钥”-l 0.0.0.0:1758 --stun stun.qq.com:3478 --stun stun.miwifi.com:3478
另外最新版本增加了端口扫描功能,对于 Symmetric NAT 设备也有了一定机率直连
加了--stun有时候可以,感谢。
如果还有其他问题,欢迎创建新的 issue 。关闭这个了
服务端:./peer serve --cluster-key “密钥”-l 0.0.0.0:1758 客户端:./peer vpn --peermap wss://<服务端>:1758/ --cidr 101.1.1.2/24 --secret “密钥”
但是客户端提示 time=2024-02-05T10:20:27.438+08:00 level=INFO msg="Using existing driver 0.14" time=2024-02-05T10:20:27.476+08:00 level=INFO msg="Creating adapter" time=2024-02-05T10:20:27.847+08:00 level=INFO msg="Removed orphaned adapter \"pg0 1\"" Error: no peermap server available