arp

package
v0.0.0-...-75a7993 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Copyright © 2019 Amari Robinson

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	InterfaceIndex int
	// E.g. unix.AF_INET
	Family          int
	DestinationAddr []byte
	LinkLayerAddr   []byte

	Flags Flags
	State State
}

func (*Entry) HardwareAddr

func (e *Entry) HardwareAddr() net.HardwareAddr

func (*Entry) Interface

func (e *Entry) Interface() (*net.Interface, error)

func (*Entry) InterfaceName

func (e *Entry) InterfaceName() string

func (*Entry) RemoteIP

func (e *Entry) RemoteIP() net.IP

type Flags

type Flags struct {
	IPv6Router    bool
	ProxyARPEntry bool
}

type PollFunc

type PollFunc func(context.Context, Entry)

type State

type State int
const (
	Incomplete State = unix.NUD_INCOMPLETE
	Reachable  State = unix.NUD_REACHABLE
	Stale      State = unix.NUD_STALE
	Delay      State = unix.NUD_DELAY
	Probe      State = unix.NUD_PROBE
	Failed     State = unix.NUD_FAILED
	NoARP      State = unix.NUD_NOARP
	Permanent  State = unix.NUD_PERMANENT
)

type Table

type Table struct {
}

An Table is the system defined ARP table cache.

func NewTable

func NewTable() (*Table, error)

func (*Table) Close

func (t *Table) Close() (err error)

func (*Table) Poll

func (t *Table) Poll(ctx context.Context, f PollFunc) (err error)

Poll polls the system arp table

type Watcher

type Watcher struct {
	// contains filtered or unexported fields
}

func NewWatcher

func NewWatcher(d time.Duration) (*Watcher, error)

func (*Watcher) Close

func (w *Watcher) Close() error

func (*Watcher) ForcePoll

func (w *Watcher) ForcePoll() error

used when there's a cache miss and we want to be sure

func (*Watcher) GetHardwareAddrForIP4

func (w *Watcher) GetHardwareAddrForIP4(ip net.IP) net.HardwareAddr

func (*Watcher) HardwareAddrsByIP

func (w *Watcher) HardwareAddrsByIP() map[string]net.HardwareAddr

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL