This Go package implements TCP/IP connectivity through VirtIO Networking to be
used with GOOS=tamago
as supported by the
TamaGo framework for bare metal Go on
AMD64/ARM/RISC-V processors.
The package supports TCP/IP networking through gVisor (go
branch)
tcpip
stack pure Go implementation.
The interface TCP/IP stack can be attached to the Go runtime by setting
net.SocketFunc
to the interface Socket
function:
// VirtIO over MMIO
dev := &vnet.Net{
Transport: &virtio.MMIO{
Base: vm.VIRTIO_NET0_BASE,
}
}
// VirtIO over PCI
dev := &vnet.Net{
Transport: &virtio.PCI{
Device: pci.Probe(
0,
vm.VIRTIO_NET_PCI_VENDOR,
vm.VIRTIO_NET_PCI_DEVICE,
),
}
}
// VirtIO interface
iface := vnet.Interface{}
// initialize IP, Netmask, Gateway
_ = iface.Init(dev, "10.0.0.1", "255.255.255.0", "10.0.0.2")
// Go runtime hook
net.SocketFunc = iface.Socket
See tamago-example for a full integration example.
Andrea Barisani
[email protected]
Andrej Rosano
[email protected]
The package API documentation can be found on pkg.go.dev.
For more information about TamaGo see its repository and project wiki.
tamago | https://github.com/usbarmory/virtio-net
Copyright (c) The virtio-net authors. All Rights Reserved.
These source files are distributed under the BSD-style license found in the LICENSE file.