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 on ARM SoCs, 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) 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 uint32 = enet.MTU
MTU represents the Ethernet Maximum Transmission Unit.
Functions ¶
This section is empty.
Types ¶
type Interface ¶
type Interface struct { NIC *NIC Stack *stack.Stack Link *channel.Endpoint // contains filtered or unexported fields }
Interface represents an Ethernet interface instance.
func Init ¶
func Init(nic *enet.ENET, ip string, netmask string, mac string, gateway string, id int, stack *stack.Stack) (iface *Interface, err error)
Init initializes an ENET Ethernet interface associating it to a gVisor link, the link is assigned to a new or existing TCP/IP gVisor stack depending on the stack argument.
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) 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.