package hvsock
import "github.com/linuxkit/virtsock/pkg/hvsock"
Package hvsock provides a Go interface to Hyper-V sockets both on Windows and on Linux. The Linux bindings require patches for the 4.9.x kernel. If you are using a Linux kernel 4.14.x or newer you should use the vsock package instead as the Hyper-V socket support in these kernels have been merged with the virtio sockets implementation.
Index ¶
- Variables
- func Listen(addr Addr) (net.Listener, error)
- func Supported() bool
- type Addr
- type Conn
- type GUID
Variables ¶
var ( // GUIDZero used by listeners to accept connections from all partitions GUIDZero, _ = GUIDFromString("00000000-0000-0000-0000-000000000000") // GUIDWildcard used by listeners to accept connections from all partitions GUIDWildcard, _ = GUIDFromString("00000000-0000-0000-0000-000000000000") // GUIDBroadcast undocumented GUIDBroadcast, _ = GUIDFromString("FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF") // GUIDChildren used by listeners to accept connections from children GUIDChildren, _ = GUIDFromString("90db8b89-0d35-4f79-8ce9-49ea0ac8b7cd") // GUIDLoopback use to connect in loopback mode GUIDLoopback, _ = GUIDFromString("e0e16197-dd56-4a10-9195-5ee7a155a838") // GUIDParent use to connect to the parent partition GUIDParent, _ = GUIDFromString("a42e7cda-d03f-480c-9cc2-a4de20abb878") )
Functions ¶
func Listen ¶
Listen returns a net.Listener which can accept connections on the given port
func Supported ¶
func Supported() bool
Supported returns if hvsocks are supported on your platform
Types ¶
type Addr ¶
Addr represents a Hyper-V socket address
func (Addr) Network ¶
Network returns the type of network for Hyper-V sockets
func (Addr) String ¶
type Conn ¶
Conn is a hvsock connection which supports half-close.
func Dial ¶
Dial a Hyper-V socket address
type GUID ¶
type GUID [16]byte
GUID is used by Hypper-V sockets for "addresses" and "ports"
func GUIDFromString ¶
GUIDFromString parses a string and returns a GUID
func (*GUID) Port ¶
Port converts a Service GUID to a "port" usable by the vsock package. It can be used to convert hvsock code to vsock code. On 4.14.x kernels Service GUIDs for talking to Linux should have the form of xxxxxxxx-facb-11e6-bd58-64006a7986d3, where xxxxxxxx is the vsock port.
func (*GUID) String ¶
Convert a GUID into a string
Source Files ¶
- Version
- v0.0.0-20241009230534-cb6a20cc0422 (latest)
- Published
- Oct 9, 2024
- Platform
- linux/amd64
- Imports
- 9 packages
- Last checked
- 2 months ago –
Tools for package owners.