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

move router into link

This commit is contained in:
fumiama
2021-12-30 16:50:12 +08:00
parent 54303f8ab2
commit 0c3aa357d0
4 changed files with 12 additions and 12 deletions

View File

@@ -29,8 +29,6 @@ type Me struct {
connmapmu sync.RWMutex
// 本机监听的 endpoint
myconn *net.UDPConn
// 本机路由表
router *Router
// 不分目的 link 的接收队列
pipe chan *head.Packet
}
@@ -54,15 +52,9 @@ func NewMe(privateKey *[32]byte, myipwithmask string, myEndpoint string, nopipei
panic(err)
}
m.connections = make(map[string]*Link)
m.router = &Router{
list: make([]*net.IPNet, 1, 16),
table: make(map[string]*Link, 16),
}
m.router.SetDefault(nil)
if nopipeinlink {
m.pipe = make(chan *head.Packet, 32)
}
m.AddPeer(m.me.String(), nil, "127.0.0.1:56789", []string{myipwithmask, "127.0.0.0/8"}, 0, false, nopipeinlink)
return
}