connection

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package connection owns the active session and drives an engine.Engine

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
}

func New

func New(dir string, st store.Disk, newEngine engine.New, probe engine.Probe, logger *log.Logger) *Service

func (*Service) ActiveID

func (s *Service) ActiveID() (string, error)

ActiveID returns the connected node id, or the last one used, or "" if none.

func (*Service) Connect

func (s *Service) Connect(id string) (Status, error)

func (*Service) Disconnect

func (s *Service) Disconnect() (Status, error)

func (*Service) ForgetIfRemoved

func (s *Service) ForgetIfRemoved(subID string, nodes []domain.Node)

ForgetIfRemoved drops the active node when its subscription is deleted.

func (*Service) Nodes

func (s *Service) Nodes() ([]rpc.Node, error)

func (*Service) Probe

func (s *Service) Probe(sub, id string) ([]rpc.Node, error)

Probe pings one node if id is set, else every node in sub, else all of them.

func (*Service) RefreshEvery

func (s *Service) RefreshEvery() int

RefreshEvery is the subscription refresh interval in hours, 0 when off.

func (*Service) Restore

func (s *Service) Restore()

func (*Service) SetSettings

func (s *Service) SetSettings(in domain.Settings) (Status, error)

func (*Service) SetTun

func (s *Service) SetTun(enable bool) (Status, error)

func (*Service) Settings

func (s *Service) Settings() domain.Settings

func (*Service) Shutdown

func (s *Service) Shutdown()

Shutdown tears the active engine down without broadcasting, for process exit.

func (*Service) Status

func (s *Service) Status() Status

func (*Service) Watch

func (s *Service) Watch() (initial Status, ch <-chan Status, cancel func())

Watch registers a status subscriber

type Status

type Status = rpc.Status

Jump to

Keyboard shortcuts

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