vsock

package
v0.6.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 31, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package vsock provides Go net.Conn adapters for Virtio socket connections and helpers for connecting to and accepting connections from a guest over vsock.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn struct {
	// contains filtered or unexported fields
}

Conn wraps a Virtio socket connection as a net.Conn.

func NewConn

func NewConn(vzConn vz.VZVirtioSocketConnection) (*Conn, error)

NewConn converts a Virtio socket connection into a net.Conn.

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) LocalAddr

func (c *Conn) LocalAddr() net.Addr

func (*Conn) Read

func (c *Conn) Read(b []byte) (int, error)

func (*Conn) RemoteAddr

func (c *Conn) RemoteAddr() net.Addr

func (*Conn) SetDeadline

func (c *Conn) SetDeadline(t time.Time) error

func (*Conn) SetReadDeadline

func (c *Conn) SetReadDeadline(t time.Time) error

func (*Conn) SetWriteDeadline

func (c *Conn) SetWriteDeadline(t time.Time) error

func (*Conn) Write

func (c *Conn) Write(b []byte) (int, error)

type Listener added in v0.6.11

type Listener struct {
	Port uint32
	// contains filtered or unexported fields
}

Listener accepts guest-initiated Virtio socket connections on a host port.

func Listen added in v0.6.11

func Listen(device vz.VZVirtioSocketDevice, port uint32, dispatch func(func())) (*Listener, error)

Listen installs a Virtio socket listener for port on device. If dispatch is non-nil, Virtualization.framework calls are run through it.

func (*Listener) Accept added in v0.6.11

func (l *Listener) Accept() (*Conn, error)

Accept waits for and returns the next guest connection.

func (*Listener) Close added in v0.6.11

func (l *Listener) Close() error

Close removes the listener from the socket device.

type Manager

type Manager struct {

	// DispatchFunc runs Virtualization calls on the VM's queue.
	DispatchFunc func(fn func())
	// contains filtered or unexported fields
}

Manager manages the first Virtio socket device on a running VM.

func NewManager

func NewManager(machine vz.VZVirtualMachine) (*Manager, error)

NewManager wraps the first Virtio socket device from a running VM.

func (*Manager) Connect

func (m *Manager) Connect(port uint32) (net.Conn, error)

Connect establishes a vsock connection to port.

func (*Manager) Listen added in v0.6.11

func (m *Manager) Listen(port uint32) (*Listener, error)

Listen installs a listener on the managed socket device.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL