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", "tcp4", "tcp6", "udp", "udp4", "udp6"
	IP    string
	Port  int
}

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

Source Files

msg.go

Version
v1.1.1 (latest)
Published
May 30, 2023
Platform
linux/amd64
Imports
7 packages
Last checked
3 weeks ago

Tools for package owners.