github.com/sagernet/netlink@v0.0.0-20240612041022-b9a21c07ac6a/neigh.go (about)

     1  package netlink
     2  
     3  import (
     4  	"fmt"
     5  	"net"
     6  )
     7  
     8  // Neigh represents a link layer neighbor from netlink.
     9  type Neigh struct {
    10  	LinkIndex    int
    11  	Family       int
    12  	State        int
    13  	Type         int
    14  	Flags        int
    15  	FlagsExt     int
    16  	IP           net.IP
    17  	HardwareAddr net.HardwareAddr
    18  	LLIPAddr     net.IP //Used in the case of NHRP
    19  	Vlan         int
    20  	VNI          int
    21  	MasterIndex  int
    22  }
    23  
    24  // String returns $ip/$hwaddr $label
    25  func (neigh *Neigh) String() string {
    26  	return fmt.Sprintf("%s %s", neigh.IP, neigh.HardwareAddr)
    27  }
    28  
    29  // NeighUpdate is sent when a neighbor changes - type is RTM_NEWNEIGH or RTM_DELNEIGH.
    30  type NeighUpdate struct {
    31  	Type uint16
    32  	Neigh
    33  }