Documentation
¶
Index ¶
- Constants
- Variables
- func ConfigureInterface(name, cidr string) error
- func CreateTAP(name string) (int, error)
- func DeleteInterface(name string) error
- func GenerateMAC(vmID string) string
- func SetMTU(name string, mtu int) error
- func SetupIPForwarding() error
- type LinuxBackend
- type LinuxMachine
- func (m *LinuxMachine) Close(ctx context.Context) error
- func (m *LinuxMachine) DialVsock(port uint32) (net.Conn, error)
- func (m *LinuxMachine) Exec(ctx context.Context, command string, opts *api.ExecOptions) (*api.ExecResult, error)
- func (m *LinuxMachine) ExecInteractive(ctx context.Context, command string, opts *api.ExecOptions, rows, cols uint16, ...) (int, error)
- func (m *LinuxMachine) ListFiles(ctx context.Context, path string) ([]api.FileInfo, error)
- func (m *LinuxMachine) NetworkFD() (int, error)
- func (m *LinuxMachine) PID() int
- func (m *LinuxMachine) ReadFile(ctx context.Context, path string) ([]byte, error)
- func (m *LinuxMachine) RootfsPath() string
- func (m *LinuxMachine) Start(ctx context.Context) error
- func (m *LinuxMachine) Stop(ctx context.Context) error
- func (m *LinuxMachine) TapName() string
- func (m *LinuxMachine) VsockCID() uint32
- func (m *LinuxMachine) VsockFD() (int, error)
- func (m *LinuxMachine) VsockPath() string
- func (m *LinuxMachine) Wait(ctx context.Context) error
- func (m *LinuxMachine) WriteFile(ctx context.Context, path string, content []byte, mode uint32) error
Constants ¶
View Source
const ( // VsockPortExec is the port for command execution VsockPortExec = 5000 // VsockPortVFS is the port for VFS protocol VsockPortVFS = 5001 // VsockPortReady is the port for ready signal VsockPortReady = 5002 )
View Source
const (
TUNSETPERSIST = 0x400454cb
)
Variables ¶
View Source
var ( ErrTAPCreate = errors.New("create TAP device") ErrTAPConfigure = errors.New("configure TAP interface") ErrTAPSetMTU = errors.New("set MTU") ErrTAPDelete = errors.New("delete interface") ErrTUNOpen = errors.New("open TUN device") ErrTUNSETIFF = errors.New("TUNSETIFF") ErrTUNSETPERSIST = errors.New("TUNSETPERSIST") ErrTUNSETPERSISTOff = errors.New("TUNSETPERSIST(0)") ErrInterfaceNotFound = errors.New("interface not found") ErrInvalidCIDR = errors.New("invalid CIDR") ErrCreateSocket = errors.New("create socket") ErrSIOCSIFADDR = errors.New("SIOCSIFADDR") ErrSIOCSIFNETMASK = errors.New("SIOCSIFNETMASK") ErrSIOCGIFFLAGS = errors.New("SIOCGIFFLAGS") ErrSIOCSIFFLAGS = errors.New("SIOCSIFFLAGS") )
TAP / network interface errors
View Source
var ( ErrWriteConfig = errors.New("write firecracker config") ErrCreateLogFile = errors.New("create log file") ErrStartFirecracker = errors.New("start firecracker") ErrVMNotReady = errors.New("VM failed to become ready") ErrVMReadyTimeout = errors.New("timeout waiting for VM ready signal") ErrInvalidCPUCount = errors.New("invalid cpu count") )
Firecracker lifecycle errors
View Source
var ( ErrVsockNotConfigured = errors.New("vsock not configured") ErrVsockConnect = errors.New("connect to vsock UDS") ErrVsockSendConnect = errors.New("send CONNECT command") ErrVsockReadResponse = errors.New("read CONNECT response") ErrVsockConnectFailed = errors.New("vsock CONNECT failed") ErrVsockNoDirectFD = errors.New("vsock not implemented for direct FD access; use VsockPath for UDS") )
Vsock errors
View Source
var ( ErrExecConnect = errors.New("connect to exec service") ErrExecEncodeRequest = errors.New("encode exec request") ErrExecWriteHeader = errors.New("write header") ErrExecWriteRequest = errors.New("write request") ErrExecReadRespHeader = errors.New("read response header") ErrExecReadRespData = errors.New("read response data") ErrExecDecodeResponse = errors.New("decode exec response") ErrExecRemote = errors.New("exec error") )
Exec errors
View Source
var ( ErrStop = errors.New("stop") ErrCloseTapFD = errors.New("close tap fd") )
Close errors
Functions ¶
func ConfigureInterface ¶
func DeleteInterface ¶
func GenerateMAC ¶
func SetupIPForwarding ¶
func SetupIPForwarding() error
Types ¶
type LinuxBackend ¶
type LinuxBackend struct{}
func NewLinuxBackend ¶
func NewLinuxBackend() *LinuxBackend
func (*LinuxBackend) Name ¶
func (b *LinuxBackend) Name() string
type LinuxMachine ¶
type LinuxMachine struct {
// contains filtered or unexported fields
}
func (*LinuxMachine) DialVsock ¶ added in v0.1.20
func (m *LinuxMachine) DialVsock(port uint32) (net.Conn, error)
DialVsock opens a host-initiated vsock stream to a guest service port.
func (*LinuxMachine) Exec ¶
func (m *LinuxMachine) Exec(ctx context.Context, command string, opts *api.ExecOptions) (*api.ExecResult, error)
func (*LinuxMachine) ExecInteractive ¶
func (m *LinuxMachine) ExecInteractive(ctx context.Context, command string, opts *api.ExecOptions, rows, cols uint16, stdin io.Reader, stdout io.Writer, resizeCh <-chan [2]uint16) (int, error)
ExecInteractive executes a command with PTY support for interactive sessions
func (*LinuxMachine) NetworkFD ¶
func (m *LinuxMachine) NetworkFD() (int, error)
func (*LinuxMachine) PID ¶
func (m *LinuxMachine) PID() int
func (*LinuxMachine) RootfsPath ¶
func (m *LinuxMachine) RootfsPath() string
func (*LinuxMachine) TapName ¶
func (m *LinuxMachine) TapName() string
TapName returns the TAP interface name
func (*LinuxMachine) VsockCID ¶
func (m *LinuxMachine) VsockCID() uint32
VsockCID returns the guest CID
func (*LinuxMachine) VsockFD ¶
func (m *LinuxMachine) VsockFD() (int, error)
func (*LinuxMachine) VsockPath ¶
func (m *LinuxMachine) VsockPath() string
VsockPath returns the vsock UDS path for connecting to guest services
Click to show internal directories.
Click to hide internal directories.