Documentation
¶
Overview ¶
Package peers owns an explicit coordinator's peer inventory.
Index ¶
- func DefaultPath() (string, error)
- type Peer
- type Store
- func (s *Store) Add(peer Peer) error
- func (s *Store) Find(raw string) (Peer, bool, error)
- func (s *Store) FindBySSHDestination(destination string) (Peer, bool, error)
- func (s *Store) List() ([]Peer, error)
- func (s *Store) Remove(raw string) error
- func (s *Store) Update(peer Peer) error
- func (s *Store) UpsertBySSHDestination(peer Peer) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultPath ¶
Types ¶
type Peer ¶
type Peer struct {
URL string `json:"url"`
Name string `json:"name,omitempty"`
ID string `json:"id,omitempty"`
Accent string `json:"accent,omitempty"`
Glyph string `json:"glyph,omitempty"`
// Verifier is this peer's own PBKDF2 access-password verifier,
// captured once when it was enrolled with a password (see
// handlePeerAdd), never the plaintext. It authenticates this server
// to that peer on every proxied request going forward — a peer with
// a password is just another client who knows it, and this is how
// this server proves it does too, without asking again each time.
Verifier string `json:"verifier,omitempty"`
// SSHDestination, when set, means this PC is reached by running eta on
// it over SSH rather than by talking to one already listening. It is
// what the user typed and what ssh resolves, and it is this peer's
// durable identity: URL holds an ephemeral forwarded loopback port
// that changes on every reconnect, so it cannot be the key. Empty for
// an ordinary peer, and absent from older inventories.
SSHDestination string `json:"ssh_destination,omitempty"`
}
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) FindBySSHDestination ¶
FindBySSHDestination looks a peer up by the identity that survives reconnects, rather than by its current URL.
func (*Store) Update ¶
Update replaces an existing peer's details, keyed by URL. Identity is not immutable: a PC can be renamed or have its colour changed, and the inventory holds a copy taken at enrolment that would otherwise stay wrong forever.
func (*Store) UpsertBySSHDestination ¶
UpsertBySSHDestination records an SSH-backed peer, matching on its destination so a reconnect updates the existing entry's URL in place instead of adding a second one. Keying on URL cannot do this: the forwarded port differs every session, so each reconnect would append a new entry and strand the old one pointing at a closed port — or worse, at a port now serving a different tunnel.