package vsock
import "github.com/linuxkit/virtsock/pkg/vsock"
Package vsock provides bindings to the hyperkit based implementation on macOS hosts. virtio Sockets are exposed as named pipes on macOS. Two modes are supported (to be set with SockerMode()):
- Hyperkit mode: The package needs to be initialised with the path to where the named pipe was created.
- Docker for Mac mode: This is a shortcut which hard codes the location of the named pipe.
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
- func Listen(cid, port uint32) (net.Listener, error)
- func SocketMode(socketMode string)
- type Addr
- type Conn
Constants ¶
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 )
Functions ¶
func Listen ¶
Listen creates a listener for a specifc vsock.
func SocketMode ¶
func SocketMode(socketMode string)
SocketMode initialises the bindings to either raw hyperkit mode ("hyperkit:/path") or Docker for Mac mode ("docker"). This function must be called before using the vsock bindings.
Types ¶
type Addr ¶
Addr represents the address of a vsock end point.
func (Addr) Network ¶
Network returns the network type for a Addr
func (Addr) String ¶
String returns a string representation of a Addr
type Conn ¶
Conn is a vsock connection which supports half-close.
func Dial ¶
Dial creates a connection to the VM with the given client ID and port
Source Files ¶
- Version
- v0.0.0-20241009230534-cb6a20cc0422 (latest)
- Published
- Oct 9, 2024
- Platform
- darwin/amd64
- Imports
- 6 packages
- Last checked
- 2 months ago –
Tools for package owners.