vsock

package
v0.0.0-...-8be290c Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package vsock provides the Linux guest bindings to VM sockets. VM sockets are a generic mechanism for guest<->host communication. It was originally developed for VMware but now also supports virtio sockets and (soon) Hyper-V sockets.

The main purpose is to provide bindings to the Linux implementation of VM sockets, based on the low level support in golang.org/x/sys/unix.

The package also provides bindings to the host interface to virtio sockets for HyperKit on macOS.

Index

Constants

View Source
const (
	// CIDAny is a wildcard CID
	CIDAny = 4294967295 // 2^32-1
	// CIDHypervisor is the reserved CID for the Hypervisor
	CIDHypervisor = 0
	// CIDHost is the reserved CID for the host system
	CIDHost = 2
)

Variables

This section is empty.

Functions

func Listen

func Listen(cid, port uint32) (net.Listener, error)

Listen returns a net.Listener which can accept connections on the given port

func SocketMode

func SocketMode(m string)

SocketMode is a NOOP on Linux

Types

type Addr

type Addr struct {
	CID  uint32
	Port uint32
}

Addr represents the address of a vsock end point.

func (Addr) Network

func (a Addr) Network() string

Network returns the network type for a Addr

func (Addr) String

func (a Addr) String() string

String returns a string representation of a Addr

type Conn

type Conn interface {
	net.Conn
	CloseRead() error
	CloseWrite() error
	File() (*os.File, error)
}

Conn is a vsock connection which supports half-close.

func Dial

func Dial(cid, port uint32) (Conn, error)

Dial connects to the CID.Port via virtio sockets

Jump to

Keyboard shortcuts

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