mirror of
https://github.com/sigcn/pg.git
synced 2026-04-23 00:37:30 +08:00
disco: IPIgnored -> IsIgnoredLocalIP
This commit is contained in:
+2
-2
@@ -63,12 +63,12 @@ func RemoveIgnoredLocalCIDRs(cidrs ...string) {
|
||||
ignoredLocalCIDRs = filterd
|
||||
}
|
||||
|
||||
func IPIgnored(ip net.IP) bool {
|
||||
func IsIgnoredLocalIP(ip net.IP) bool {
|
||||
return ignoredLocalCIDRs.Contains(ip)
|
||||
}
|
||||
|
||||
func GetIgnoredLocalCIDRs() []net.IPNet {
|
||||
return append([]net.IPNet{}, ignoredLocalCIDRs...)
|
||||
return slices.Clone(ignoredLocalCIDRs)
|
||||
}
|
||||
|
||||
func SetIgnoredLocalInterfaceNamePrefixs(prefixs ...string) {
|
||||
|
||||
+1
-1
@@ -470,7 +470,7 @@ func (c *UDPConn) udpRead(udpConn *net.UDPConn) {
|
||||
|
||||
// ping
|
||||
if peerID := c.disco.ParsePing(buf[:n]); peerID.Len() > 0 {
|
||||
if disco.IPIgnored(peerAddr.IP) { // ignore packet from ip in the ignore list
|
||||
if disco.IsIgnoredLocalIP(peerAddr.IP) { // ignore packet from ip in the ignore list
|
||||
continue
|
||||
}
|
||||
c.tryGetPeerkeeper(udpConn, peerID).heartbeat(peerAddr)
|
||||
|
||||
+1
-1
@@ -341,7 +341,7 @@ func (c *PacketConn) networkChangeDetect() {
|
||||
delete(foundIPMap, e.Addr.IP.String())
|
||||
continue
|
||||
}
|
||||
if disco.IPIgnored(e.Addr.IP) {
|
||||
if disco.IsIgnoredLocalIP(e.Addr.IP) {
|
||||
continue
|
||||
}
|
||||
if _, ok := foundIPMap[e.Addr.IP.String()]; ok {
|
||||
|
||||
Reference in New Issue
Block a user