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

fix(loop): local loopback

This commit is contained in:
源文雨
2024-07-11 23:36:09 +09:00
parent ed19a5a08e
commit 02ad99abb2
2 changed files with 5 additions and 11 deletions

View File

@@ -86,9 +86,13 @@ func NewMe(cfg *MyConfig) (m Me) {
cache: ttl.NewCache[string, *Link](time.Minute),
}
m.router.SetDefault(nil)
_, localp, err := net.SplitHostPort(m.EndPoint().String())
if err != nil {
panic(err)
}
m.loop = m.AddPeer(&PeerConfig{
PeerIP: m.me.String(),
EndPoint: "127.0.0.1:56789",
EndPoint: "127.0.0.1:" + localp,
AllowedIPs: []string{cfg.MyIPwithMask},
NoPipe: cfg.NIC != nil,
MTU: cfg.MTU,