imp

package
v1.0.0-beta2 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ProtocolRevision is the master/IMP protocol revision, independent of the application version.
	// Resources created before the revision metadata was introduced have revision 1.
	ProtocolRevision uint32 = 2

	EnvVarMasterPublicKey = "BIFROEST_MASTER_PUBLIC_KEY"
	EnvVarReverseTCPUser  = "BIFROEST_REVERSE_TCP_USER"

	DefaultInitPathUnix    = `/var/lib/engity/bifroest/init`
	DefaultInitPathDarwin  = `/Library/Application Support/Engity/Bifroest/init`
	DefaultInitPathWindows = `C:\ProgramData\Engity\Bifroest\init`
)
View Source
const (
	DefaultInitPath = DefaultInitPathUnix
)
View Source
const (
	ServicePort = 8683
)

Variables

View Source
var (
	ErrNoSuchProcess = protocol.ErrNoSuchProcess
)

Functions

This section is empty.

Types

type ExecutionSession

type ExecutionSession interface {
	Session
	InitiateNamedPipeForUser(ctx context.Context, connectionId connection.Id, purpose net.Purpose, user, group string) (net.NamedPipe, error)

	// GetExecutionExitCode returns the exit code for one execution, or
	// [connection.ErrNotFound] if its result is not available yet.
	GetExecutionExitCode(ctx context.Context, connectionId connection.Id, executionId execution.Id) (int, error)

	// KillExecution will try to kill the process with the given signal.
	// If pid is 0, the process will be resolved from the provided execution ID.
	KillExecution(ctx context.Context, connectionId connection.Id, executionId execution.Id, pid int, signal sys.Signal) error
}

type Imp

type Imp interface {
	io.Closer
	Open(context.Context, Ref) (Session, error)
	GetMasterPublicKey() (crypto.PublicKey, error)
}

func NewImp

func NewImp(ctx context.Context, bifroestPrivateKey crypto.PrivateKey) (Imp, error)

type Ref

type Ref interface {
	SessionId() session.Id
	PublicKey() crypto.PublicKey
	Dial(context.Context) (gonet.Conn, error)
}

type Service

type Service struct {
	Version                    sys.Version
	ExitCodeByConnectionIdPath string
	Addr                       string
	MasterPublicKey            crypto.PublicKey
	SessionId                  session.Id
	ReverseTCPUser             string
	ReverseTCPUserConfigured   bool

	Logger log.Logger
}

func (*Service) Serve

func (this *Service) Serve(ctx context.Context) error

type Session

type Session interface {
	io.Closer
	Ping(ctx context.Context, connectionId connection.Id) error
	InitiateTcpForward(ctx context.Context, connectionId connection.Id, target net.HostPort) (gonet.Conn, error)
	InitiateNamedPipe(ctx context.Context, connectionId connection.Id, purpose net.Purpose) (net.NamedPipe, error)
	ListenReverseTCP(ctx context.Context, connectionId connection.Id, host string, port uint16) (gonet.Listener, error)

	// GetConnectionExitCode returns the legacy connection-scoped exit code, or
	// [connection.ErrNotFound] if its result is not available yet.
	GetConnectionExitCode(ctx context.Context, connectionId connection.Id) (int, error)

	GetEnvironment(ctx context.Context, connectionId connection.Id) (sys.EnvVars, error)

	// Kill will try to kill the process with the given signal.
	// If pid is 0, the process will be resolved from the provided connection ID.
	Kill(ctx context.Context, connectionId connection.Id, pid int, signal sys.Signal) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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