示例#1
0
func (ep *endpoint) AddInterface(id int, mac net.HardwareAddr, ipv4 net.IPNet, ipv6 net.IPNet) error {
	ep.Lock()
	defer ep.Unlock()

	iface := &endpointInterface{
		id:     id,
		addr:   *netutils.GetIPNetCopy(&ipv4),
		addrv6: *netutils.GetIPNetCopy(&ipv6),
	}
	iface.mac = netutils.GetMacCopy(mac)

	ep.iFaces = append(ep.iFaces, iface)
	return nil
}
示例#2
0
func (i *endpointInterface) MacAddress() net.HardwareAddr {
	return netutils.GetMacCopy(i.mac)
}