sshd

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const DisconnectExitCode = 255

DisconnectExitCode is the exit status reported to the connecting client when a PTY client is force-detached (keepalive timeout, lost connection, or slow consumer) rather than the shell exiting. A non-zero status makes the client's session.Wait return an error so it treats the result as a dropped connection — not a clean shell exit — and therefore does not prompt to shut down the sandbox. It is unambiguous: a genuine shell exit always reports 0, so the client can match this code to recognize a disconnect. 255 follows the SSH convention for connection-level errors.

Variables

This section is empty.

Functions

func ShellEscape

func ShellEscape(s string) string

ShellEscape quotes a string for safe transmission over SSH wire protocol.

Types

type Config

type Config struct {
	HostKeyPEM    []byte
	AuthorizedKey []byte
	Sessions      *session.Manager
}

Config holds configuration for the SSH server.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server wraps a charmbracelet/ssh server with public key authentication.

func NewServer

func NewServer(cfg Config) (*Server, error)

NewServer creates a new SSH server that authenticates using the given authorized key and presents the given host key.

func (*Server) Close

func (s *Server) Close() error

Close immediately closes all active listeners and connections.

func (*Server) Serve

func (s *Server) Serve(l net.Listener) error

Serve accepts incoming connections on the listener.

type SessionCountReply

type SessionCountReply struct {
	PTYConns     uint32
	AttachedPTY  uint32
	DetachedPTY  uint32
	ExecCount    uint32
	DetachedInfo string
}

SessionCountReply is the wire format for the session-count@vibepit reply. Fields are exported for ssh.Marshal/Unmarshal.

Jump to

Keyboard shortcuts

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