mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-10-25 21:20:00 +00:00
5c3d18e248
Prefer named guest interfaces over local container networks instead of globally sorting flattened IP text. Preserve all secondary and unknown addresses, management interfaces, warm metadata caches, explicit agent report IPs and machine identity. Cover LXC status/config/runtime fallback, QEMU metadata and canonical list/broadcast projection for issue #2757. Change-source: pulse-maintainer
22 lines
748 B
Go
22 lines
748 B
Go
// Package netutil contains display-only network metadata helpers.
|
|
package netutil
|
|
|
|
import "strings"
|
|
|
|
// IsSecondaryInterfaceName recognises common local-container/overlay names.
|
|
// It is only an address-ordering hint: it proves neither a physical NIC nor a
|
|
// default route. Do not use it to discard interfaces or change machine identity.
|
|
// Management bridges, bonds, VLANs and tunnels are deliberately not excluded.
|
|
func IsSecondaryInterfaceName(name string) bool {
|
|
name = strings.ToLower(strings.TrimSpace(name))
|
|
if name == "" || name == "lo" {
|
|
return true
|
|
}
|
|
for _, prefix := range []string{"docker", "podman", "veth", "br-", "cni", "flannel", "virbr", "zt"} {
|
|
if strings.HasPrefix(name, prefix) {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|