servers

package
v0.95.0-rc.3 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: 28 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 servers keeps the remote machines lich runs projects on and the connection to each. A connection is the system's own ssh, so ~/.ssh/config, the agent and ProxyJump work as they do in a terminal: one ssh per server stays up as the master of the connection, the remote commands and the port forward ride it, and a question ssh asks (a host key, a password) is put to the window through `lich ssh-askpass`. Over it the backend makes sure the server runs this same lich version, installing it when it does not, starts it without a window and forwards a loopback port here to it. The window then talks to that lich as it talks to this one.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

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

Service is the saved servers and the connection to each.

func New

func New(store Store, version string, backend func() (int, string), emit func(name string, data any)) *Service

New returns the servers of store, none connected. backend reports this lich's loopback coordinates once it listens.

func (*Service) Answer

func (s *Service) Answer(_ context.Context, opts api.AnswerServerOptions) (api.None, error)

Answer answers a question ssh asked.

func (*Service) Ask

Ask puts a question ssh asks to the window and waits for the answer; see ask.

func (*Service) Connect

Connect brings a server's connection up; see connect.

func (*Service) Delete

func (s *Service) Delete(_ context.Context, opts api.ServerIDOptions) (api.None, error)

Delete forgets a server, disconnecting it first; lich on it keeps running.

func (*Service) Disconnect

func (s *Service) Disconnect(_ context.Context, opts api.ServerIDOptions) (api.None, error)

Disconnect ends a server's connection and leaves lich running there. lich starting again leaves it disconnected.

func (*Service) List

func (s *Service) List(_ context.Context, _ api.None) ([]api.Server, error)

List is every server with its connection, in the order they were added.

func (*Service) Reconnect

func (s *Service) Reconnect()

Reconnect connects, in the background, every server left connected when lich last closed. Where each stands comes on the servers event.

func (*Service) SSHHosts

func (s *Service) SSHHosts(_ context.Context, _ api.None) ([]api.SSHHost, error)

SSHHosts is the Host entries of ~/.ssh/config; see sshHosts.

func (*Service) Save

Save writes a server, a new one when opts.ID is empty. A connection already up keeps the destination it was dialed with until it is connected again.

func (*Service) Shutdown

func (s *Service) Shutdown()

Shutdown ends every connection; lich on the servers keeps running.

func (*Service) Stop

func (s *Service) Stop(_ context.Context, opts api.ServerIDOptions) (api.None, error)

Stop quits lich on a server, and every session it runs; see stop. lich starting again leaves it disconnected.

func (*Service) Update

Update replaces the lich of another version running on a server, ending its sessions, and connects; see update.

type Store

type Store interface {
	Servers() ([]api.ServerConfig, error)
	SaveServer(c api.ServerConfig) error
	DeleteServer(id string) error
	ServerConnected(id string, seen api.ServerSeen) error
	ServerLeft(id string) error
}

Store is where servers are saved.

Jump to

Keyboard shortcuts

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