Files
flock/pkg/agent/hostiface.go
T

16 lines
392 B
Go
Raw Normal View History

package agent
import (
"fmt"
"hash/fnv"
)
// HostIfaceName returns the deterministic per-pod host-side veth name
// "flock<8hex>". 8 hex chars of FNV-1a-32(containerID) yields a 13-char
// name, well under Linux's 15-char IFNAMSIZ limit.
func HostIfaceName(containerID string) string {
h := fnv.New32a()
_, _ = h.Write([]byte(containerID))
return fmt.Sprintf("flock%08x", h.Sum32())
}