rpc

package
v0.0.0-...-a733983 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dial

func Dial(proxy net.Conn, network string, addr string) (net.Conn, error)

func DialUDP

func DialUDP(client *rpc.Client, network string, laddr *net.UDPAddr, raddr *net.UDPAddr) (net.PacketConn, error)

func GuestClock

func GuestClock(ctx context.Context, conn net.Conn, interval time.Duration, adjtime func(time.Duration) error)

func HostClock

func HostClock(conn net.Conn)

func ListenUDP

func ListenUDP(client *rpc.Client, network string, laddr *net.UDPAddr) (net.PacketConn, error)

func NewEmitter

func NewEmitter(w io.WriteCloser, bufsize int) chan<- LogEvent

func NewEmitterWriter

func NewEmitterWriter(emitter chan<- LogEvent, name string, method LogMethod) io.Writer

func NewReceiver

func NewReceiver(r io.ReadCloser, bufsize int) <-chan LogEvent

func ServeDatagramProxy

func ServeDatagramProxy(conn net.Conn)

func ServeGuestAPI

func ServeGuestAPI(g Guest, conn io.ReadWriteCloser) error

The guest API only runs on one connection per VM

func ServeStreamProxy

func ServeStreamProxy(conn net.Conn)

Types

type Command

type Command struct {
	Name  string // only applies to Launch, identifies the service in the event log
	Path  string
	Dir   string
	Args  []string
	Env   []string
	Input []byte
}

type CommandOutput

type CommandOutput struct {
	Output []byte
	Exit   int
}

type DHCPResponse

type DHCPResponse struct {
	Address net.IP
}

type Datagram

type Datagram struct {
	UDPAddr  *net.UDPAddr
	UnixAddr *net.UnixAddr
	Data     []byte
}

type DatagramClient

type DatagramClient struct {
	// contains filtered or unexported fields
}

func DialUnix

func DialUnix(client *rpc.Client, network string, laddr *net.UnixAddr, raddr *net.UnixAddr) (*DatagramClient, error)

func ListenUnix

func ListenUnix(client *rpc.Client, network string, laddr *net.UnixAddr) (*DatagramClient, error)

func (*DatagramClient) Close

func (d *DatagramClient) Close() error

func (*DatagramClient) LocalAddr

func (d *DatagramClient) LocalAddr() net.Addr

func (*DatagramClient) Read

func (d *DatagramClient) Read(size int) ([]byte, net.Addr, error)

func (*DatagramClient) ReadFrom

func (d *DatagramClient) ReadFrom(b []byte) (int, net.Addr, error)

func (*DatagramClient) SetDeadline

func (d *DatagramClient) SetDeadline(t time.Time) error

func (*DatagramClient) SetReadDeadline

func (d *DatagramClient) SetReadDeadline(t time.Time) error

func (*DatagramClient) SetWriteDeadline

func (d *DatagramClient) SetWriteDeadline(t time.Time) error

func (*DatagramClient) WriteTo

func (d *DatagramClient) WriteTo(b []byte, addr net.Addr) (int, error)

type DatagramProxy

type DatagramProxy struct {
	// contains filtered or unexported fields
}

func (*DatagramProxy) Close

func (d *DatagramProxy) Close(_ struct{}, _ *struct{}) error

func (*DatagramProxy) Dial

func (d *DatagramProxy) Dial(spec DatagramSpec, _ *struct{}) error

func (*DatagramProxy) Listen

func (d *DatagramProxy) Listen(spec DatagramSpec, _ *struct{}) error

func (*DatagramProxy) Read

func (d *DatagramProxy) Read(size int, out *Datagram) error

func (*DatagramProxy) SetDeadline

func (d *DatagramProxy) SetDeadline(t time.Time, _ *struct{}) (err error)

func (*DatagramProxy) SetReadDeadline

func (d *DatagramProxy) SetReadDeadline(t time.Time, _ *struct{}) (err error)

func (*DatagramProxy) SetWriteDeadline

func (d *DatagramProxy) SetWriteDeadline(t time.Time, _ *struct{}) (err error)

func (*DatagramProxy) Write

func (d *DatagramProxy) Write(datagram Datagram, _ *struct{}) (err error)

type DatagramSpec

type DatagramSpec struct {
	Network    string
	LocalUDP   *net.UDPAddr
	RemoteUDP  *net.UDPAddr
	LocalUnix  *net.UnixAddr
	RemoteUnix *net.UnixAddr
}

type Guest

type Guest interface {
	// Init... initialize the guest
	Init(InitRequest, *struct{}) error
	// DHCP... start DHCPv4 on the main network interface
	DHCP(struct{}, *DHCPResponse) error
	// Write... overwrite/create a file
	Write(WriteRequest, *struct{}) error
	// Mkdir... create a directory, including parents
	Mkdir(string, *struct{}) error
	// Mount... mount a filesystem
	Mount(MountRequest, *struct{}) error
	// Run... execute a command synchronously
	Run(Command, *CommandOutput) error
	// Launch... execute a command asynchronously, output sent to event stream
	Launch(Command, *int64) error
	// Wait... wait for a service to exit
	Wait(string, *int) error
	// Release... release a service without calling Wait
	Release(string, *struct{}) error
	// Listen... listen on a network address
	Listen(ListenRequest, *struct{}) error
	// Signal... send a signal to a process
	Signal(SignalRequest, *struct{}) error
	// Metrics... get system metrics
	Metrics([]string, *event.Metrics) error
	// Shutdown... initiate shutdown
	Shutdown(struct{}, *struct{}) error
	// GC... run garbage collection
	GC(struct{}, *struct{}) error
}

func NewGuestClient

func NewGuestClient(c *rpc.Client) Guest

type GuestClient

type GuestClient struct {
	*rpc.Client
}

func (*GuestClient) DHCP

func (c *GuestClient) DHCP(_ struct{}, out *DHCPResponse) error

func (*GuestClient) GC

func (c *GuestClient) GC(_ struct{}, _ *struct{}) error

func (*GuestClient) Init

func (c *GuestClient) Init(req InitRequest, _ *struct{}) error

func (*GuestClient) Launch

func (c *GuestClient) Launch(req Command, out *int64) error

func (*GuestClient) Listen

func (c *GuestClient) Listen(req ListenRequest, _ *struct{}) error

func (*GuestClient) Metrics

func (c *GuestClient) Metrics(req []string, out *event.Metrics) error

func (*GuestClient) Mkdir

func (c *GuestClient) Mkdir(path string, _ *struct{}) error

func (*GuestClient) Mount

func (c *GuestClient) Mount(req MountRequest, _ *struct{}) error

func (*GuestClient) Release

func (c *GuestClient) Release(req string, _ *struct{}) error

func (*GuestClient) Run

func (c *GuestClient) Run(req Command, out *CommandOutput) error

func (*GuestClient) Shutdown

func (c *GuestClient) Shutdown(_ struct{}, _ *struct{}) error

func (*GuestClient) Signal

func (c *GuestClient) Signal(req SignalRequest, _ *struct{}) error

func (*GuestClient) Wait

func (c *GuestClient) Wait(req string, out *int) error

func (*GuestClient) Write

func (c *GuestClient) Write(req WriteRequest, _ *struct{}) error

type InitRequest

type InitRequest struct {
	OverlaySize   uint64
	ClockInterval time.Duration
	Sysctl        map[string]string
}

type ListenRequest

type ListenRequest struct {
	Network string
	Address string
}

type LogEvent

type LogEvent struct {
	Name   string
	Method LogMethod
	Data   []byte
}

type LogMethod

type LogMethod int8
const (
	LogStdout LogMethod = iota
	LogStderr
	LogInternal
	LogExit
)

type MountRequest

type MountRequest struct {
	FS     string
	Device string
	Target string
	Flags  []string
}

type SignalRequest

type SignalRequest struct {
	Service string
	Pid     int64
	Signal  int
}

type WriteRequest

type WriteRequest struct {
	Path string
	Data []byte
}

Jump to

Keyboard shortcuts

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