Skip to content

Commit

Permalink
feat:rm get internal ip
Browse files Browse the repository at this point in the history
Signed-off-by: Chen Kai <[email protected]>
  • Loading branch information
GrapeBaBa committed Jun 13, 2024
1 parent 42e6f33 commit 6795c90
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions cmd/shisui/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,23 +158,6 @@ func initDiscV5(config Config, conn discover.UDPConn) (*discover.UDPv5, *enode.L
localNode.SetFallbackIP(net.IP{127, 0, 0, 1})
localNode.Set(discover.Tag)

var addrs []net.Addr
addrs, err = net.InterfaceAddrs()

if err != nil {
return nil, nil, err
}

for _, address := range addrs {
// check ip addr is loopback addr
if ipnet, ok := address.(*net.IPNet); ok && !ipnet.IP.IsLoopback() {
if ipnet.IP.To4() != nil {
localNode.SetStaticIP(ipnet.IP)
break
}
}
}

discV5, err := discover.ListenV5(conn, localNode, discCfg)
if err != nil {
return nil, nil, err
Expand Down

0 comments on commit 6795c90

Please sign in to comment.