MCPcopy Create free account
hub / github.com/baidu/EasyFaaS / getIPMap

Method getIPMap

pkg/funclet/network/allocate_ip_linux.go:78–96  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

76}
77
78func (c *ContainerNetwork) getIPMap() (map[string]struct{}, error) {
79 // get the neighbors
80 var (
81 list []netlink.Neigh
82 err error
83 )
84
85 list, err = netlink.NeighList(c.bridge.Index, netlink.FAMILY_V4)
86 if err != nil {
87 return nil, fmt.Errorf("cannot retrieve IPv4 neighbor information for interface %s: %v", c.bridge.Name, err)
88 }
89
90 ipMap := map[string]struct{}{}
91 for _, entry := range list {
92 ipMap[entry.String()] = struct{}{}
93 }
94
95 return ipMap, nil
96}
97
98func isUnicastIP(ip net.IP, mask net.IPMask) bool {
99 // broadcast v4 ip

Callers 1

allocateIPMethod · 0.95

Calls 2

ErrorfMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected