Files
pulse/pkg/netutil/interface_priority.go
T
pulse-triage[bot] 5c3d18e248 Keep guest primary addresses associated with their interfaces
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
2026-10-09 13:07:08 +01:00

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
}