Documentation ¶
Overview ¶
Package network contains scripts and abstractions for setting up TAP-device based networks for a set of QEMU virtual machines.
Each virtual machine will get a TAP device, represented as a network, the TAP device will automatically get an IP address and DNS server using DHCP. The DNS server will resolve the "taskcluster" domains to the meta-data IP address. Request to the meta-data IP will be forwarded to the handler registered for the network instance.
This package uses iptables to lock down network and ensure that the virtual machine attached to a TAP device can't contact the meta-data handler of another virtual machine.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrAllNetworksInUse = errors.New("All networks in the network.Pool are in use")
ErrAllNetworksInUse is used to signal that we don't have any more networks available and, thus, can't return one.
Functions ¶
This section is empty.
Types ¶
type Network ¶
type Network struct {
// contains filtered or unexported fields
}
Network is provides the interface for using a TAP device, and releasing it.
func (*Network) SetHandler ¶
SetHandler sets the http.handler for meta-data service for this tap-device.
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool manages a static set of networks (TAP devices).
func NewPool ¶
NewPool creates N virtual networks and returns Pool. This should be called before the worker starts operating, we don't wish to dynamically reconfigure networks at runtime.
type UserNetwork ¶
type UserNetwork struct {
// contains filtered or unexported fields
}
UserNetwork provides an unsafe network implementation for use when building and testing images locally (without root access).
func NewUserNetwork ¶
func NewUserNetwork(socketFolder string) (*UserNetwork, error)
NewUserNetwork returns a Network implementation using the QEMU user-space network stack. This doesn't provide the same level of isolation, but the meta-data service should be sufficiently isolated.
func (*UserNetwork) NetDev ¶
func (n *UserNetwork) NetDev(ID string) string
NetDev returns the argument for the QEMU option -netdev
func (*UserNetwork) Release ¶
func (n *UserNetwork) Release()
Release frees all resources used by this network.
func (*UserNetwork) SetHandler ¶
func (n *UserNetwork) SetHandler(handler http.Handler)
SetHandler takes an http.Handler to be used for meta-data requests.