Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ARPProxyAdapter ¶
ARPProxyAdapter implements fake ARP support.
All ARPv4 requests sent on the interface will be transparently handled.
Gratuitous ARP requests are never replied to. All other ARP requests on the configured ARP network are replied to with the interface ethernet address.
type ARPTable ¶
type ARPTable interface { Register(*net.IPNet, net.HardwareAddr) Unregister(*net.IPNet) Resolve(net.IP) net.HardwareAddr }
ARPTable represents an ARP table.
type Adapter ¶
type Adapter interface { io.ReadWriteCloser Interface() *net.Interface Config() AdapterConfig }
Adapter is the base interface for tun & tap adapters.
func NewTapAdapter ¶
func NewTapAdapter(config *AdapterConfig) (Adapter, error)
NewTapAdapter instantiates a new tap adapter.
func NewTunAdapter ¶
func NewTunAdapter(config *AdapterConfig) (Adapter, error)
NewTunAdapter instantiates a new tun adapter.
type AdapterConfig ¶
type AdapterConfig struct { // Name is the name of the tap adapter to open. // // The exact value of this field is operating-system-dependant. // // On most systems, specifying an empty name will trigger auto-assignation // or device creation. Name string // IPv4 is an IPv4 address to set on the interface after its goes up. IPv4 *net.IPNet // IPv6 is an IPv6 address to set on the interface after its goes up. IPv6 *net.IPNet // DisableARP disables the ARP proxy. // // This is ignored on TUN adapters. DisableARP bool // DisableDHCP disables the fake DHCP server. DisableDHCP bool }
AdapterConfig represents a tap adapter config.
func NewAdapterConfig ¶
func NewAdapterConfig() *AdapterConfig
NewAdapterConfig instantiate a new default configuration.
type DHCPEntries ¶
type DHCPEntries []DHCPEntry
DHCPEntries represents a list of DHCP entries.
func (DHCPEntries) Find ¶
func (e DHCPEntries) Find(addr net.HardwareAddr) (DHCPEntry, bool)
Find a DHCP entry from its hardward address.
type DHCPProxyAdapter ¶
type DHCPProxyAdapter struct { Adapter RootLayer gopacket.LayerType ServerHardwareAddr net.HardwareAddr Entries DHCPEntries }
DHCPProxyAdapter implements a fake DHCP server as part of the adapter.
All DHCP requests sent on the interface will be transparently handled.