perm

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package perm is the table that says which permission feature each host service belongs to. A host owner switches features on and off (`remohop config feature NAME on|off`); the host daemon refuses streams for services whose feature is off, and for services that are in no feature.

It is a leaf package so that service packages can register themselves from init() without importing the host daemon.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(service string, f Feature)

Register assigns a service to a feature. Service packages call it from init() for services not in the built-in table; a service that is never registered is refused by hosts. It panics on an unknown feature or on an attempt to move a service to a different feature, both programming errors.

func Services

func Services(f Feature) []string

Services lists the services of a feature, sorted.

func Valid

func Valid(f Feature) bool

Valid reports whether f is a switchable feature.

Types

type Feature

type Feature string

Feature names a group of services a host owner allows or forbids as one.

const (
	Shell   Feature = "shell"   // run commands: shell, exec, spawn, jobs
	File    Feature = "file"    // read and write files: fs, transfers, mounts
	Forward Feature = "forward" // port forwarding in both directions
	Clip    Feature = "clip"    // clipboard
	Screen  Feature = "screen"  // see the screen: screenshots, desktop viewing
	Input   Feature = "input"   // control keyboard and mouse
	Info    Feature = "info"    // system information
	VPN     Feature = "vpn"     // IP tunnel to this machine and its networks
	Serial  Feature = "serial"  // serial ports of this machine
	USB     Feature = "usb"     // export USB devices of this machine
	// Always is for services every authenticated client may use (ping,
	// pairing). It cannot be switched off.
	Always Feature = "always"
)

func Features

func Features() []Feature

Features lists the features a host owner can switch, in display order.

func Of

func Of(service string) (Feature, bool)

Of returns the feature a service belongs to.

type WithdrawnError

type WithdrawnError struct{ Feature Feature }

WithdrawnError says that the host's owner switched Feature off (or a grant stopped allowing it) while a stream of it was open. The host daemon cancels the context of such a stream's handler with it as the cause, so a service can tell the client why it ends: see Withdrawn.

func Withdrawn

func Withdrawn(err error) (*WithdrawnError, bool)

Withdrawn reports whether err, typically context.Cause of a handler's context, is a WithdrawnError, and returns it.

func (*WithdrawnError) Error

func (e *WithdrawnError) Error() string

Jump to

Keyboard shortcuts

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