grantsock

package
v0.2.36 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package grantsock is the Unix socket the launcher (`txco sandbox`) reaches the chassis on: the `grant` personality. It carries a program's request to open a sandbox to the grant gateway and the gateway's answer back (chassis/grantwire has the protocol).

It is a socket and not a route on the web head because only processes on this machine have any business asking: the socket lives in a directory only the chassis's user may enter, so nothing on the network can reach it and nothing else on the machine can either.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultPath

func DefaultPath(dataDir string) string

DefaultPath is where the socket lives when --grant-socket is not given: a directory of its own under the system's temp dir, named for the chassis's data directory so two chassis on one machine do not share it and a restart finds the same place.

Types

type Controller

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

Controller listens on the socket.

func New

func New(ctx context.Context, log *zap.Logger, gw Gateway, path string) (*Controller, error)

New prepares the socket at path and refuses what cannot work: a path too long for the kernel, a directory others may enter, a socket another chassis is listening on.

func (*Controller) Listen

func (c *Controller) Listen() error

Listen makes the socket. It is apart from Start so that a chassis that cannot listen fails at boot, not in a goroutine.

func (*Controller) Path

func (c *Controller) Path() string

Path is where the socket is.

func (*Controller) Start

func (c *Controller) Start()

Start serves the socket until Stop, and returns at once, as every personality's Start does. Listen must have succeeded; without it Start does nothing.

func (*Controller) Stop

func (c *Controller) Stop()

Stop closes the socket, waits for the requests in flight, and removes it.

type Gateway

type Gateway interface {
	OpenSandbox(ctx context.Context, o grantgw.Open) grantgw.Answer
	ServeSocket(path string)
}

Gateway is what the socket needs of the grant gateway.

Jump to

Keyboard shortcuts

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