package msg

import "github.com/rootless-containers/rootlesskit/pkg/port/builtin/msg"

Index

Constants

const (
	RequestTypeInit    = "init"
	RequestTypeConnect = "connect"
)

Functions

func ConnectToChild

func ConnectToChild(c *net.UnixConn, spec port.Spec) (int, error)

ConnectToChild connects to the child UNIX socket, and obtains TCP or UDP socket FD that corresponds to the port spec.

func ConnectToChildWithRetry

func ConnectToChildWithRetry(socketPath string, spec port.Spec, retries int) (int, error)

ConnectToChildWithRetry retries ConnectToChild every (i*5) milliseconds.

func ConnectToChildWithSocketPath

func ConnectToChildWithSocketPath(socketPath string, spec port.Spec) (int, error)

ConnectToChildWithSocketPath wraps ConnectToChild

func Initiate

func Initiate(c *net.UnixConn) error

Initiate sends "init" request to the child UNIX socket.

Types

type Reply

type Reply struct {
	Error string
}

Reply may contain FD as OOB

type Request

type Request struct {
	Type  string // "init" or "connect"
	Proto string // "tcp" or "udp"
	Port  int
}

Request and Response are encoded as JSON with uint32le length header.

Source Files

msg.go

Version
v0.9.0
Published
Mar 6, 2020
Platform
js/wasm
Imports
6 packages
Last checked
1 hour ago

Tools for package owners.