Documentation ¶
Index ¶
Constants ¶
View Source
const ( // Completed entry (ha valid). ATF_COM int32 = 0x02 // Permanent entry. ATF_PERM int32 = 0x04 // Publish entry. ATF_PUBL int32 = 0x08 // Has requested trailers. ATF_USETRAILERS int32 = 0x10 // Want to use a netmask (only for proxy entries). ATF_NETMASK int32 = 0x20 // Don't answer this addresses. ATF_DONTPUB int32 = 0x40 // Automatically added entry. ATF_MAGIC int32 = 0x80 )
ARP Flags values. See net/if_arp.h.
View Source
const ( ARPHRD_NETROM uint16 = 0 /* From KA9Q: NET/ROM pseudo. */ ARPHRD_ETHER uint16 = 1 /* Ethernet 10/100Mbps. */ ARPHRD_EETHER uint16 = 2 /* Experimental Ethernet. */ ARPHRD_AX25 uint16 = 3 /* AX.25 Level 2. */ ARPHRD_PRONET uint16 = 4 /* PROnet token ring. */ ARPHRD_CHAOS uint16 = 5 /* Chaosnet. */ ARPHRD_IEEE802 uint16 = 6 /* IEEE 802.2 Ethernet/TR/TB. */ ARPHRD_ARCNET uint16 = 7 /* ARCnet. */ ARPHRD_APPLETLK uint16 = 8 /* APPLEtalk. */ ARPHRD_DLCI uint16 = 15 /* Frame Relay DLCI. */ ARPHRD_ATM uint16 = 19 /* ATM. */ ARPHRD_METRICOM uint16 = 23 /* Metricom STRIP (new IANA id). */ ARPHRD_IEEE1394 uint16 = 24 /* IEEE 1394 IPv4 - RFC 2734. */ ARPHRD_EUI64 uint16 = 27 /* EUI-64. */ ARPHRD_INFINIBAND uint16 = 32 /* InfiniBand. */ )
ARP protocol HARDWARE identifiers.
Variables ¶
View Source
var ( BroadcastMAC = net.HardwareAddr{0xff, 0xff, 0xff, 0xff, 0xff, 0xff} ZeroMAC = net.HardwareAddr{0x00, 0x00, 0x00, 0x00, 0x00, 0x00} )
View Source
var ( // Requested IP is not is not in cache. ErrNotFound = errors.New("no such device or address") )
Functions ¶
func DelARPCache ¶
DelARPCache removes the ARP entry from the kernel's cache.
func SetARPCache ¶
SetARPCache set the ARP entry in the kernel's cache.
Types ¶
type Entry ¶
type Entry struct { IP net.IP // Type uint16 // Flags int32 // Addr net.HardwareAddr // MAC Mask syscall.RawSockaddr // Used in Proxy ARP. Not implemented but returned, somebody maybe find it useful. Device *net.Interface // Entry valid for this interface }
Represent an ARP entry
func Get ¶
Get query the kernel's cache first. If the entry is not in the cache, do an ARP request and registers the entry in the cache (if CAP_NET_ADMIN is set).
func GetARPCache ¶
GetARPCache look for the entry associated to ip and iface from the kernel's cache. If iface is nil, select the one automatically.
Click to show internal directories.
Click to hide internal directories.