utils

package
v1.0.22 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package utils implement utility functions used by several libs.

Index

Constants

View Source
const (
	// QemuHost describes a an address to start a qemu socket from the host.
	// It is of the form qemu:$emu_dir:$socket_name where emu_dir is the
	// working dir of the emulator and socket_name is the name of the socket file that will be created.
	QemuHost = "qemu"

	// QemuGuest describes an address from the guest perspective.
	// It is of the form qemu-guest:$socket_name where socket_name is the name of the socket the host is listening.
	QemuGuest = "qemu-guest"

	// VsockHost describes a VSOCK address from the host perspective
	VsockHost = "vsock-host"

	// VsockGuest describes a VSOCK address from the guest perspective
	VsockGuest = "vsock-guest"

	// QemuCtrl describes an address from the guest perspective, when using the qemu2 protocol.
	// It is of the form qemu-guest:$socket_name where socket_name is the name of the socket the host is listening.
	QemuCtrl = "qemu2"

	// Unix describes a Unix socket address.
	// It is of the form unix:$socket_name. If socket_name contains a leading @ then this is an abstract socket.
	Unix = "unix"

	// TCP describes a TCP socket.
	// It is of the form tcp:$addr:$port
	TCP = "tcp"

	// Mux describes an address of a connection that will be multiplexed through the gRPC multiplexer service.
	// It is of the form mux:$addr where addr itself is an unparsed <kind>:<addr> address.
	// addr will be used to open a connection the Mux service and is only intended to serve a single connection.
	Mux = "mux"

	// FD describes a file descriptor.
	// It is of the form fd:$fd_num where fd_num is the file descriptor number to open.
	// Note that this is only intended to be used in conjuction with a Mux addr.
	FD = "fd"

	// USB describes a USB endpoint.
	// It is of the form usb:$usb_serial where usb_serial is the serial number of the usb device.
	// Note that this is only intended to be used in conjuction with a Mux addr.
	USB = "usb"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ParsedAddr

type ParsedAddr struct {
	Kind       string
	Addr       string
	SocketName string
	FD         int

	// The address to use for multiplexed connections.
	MuxAddr *ParsedAddr
}

ParsedAddr represents an address of the form <kind>:<addr>.

func ParseAddr

func ParseAddr(addr string) (*ParsedAddr, error)

ParseAddr takes an address of the form <kind>:<addr> and returns a ParsedAddr.

Jump to

Keyboard shortcuts

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