Help us shape the future of Go! Take the 2026 Go Developer Survey

pointer

package
v0.5.7-rc.2 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package pointer is how a worker or connector finds its harness from the key its token carries, or the network name a person types. pointer.mainplane.ai maps the key to the harness's current URL, signed by the key, and a name to the key that claimed it. Neither the pointer nor the URL is trusted: the harness at the URL proves the key before any secret goes there, and a name leads only to a device code exchange that a wrong key cannot finish.

PUT pointer.mainplane.ai/<key>         {url, seq, sig}  sig over "<key> <url> <seq>"
PUT pointer.mainplane.ai/name/<name>   {key, seq, sig}  sig over "name <name> <key> <seq>"
GET <url>/id?nonce=<n>                 {url, sig,       sig over "id <url> <n>"
                                        noise}          noise over "noise <coordinator's Noise key>"

Index

Constants

View Source
const (
	LinuxDir = "/var/lib/mainplane-server"
	Config   = "config.json"
)

LinuxDir is the harness's directory on Linux, where admin serves the sessions drive from, and Config the config in the harness's directory.

Variables

View Source
var Dir = map[string]string{
	"linux":   LinuxDir,
	"darwin":  "/Library/Application Support/mainplane-server",
	"windows": filepath.Join(os.Getenv("ProgramData"), "mainplane-server"),
}[runtime.GOOS]

Dir is the directory of the harness installed on this machine. Only root and the operator may read it.

View Source
var (
	ErrTaken = errors.New("network name is taken") // another harness holds it

)

Functions

func Claim added in v0.5.2

func Claim(ctx context.Context, k ed25519.PrivateKey, name string) error

Claim makes name the network name of k's harness, in place of the one it had, which is then free. A name another harness holds is ErrTaken.

func Encode

func Encode(k ed25519.PrivateKey) string

Encode is k's public half as tokens and the pointer carry it.

func Find

func Find(ctx context.Context, key, cached string) (string, error)

Find is where the harness with key is: cached, when it proves the key there, else the URL on the pointer, once it proves the key there.

func ID

func ID(k ed25519.PrivateKey, url func() string, noise string) http.Handler

ID answers a proof for the harness with k, now reached at url(), whose coordinator has the Noise key noise.

func Key

func Key(file string) (ed25519.PrivateKey, error)

Key is the harness key kept in file, made there the first time. Only its owner may read it: whoever has it can move the harness's workers.

func Local added in v0.5.5

func Local(ctx context.Context, key string) string

Local is the loopback URL of the harness installed on this machine, when this process may read its config and the harness proves key there; else none. There it is reached with neither the tunnel nor the pointer.

func Named added in v0.5.2

func Named(ctx context.Context, name string) (string, error)

Named is the key of the harness that holds network name. It is a hint, as the URL is: a device code exchange with a harness that holds another key fails.

func Prove

func Prove(ctx context.Context, key, url string) error

Prove is nil when the harness at url holds key. It signs a fresh nonce with the URL it knows itself by, which must be url: a host that relays another harness's answer fails. On loopback the harness is on this machine and knows itself by its tunnel's URL, or by none before the tunnel is up.

func ProveNoise added in v0.3.0

func ProveNoise(ctx context.Context, key, url, noise string) error

ProveNoise is nil when the harness at url holds key and vouches for noise as its coordinator's Noise key.

func Publish

func Publish(ctx context.Context, k ed25519.PrivateKey, url string) error

Publish puts url on the pointer as the URL of k's harness. seq is the time, so the harness keeps no counter.

Types

This section is empty.

Jump to

Keyboard shortcuts

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