Documentation
¶
Index ¶
- Constants
- Variables
- func UseLogger(logger btclog.Logger)
- type Autopilot
- type Client
- func (c *Client) ActivateSession(ctx context.Context, pubKey *btcec.PublicKey) (bool, error)
- func (c *Client) ListFeaturePerms(_ context.Context) (map[string]map[string]bool, error)
- func (c *Client) ListFeatures(ctx context.Context) (map[string]*Feature, error)
- func (c *Client) RegisterSession(ctx context.Context, pubKey *btcec.PublicKey, mailboxAddr string, ...) (*btcec.PublicKey, error)
- func (c *Client) SessionRevoked(ctx context.Context, pubKey *btcec.PublicKey)
- func (c *Client) Start(ctx context.Context, opts ...func(cfg *Config)) error
- func (c *Client) Stop()
- type Config
- type Feature
- type RuleValues
- type Version
Constants ¶
const Subsystem = "AUTO"
Variables ¶
var ErrVersionIncompatible = fmt.Errorf("litd version is not compatible " +
"with the minimum version required by the autopilot server")
ErrVersionIncompatible is returned when the minimum Lit version required by the autopilot server exceeds the version of this binary.
Functions ¶
Types ¶
type Autopilot ¶
type Autopilot interface { // ListFeatures fetches the set of features offered by the autopilot // server along with all the rules and permissions required for those // features. ListFeatures(ctx context.Context) (map[string]*Feature, error) // ListFeaturePerms returns a map of feature names to a map of // permissions required for each feature. This call uses an in-memory // store that is updated periodically and so this should be used instead // of the ListFeatures call if only the permissions are required to // avoid doing multiple calls to the autopilot server. The ListFeatures // call can however be used to force the update of the in-memory list. ListFeaturePerms(ctx context.Context) (map[string]map[string]bool, error) // RegisterSession attempts to register a session with the autopilot // server. If the registration is successful, then the Client will also // track the session so that it can continuously ensure that the session // remains active. RegisterSession(ctx context.Context, pubKey *btcec.PublicKey, mailboxAddr string, devServer bool, featureConf map[string][]byte, linkedGroupKey *btcec.PublicKey, linkSig []byte, privacyFlags uint64) (*btcec.PublicKey, error) // ActivateSession attempts to inform the autopilot server that the // given session is still active. After this is called, the autopilot // client will periodically ensure that the session remains active. // The boolean returned is true if the error received was permanent // meaning that the session should be revoked and recreated. ActivateSession(ctx context.Context, pubKey *btcec.PublicKey) (bool, error) // SessionRevoked should be called when a session is no longer active // so that the client can forget the session. SessionRevoked(ctx context.Context, key *btcec.PublicKey) // Start kicks off the goroutines of the client. Start(ctx context.Context, opts ...func(cfg *Config)) error // Stop cleans up any resources held by the client. Stop() }
Autopilot represents the functionality exposed by an autopilot server.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a client connection to the autopilot server.
func (*Client) ActivateSession ¶
ActivateSession attempts to inform the autopilot server that the given session is still active. It also adds the session to the list tracked by the client so that the Client can ensure that the session remains active on the autopilot side.
Note: this is part of the Autopilot interface.
func (*Client) ListFeaturePerms ¶
ListFeaturePerms returns contents of the in-memory feature permissions list if it has been populated.
func (*Client) ListFeatures ¶
ListFeatures queries the autopilot server for all the features it has available.
Note: this is part of the Autopilot interface.
func (*Client) RegisterSession ¶
func (c *Client) RegisterSession(ctx context.Context, pubKey *btcec.PublicKey, mailboxAddr string, devServer bool, featureConf map[string][]byte, groupKey *btcec.PublicKey, linkSig []byte, privacyFlags uint64) (*btcec.PublicKey, error)
RegisterSession attempts to register a session with the autopilot server. If the registration is successful, then the Client will also track the session so that it can continuously ensure that the session remains active.
Note: this is part of the Autopilot interface.
func (*Client) SessionRevoked ¶
SessionRevoked removes a session from the list of active sessions managed by the client.
Note: this is part of the Autopilot interface.
type Config ¶
type Config struct { // Disable will disable the autopilot client. Disable bool `long:"disable" description:"disable the autopilot client"` // Address is the domain:port of the autopilot server. Address string `long:"address" description:"autopilot server address host:port"` // Proxy is the SOCKS proxy that should be used to establish the // connection. Proxy string `` /* 136-byte string literal not displayed */ // Insecure signals that no TLS should be used if set to true. Insecure bool `long:"insecure" description:"disable tls"` // TLSPath is the path to a local file that holds the autopilot // server's TLS certificate. This is only needed if the server is using // a self-signed cert. TLSPath string `long:"tlspath" description:"Path to autopilot server tls certificate"` // PingCadence determines how often the Autopilot client should // re-register an existing session with the Autopilot server to ensure // that the Autopilot server knows that the session is active. PingCadence time.Duration `long:"pingcadence" description:"How often the client should ensure that registered Autopilot sessions are active"` // DialOpts is a list of additional options that should be used when // dialing the gRPC connection. DialOpts []grpc.DialOption // LitVersion is the version of the Lit binary. LitVersion Version // LndVersion is the version of the connected LND binary. LndVersion Version }
Config holds the configuration options for the autopilot server client.
type Feature ¶
type Feature struct { // Name is the name of the feature. Name string // Description is a human-readable description of what the feature // offers Description string // Permissions is a list of RPC methods and access writes a feature // will need. Permissions map[string][]bakery.Op // Rules is a list of all the firewall that must be specified for this // feature. Rules map[string]*RuleValues // DefaultConfig is a JSON-serialized configuration of the feature. It // represents the default configuration we can use if the user doesn't // specify any. DefaultConfig []byte // PrivacyFlags is a list of privacy flags that the feature requires. PrivacyFlags uint64 }
Feature holds all the info necessary to subscribe to a feature offered by the autopilot server.
type RuleValues ¶
RuleValues holds the default value along with the sane max and min values that the autopilot server indicates makes sense for feature that the rule is being applied to. The values can be unmarshalled in a higher layer if the name of the rule is known to LiT.