disco: IPIgnored -> IsIgnoredLocalIP

This commit is contained in:
rkonfj
2025-05-06 15:24:48 +08:00
parent f2bf173142
commit 9957204ae2
3 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -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
View File
@@ -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
View File
@@ -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 {