Documentation ¶
Overview ¶
Package enet implements TCP/IP connectivity through Ethernet (ENET) controllers on i.MX6 SoCs.
The TCP/IP stack is implemented using gVisor pure Go implementation.
This package is only meant to be used with `GOOS=tamago GOARCH=arm` as supported by the TamaGo framework for bare metal Go, see https://github.com/usbarmory/tamago.
Index ¶
- Variables
- type Interface
- func (iface *Interface) DialContextTCP4(ctx context.Context, address string) (net.Conn, error)
- func (iface *Interface) DialTCP4(address string) (net.Conn, error)
- func (iface *Interface) DialUDP4(lAddr, rAddr string) (net.Conn, error)
- func (iface *Interface) EnableICMP() error
- func (iface *Interface) Init(nic *enet.ENET, ip string, netmask string, mac string, gateway string) (err error)
- func (iface *Interface) ListenerTCP4(port uint16) (net.Listener, error)
- func (iface *Interface) Socket(ctx context.Context, network string, family, sotype int, laddr, raddr net.Addr) (c interface{}, err error)
- type NIC
Constants ¶
This section is empty.
Variables ¶
var ( // MTU represents the Ethernet Maximum Transmission Unit. MTU uint32 = enet.MTU // NICID represents the default gVisor NIC identifier NICID = tcpip.NICID(1) // DefaultStackOptions represents the default gVisor Stack configuration DefaultStackOptions = stack.Options{ NetworkProtocols: []stack.NetworkProtocolFactory{ ipv4.NewProtocol, arp.NewProtocol}, TransportProtocols: []stack.TransportProtocolFactory{ tcp.NewProtocol, icmp.NewProtocol4, udp.NewProtocol}, } )
Functions ¶
This section is empty.
Types ¶
type Interface ¶
Interface represents an Ethernet interface instance.
func (*Interface) DialContextTCP4 ¶
DialContextTCP4 connects to an IPv4 TCP address with support for timeout supplied by ctx.
func (*Interface) DialUDP4 ¶
DialUDP4 creates a UDP connection to the ip:port specified by rAddr, optionally setting the local ip:port to lAddr.
func (*Interface) EnableICMP ¶
EnableICMP adds an ICMP endpoint to the interface, it is useful to enable ping requests.
func (*Interface) Init ¶
func (iface *Interface) Init(nic *enet.ENET, ip string, netmask string, mac string, gateway string) (err error)
Init initializes an ENET Ethernet interface associating it to a gVisor link, a default NICID and TCP/IP gVisor Stack are set if not previously assigned.
func (*Interface) ListenerTCP4 ¶
ListenerTCP4 returns a net.Listener capable of accepting IPv4 TCP connections for the argument port.
type NIC ¶
type NIC struct { // MAC address MAC net.HardwareAddr // Link is a gVisor channel endpoint Link *channel.Endpoint // Device is the physical interface associated to the virtual one. Device *enet.ENET }
NIC represents an virtual Ethernet instance.
func (*NIC) Init ¶
Init initializes a virtual Ethernet instance bound to a physical Ethernet device.