Documentation
¶
Overview ¶
Package ipc provides communication between 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 NewArgsSocket ¶ added in v0.3.2
func NewArgsSocket() (*ArgsSender, *ArgsReceiver, error)
NewArgsSocket creates an anonymous socket for sending sandbox arguments.
Types ¶
type ArgsReceiver ¶ added in v0.3.2
type ArgsReceiver struct {
// Public, so it can be passed to child processes as ExtraFiles
Socket *os.File
}
func NewArgsReceiver ¶ added in v0.3.2
func NewArgsReceiver(fd uintptr) *ArgsReceiver
func (*ArgsReceiver) Close ¶ added in v0.3.2
func (c *ArgsReceiver) Close() error
func (*ArgsReceiver) Recv ¶ added in v0.3.2
func (c *ArgsReceiver) Recv() (*SandboxArgs, error)
Recv receives arguments. The function blocks until the arguments are available.
type ArgsSender ¶ added in v0.3.2
type ArgsSender struct {
// contains filtered or unexported fields
}
func NewArgsSender ¶ added in v0.3.2
func NewArgsSender(fd uintptr) *ArgsSender
func (*ArgsSender) Close ¶ added in v0.3.2
func (p *ArgsSender) Close() error
func (*ArgsSender) Send ¶ added in v0.3.2
func (p *ArgsSender) Send(args SandboxArgs) error
Send serializes and sends all the necessary arguments and configuration options obtained by the main process from command line and from config files.
type PtyReceiver ¶ added in v0.1.8
type PtyReceiver struct {
// contains filtered or unexported fields
}
PtyReceiver is created by the parent process to receive parent's descriptor of a sandboxed pseudoterminal. Parent process uses this descriptor to stream input and output between the sandboxed and the original terminal.
Unlike the socket pair for sending SandboxArgs, this uses a named Unix domain socket so it can also receive the descriptor from runsc, which connects to and sends the pseudoterminal master over a named socket passed via --console-socket and does not support an unnamed socket pair.
func NewPtyReceiver ¶ added in v0.1.8
func NewPtyReceiver(path string) (*PtyReceiver, error)
NewPtyReceiver creates a named Unix domain socket and listens on it.
It is OK for the sender (the child, or runsc via --console-socket) to connect to the socket and send the descriptor before the parent calls Recv.
func (*PtyReceiver) Close ¶ added in v0.1.8
func (p *PtyReceiver) Close()
Close closes the listening socket and removes it from the filesystem.
type PtySender ¶ added in v0.1.8
type PtySender struct {
// contains filtered or unexported fields
}
PtySender is created by the child process to send parent's descriptor of a sandboxed pseudoterminal.
func NewPtySender ¶ added in v0.1.8
NewPtySender connects to the named Unix domain socket the parent listens on (path).
type SandboxArgs ¶ added in v0.3.2
type SandboxArgs struct {
EnvId string
Paths *jailfs.Paths
Config *config.Config
BeRoot bool
ExecArgs []string
}
SandboxArgs contains arguments needed by the sandbox that the Drop main process constructs and sends. This allows command line argument parsing and TOML configs reading and parsing to be done once by a main process, and ensures processes executed by the main process see the same args.
Note for future extensions: unexported fields or interface types if included within SandboxArgs hierarchy will not be encoded and sent (encoding/gob limitation).