pkg

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2026 License: AGPL-3.0 Imports: 28 Imported by: 0

Documentation

Overview

AGPL v3 License Copyright (c) 2026 Project Backplane

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

AGPL v3 License Copyright (c) 2026 Project Backplane

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

AGPL v3 License Copyright (c) 2026 Project Backplane

Index

Constants

This section is empty.

Variables

View Source
var ReloadSignal = syscall.SIGHUP

Functions

func WithAutoRotation

func WithAutoRotation(filename string) io.Writer

WithAutoRotation returns a thread-safe io.Writer that rotates files automatically. It uses sensible defaults: 10MB max size, 3 backups, 28 days max age.

func WithRange added in v2.0.1

func WithRange(min, max int) element.Validator

WithRange checks if an integer value is within [min, max].

Types

type Backplane

type Backplane struct {
	Options Options
	// contains filtered or unexported fields
}

Backplane is the main instance of the admin server

func New

func New(opts Options) *Backplane

New creates a new Backplane instance.

func (*Backplane) Expose

func (b *Backplane) Expose(label string, ptr interface{}, validators ...elm.Validator) error

Expose registers an atomic variable to be editable/viewable in the admin panel. This delegates to the internal bridge. Expose registers an atomic variable to be editable/viewable in the admin panel. Returns an error if the type is not supported.

func (*Backplane) Log

func (b *Backplane) Log(format string, args ...interface{})

Log adds a message to the internal ring buffer and external structured log.

func (*Backplane) MustExpose added in v2.0.1

func (b *Backplane) MustExpose(label string, ptr interface{}, validators ...elm.Validator)

MustExpose registers a variable and panics on error. Recommended for package init().

func (*Backplane) Start

func (b *Backplane) Start() (func(), error)

Start launches the SSH server. It returns a stop function and any startup error.

type Options

type Options struct {
	// Port to listen on. Default: 2222
	Port int
	// Host to bind to. Default: "127.0.0.1" (Safety Default)
	Host string
	// Path to host key. Default: ".ssh/term_info_ed25519"
	HostKeyPath string
	// Path to authorized_keys. Default: "~/.ssh/authorized_keys"
	AuthorizedKeysPath string
	// Destination for Audit Logs. Default: os.Stdout
	AuditOutput io.Writer
	// Destination for Structured Logs (JSON). Default: os.Stderr
	// Destination for Structured Logs (JSON). Default: os.Stderr
	LogOutput io.Writer

	// MaxConnections limits the total number of raw TCP connections.
	// Default: 50.
	MaxConnections int

	// Session limits preventing resource exhaustion.
	MaxSessionsPerIP   int // Default: 5
	MaxSessionsPerUser int // Default: 3
	MaxSessionsGlobal  int // Default: 20

	// RateLimitAdmin defines the throughput for admin users.
	// Default: 100 req/s, burst 20.
	RateLimitAdmin rate.Limit
	RateBurstAdmin int

	// RateLimitViewer defines the throughput for viewers.
	// Default: 10 req/s, burst 5.
	RateLimitViewer rate.Limit
	RateBurstViewer int
}

Options defines configuration for the Backplane server.

func DefaultOptions

func DefaultOptions() Options

DefaultOptions returns safe defaults.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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