ipc

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package ipc provides communication between parent and child processes that setup Drop sandbox. The communication is via a Unix domain socket.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewParentChildSocket

func NewParentChildSocket() (*ParentEnd, *ChildEnd, error)

Types

type ChildArgs

type ChildArgs struct {
	EnvId    string
	Paths    *jailfs.Paths
	Config   *config.Config
	ExecArgs []string
}

ChildArgs contains arguments needed by both parent and child that the parent constructs and sends to the child.

Note for future extensions: unexported fields or interface types if included within ChildArgs chierarchy will not be encoded and sent (encoding/gob limitation).

type ChildEnd

type ChildEnd struct {
	// Public, so parent process can pass it to the executed child as
	// ExtraFiles
	Socket *os.File
}

func NewChildEnd

func NewChildEnd(fd uintptr) *ChildEnd

func (*ChildEnd) Close

func (c *ChildEnd) Close() error

func (*ChildEnd) RecvChildArgs

func (c *ChildEnd) RecvChildArgs() (*ChildArgs, error)

RecvChildArgs receives arguments sent by the parent process to the child. The function blocks until the arguments are available.

func (*ChildEnd) SendPty

func (c *ChildEnd) SendPty(f *os.File) error

SendPty sends parent descriptor of a sandboxed pseudoterminal. Parent process uses this descriptor to stream input and output between the sandboxed and the original terminal.

type ParentEnd

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

func NewParentEnd

func NewParentEnd(fd uintptr) *ParentEnd

func (*ParentEnd) Close

func (p *ParentEnd) Close() error

func (*ParentEnd) RecvPty

func (p *ParentEnd) RecvPty() (*os.File, error)

RecvPty receives a parent descriptor of a sandboxed pseudoterminal and wraps it into os.File

func (*ParentEnd) SendChildArgs

func (p *ParentEnd) SendChildArgs(args ChildArgs) error

SendChildArgs serializes and sends to the child all the necessary arguments and configuration options obtained by the parent from command line and from config files.

Parent sends the arguments after all the necessary setup needed by the child is finished (network setup is done), so the child can assume that after the arguments are received, a sandboxed process can be launched.

Jump to

Keyboard shortcuts

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