trust

package
v0.0.0-...-3659ccf Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Location

type Location struct {
	Name    string         `yaml:"name"`
	Address types.AddrPort `yaml:"address"`
}

Location represents configurable identifying information about a remote.

type Remote

type Remote struct {
	Location    `yaml:",inline"`
	Certificate types.X509Certificate `yaml:"certificate"`
}

Remote represents a yaml file with credentials to be read by the daemon.

func (*Remote) URL

func (r *Remote) URL() api.URL

URL returns the parsed URL of the Remote.

type Remotes

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

Remotes is a convenient alias as we will often deal with groups of yaml files.

func (*Remotes) Add

func (r *Remotes) Add(dir string, remotes ...Remote) error

Add adds a new local cluster member record for the remotes.

func (*Remotes) Addresses

func (r *Remotes) Addresses() map[string]types.AddrPort

Addresses returns just the host:port addresses of the remotes.

func (*Remotes) Certificates

func (r *Remotes) Certificates() map[string]types.X509Certificate

Certificates returns a map of remotes certificates by fingerprint.

func (*Remotes) CertificatesNative

func (r *Remotes) CertificatesNative() map[string]x509.Certificate

CertificatesNative returns the Certificates map with values as native x509.Certificate type.

func (*Remotes) Cluster

func (r *Remotes) Cluster(isNotification bool, serverCert *shared.CertInfo, publicKey *x509.Certificate) (client.Cluster, error)

Cluster returns a set of clients for every remote, which can be concurrently queried.

func (*Remotes) Count

func (r *Remotes) Count() int

func (*Remotes) Load

func (r *Remotes) Load(dir string) error

Load reads any yaml files in the given directory and parses them into a set of Remotes.

func (*Remotes) RemoteByAddress

func (r *Remotes) RemoteByAddress(addrPort types.AddrPort) *Remote

RemoteByAddress returns a Remote matching the given host address (or nil if none are found).

func (*Remotes) RemoteByCertificateFingerprint

func (r *Remotes) RemoteByCertificateFingerprint(fingerprint string) *Remote

RemoteByCertificateFingerprint returns a remote whose certificate fingerprint matches the provided fingerprint.

func (*Remotes) RemotesByName

func (r *Remotes) RemotesByName() map[string]Remote

RemotesByName returns a copy of the list of peers, keyed by each system's name.

func (*Remotes) Replace

func (r *Remotes) Replace(dir string, newRemotes ...internalTypes.ClusterMember) error

Replace replaces the in-memory and locally stored remotes with the given list from the database.

func (*Remotes) SelectRandom

func (r *Remotes) SelectRandom() *Remote

SelectRandom returns a random remote.

type Store

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

Store represents a directory of remotes watched by the fsnotify Watcher.

func Init

func Init(watcher *sys.Watcher, onUpdate func(oldRemotes, newRemotes Remotes) error, dir string) (*Store, error)

Init initializes the remotes in the truststore, seeds the rand package for selecting remotes at random, and watches the truststore directory for updates.

func (*Store) Refresh

func (ts *Store) Refresh() error

Refresh reloads the truststore and runs any associated hooks.

func (*Store) Remotes

func (ts *Store) Remotes() *Remotes

Remotes returns a thread-safe list of the remotes in the truststore, as watched by fsnotify.

Jump to

Keyboard shortcuts

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