/usr/share/gocode/src/github.com/linuxkit/virtsock/pkg/vsock/vsock.go is in golang-github-linuxkit-virtsock-dev 0.0~git20170720.0.0416e3d-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | // 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.
package vsock
import (
"fmt"
"net"
"os"
)
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
)
// VsockAddr represents the address of a vsock end point.
type VsockAddr struct {
CID uint32
Port uint32
}
// Network returns the network type for a VsockAddr
func (a VsockAddr) Network() string {
return "vsock"
}
// String returns a string representation of a VsockAddr
func (a VsockAddr) String() string {
return fmt.Sprintf("%08x.%08x", a.CID, a.Port)
}
// Conn is a vsock connection which supports half-close.
type Conn interface {
net.Conn
CloseRead() error
CloseWrite() error
File() (*os.File, error)
}
|