Documentation ¶
Index ¶
Constants ¶
View Source
const ( // Redefine constant to avoid import of gopacket/pcap which requires CGO // https://github.com/google/gopacket/blob/v1.1.19/pcap/pcap.go#L124 BlockForever time.Duration = -time.Millisecond * 10 OperationTimeout time.Duration = 3 * time.Second SnapLen int32 = 64 )
Variables ¶
View Source
var ( // ErrEmptyPacket is returned when a packet of 0 bytes has been received ErrEmptyPacket = errors.New("received an empty packet") // ErrPacketCaptureClosed is returned when the packet capture channel // has been closed unexpectedly ErrPacketCaptureClosed = errors.New("packet capture channel closed") )
Functions ¶
Types ¶
type Binding ¶
type Binding struct { // VID is the associated VLAN ID, if one exists VID *uint16 // Time is the time the packet creating / updating the binding // was observed Time time.Time // IP is the IP a binding is tracking IP netip.Addr // MAC is the MAC address the IP is currently bound to MAC net.HardwareAddr }
Binding represents the binding between an IP address and MAC address
type Event ¶
type Event uint8
Event is an enum value for the type of event observed
func (Event) MarshalJSON ¶
MarshalJSON implements json.Marshaler for Event
func (*Event) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler for Event
type IPHwAddressPair ¶
type IPHwAddressPair struct { IP netip.Addr HwAddress net.HardwareAddr }
type Result ¶
type Result struct { // VID is the VLAN ID if one exists VID *uint16 `json:"vid"` // IP is the presentation format of an observed IP IP string `json:"ip"` // MAC is the presentation format of an observed MAC MAC string `json:"mac"` // Previous MAC is the presentation format of a previous MAC if // an EventMoved was observed PreviousMAC string `json:"previous_mac,omitempty"` // Time is the time the packet creating the Result was observed Time int64 `json:"time"` // Event is the type of event the Result is Event Event `json:"event"` }
Result is the result of observed ARP packets
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is responsible for starting packet capture and converting observed ARP packets into discovered Results
func NewService ¶
NewService returns a pointer to a Service. It takes the desired interface to observe's name as an argument
Click to show internal directories.
Click to hide internal directories.