1
0
mirror of https://github.com/fumiama/WireGold.git synced 2026-06-04 23:40:26 +08:00

添加环回连接

This commit is contained in:
fumiama
2021-12-30 16:55:34 +08:00
parent 0c3aa357d0
commit bcfba4418f

View File

@@ -23,6 +23,8 @@ type Me struct {
subnet net.IPNet
// 本机 endpoint
myend *net.UDPAddr
// 本机环回 link
loop *Link
// 本机活跃的所有连接
connections map[string]*Link
// 读写同步锁
@@ -55,6 +57,7 @@ func NewMe(privateKey *[32]byte, myipwithmask string, myEndpoint string, nopipei
if nopipeinlink {
m.pipe = make(chan *head.Packet, 32)
}
m.loop = m.AddPeer(m.me.String(), nil, "127.0.0.1:56789", []string{myipwithmask}, 0, false, nopipeinlink)
return
}