embedspawn

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2024 License: MIT Imports: 34 Imported by: 0

Documentation

Overview

Embedspawn lets you run the spawn binary main function inside another program

This is used by ask.systems/daemon, but feel free to use it if you want to!

Index

Constants

This section is empty.

Variables

View Source
var File_embedspawn_config_proto protoreflect.FileDescriptor
View Source
var MegabinaryCommands []string

MegabinaryCommands is the list of commands that spawn should use as sub-commands of the binary running spawn. The main ask.systems/daemon binary sets this so spawn can run commands from it.

Functions

func Run

func Run(flagset *flag.FlagSet, args []string)

Types

type Command

type Command struct {

	// Binary is the absolute path to the executable file or the relative
	// path within the directory provided in the -path flag.
	//
	// Required.
	Binary string `protobuf:"bytes,1,opt,name=binary,proto3" json:"binary,omitempty"`
	// User to run the process as. Cannot be root.
	//
	// Required.
	User string `protobuf:"bytes,3,opt,name=user,proto3" json:"user,omitempty"`
	// Additional name to show in the dashboard to keep logs separate
	Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	// If unset, cd and/or chroot into $HOME, otherwise use this directory
	WorkingDir string `protobuf:"bytes,8,opt,name=working_dir,json=workingDir,proto3" json:"working_dir,omitempty"`
	// Set to true if you don't want the binary run in chroot at working_dir
	NoChroot bool `protobuf:"varint,7,opt,name=no_chroot,json=noChroot,proto3" json:"no_chroot,omitempty"`
	// Args is the arguments to pass to the executable
	Args []string `protobuf:"bytes,4,rep,name=args,proto3" json:"args,omitempty"`
	// Ports to listen on (with tcp) and pass to the process as files.
	// Useful for accessing the privelaged ports (<1024).
	//
	// In the child process, the sockets will have fd = 3 + i, where Ports[i] is
	// the port to bind
	Ports []uint32 `protobuf:"varint,5,rep,packed,name=ports,proto3" json:"ports,omitempty"`
	// Files to open and pass to the process
	//
	// In the child process, the files will have fd = 3 + len(Ports) + i, where
	// Files[i] is the file
	Files []string `protobuf:"bytes,6,rep,name=files,proto3" json:"files,omitempty"`
	// Set to true if all of the files are tls certs you want to keep
	// autoupdated. This is assumed to be true for portal. You only need this if
	// you want to make your own binary that gets files refreshed.
	//
	// This makes the files in the above array a pipe that will be updated with
	// the file contents on startup and when spawn in sent the SIGUSR1 signal.
	//
	// To use this run the following command after renewing your cert:
	//
	//	killall -SIGUSR1 {portal,spawn}
	AutoTlsCerts bool `protobuf:"varint,9,opt,name=auto_tls_certs,json=autoTlsCerts,proto3" json:"auto_tls_certs,omitempty"`
	// contains filtered or unexported fields
}

Next ID: 10

func ReadConfig

func ReadConfig(filename string) ([]*Command, error)

func (*Command) Descriptor deprecated

func (*Command) Descriptor() ([]byte, []int)

Deprecated: Use Command.ProtoReflect.Descriptor instead.

func (*Command) FullName

func (cmd *Command) FullName() string

func (*Command) GetArgs

func (x *Command) GetArgs() []string

func (*Command) GetAutoTlsCerts

func (x *Command) GetAutoTlsCerts() bool

func (*Command) GetBinary

func (x *Command) GetBinary() string

func (*Command) GetFiles

func (x *Command) GetFiles() []string

func (*Command) GetName

func (x *Command) GetName() string

func (*Command) GetNoChroot

func (x *Command) GetNoChroot() bool

func (*Command) GetPorts

func (x *Command) GetPorts() []uint32

func (*Command) GetUser

func (x *Command) GetUser() string

func (*Command) GetWorkingDir

func (x *Command) GetWorkingDir() string

func (*Command) ProtoMessage

func (*Command) ProtoMessage()

func (*Command) ProtoReflect

func (x *Command) ProtoReflect() protoreflect.Message

func (*Command) Reset

func (x *Command) Reset()

func (*Command) String

func (x *Command) String() string

type Config

type Config struct {
	Command []*Command `protobuf:"bytes,1,rep,name=command,proto3" json:"command,omitempty"`
	// contains filtered or unexported fields
}

The schema of the config file

Write the file in proto text format which is documented here: https://developers.google.com/protocol-buffers/docs/text-format-spec

func (*Config) Descriptor deprecated

func (*Config) Descriptor() ([]byte, []int)

Deprecated: Use Config.ProtoReflect.Descriptor instead.

func (*Config) GetCommand

func (x *Config) GetCommand() []*Command

func (*Config) ProtoMessage

func (*Config) ProtoMessage()

func (*Config) ProtoReflect

func (x *Config) ProtoReflect() protoreflect.Message

func (*Config) Reset

func (x *Config) Reset()

func (*Config) String

func (x *Config) String() string

Jump to

Keyboard shortcuts

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