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 ¶
- type Service
- func (s *Service) Answer(_ context.Context, opts api.AnswerServerOptions) (api.None, error)
- func (s *Service) Ask(ctx context.Context, opts api.ServerAskOptions) (api.ServerAnswer, error)
- func (s *Service) Connect(_ context.Context, opts api.ServerIDOptions) (api.ServerConnection, error)
- func (s *Service) Delete(_ context.Context, opts api.ServerIDOptions) (api.None, error)
- func (s *Service) Disconnect(_ context.Context, opts api.ServerIDOptions) (api.None, error)
- func (s *Service) List(_ context.Context, _ api.None) ([]api.Server, error)
- func (s *Service) Reconnect()
- func (s *Service) SSHHosts(_ context.Context, _ api.None) ([]api.SSHHost, error)
- func (s *Service) Save(_ context.Context, opts api.SaveServerOptions) (api.Server, error)
- func (s *Service) Shutdown()
- func (s *Service) Stop(_ context.Context, opts api.ServerIDOptions) (api.None, error)
- func (s *Service) Update(_ context.Context, opts api.ServerIDOptions) (api.ServerConnection, error)
- type Store
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) Ask ¶
func (s *Service) Ask(ctx context.Context, opts api.ServerAskOptions) (api.ServerAnswer, error)
Ask puts a question ssh asks to the window and waits for the answer; see ask.
func (*Service) Connect ¶
func (s *Service) Connect(_ context.Context, opts api.ServerIDOptions) (api.ServerConnection, error)
Connect brings a server's connection up; see connect.
func (*Service) Disconnect ¶
Disconnect ends a server's connection and leaves lich running there. lich starting again leaves it disconnected.
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) 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 ¶
Stop quits lich on a server, and every session it runs; see stop. lich starting again leaves it disconnected.
func (*Service) Update ¶
func (s *Service) Update(_ context.Context, opts api.ServerIDOptions) (api.ServerConnection, error)
Update replaces the lich of another version running on a server, ending its sessions, and connects; see update.