Documentation ¶
Index ¶
- Constants
- Variables
- func UseLogger(logger btclog.Logger)
- type ClientState
- type Feature
- type RuleRanges
- type Server
- func (m *Server) ActivateSession(_ context.Context, req *autopilotserverrpc.ActivateSessionRequest) (*autopilotserverrpc.ActivateSessionResponse, error)
- func (m *Server) GetClientState(remoteKey *btcec.PublicKey) (ClientState, error)
- func (m *Server) GetPort() int
- func (m *Server) GetPrivKey(remoteKey *btcec.PublicKey) (*btcec.PrivateKey, error)
- func (m *Server) ListFeatures(_ context.Context, _ *autopilotserverrpc.ListFeaturesRequest) (*autopilotserverrpc.ListFeaturesResponse, error)
- func (m *Server) RegisterSession(_ context.Context, req *autopilotserverrpc.RegisterSessionRequest) (*autopilotserverrpc.RegisterSessionResponse, error)
- func (m *Server) ResetDefaultFeatures()
- func (m *Server) RevokeSession(_ context.Context, req *autopilotserverrpc.RevokeSessionRequest) (*autopilotserverrpc.RevokeSessionResponse, error)
- func (m *Server) SetClientState(remoteKey *btcec.PublicKey, s ClientState) error
- func (m *Server) SetFeatures(f map[string]*Feature)
- func (m *Server) Start() error
- func (m *Server) Stop()
- func (m *Server) Terms(context.Context, *autopilotserverrpc.TermsRequest) (*autopilotserverrpc.TermsResponse, error)
Constants ¶
const ( ClientStateActive = iota ClientStateInactive ClientStateRevoked )
const Subsystem = "AUTO"
Variables ¶
var RateLimitRule = &RuleRanges{ Default: &rules.RateLimit{ WriteLimit: &rules.Rate{ Iterations: 1, NumHours: 1, }, ReadLimit: &rules.Rate{ Iterations: 10, NumHours: 1, }, }, MinVal: &rules.RateLimit{ WriteLimit: &rules.Rate{ Iterations: 0, NumHours: 1, }, ReadLimit: &rules.Rate{ Iterations: 1, NumHours: 1, }, }, MaxVal: &rules.RateLimit{ WriteLimit: &rules.Rate{ Iterations: 10, NumHours: 1, }, ReadLimit: &rules.Rate{ Iterations: 1000, NumHours: 1, }, }, }
Functions ¶
Types ¶
type ClientState ¶
type ClientState uint8
type Feature ¶
type Feature struct { Description string Rules map[string]*RuleRanges Permissions map[string][]bakery.Op }
Feature is a feature that the autopilot server could return.
type RuleRanges ¶
type Server ¶
type Server struct { autopilotserverrpc.AutopilotServer // contains filtered or unexported fields }
Server implements the autopilotserverrpc.AutopilotServer interface and is used to mock the autopilot server in tests.
func (*Server) ActivateSession ¶
func (m *Server) ActivateSession(_ context.Context, req *autopilotserverrpc.ActivateSessionRequest) ( *autopilotserverrpc.ActivateSessionResponse, error)
func (*Server) GetClientState ¶
func (m *Server) GetClientState(remoteKey *btcec.PublicKey) ( ClientState, error)
func (*Server) GetPort ¶
GetPort returns the port number that the mock server is serving its grpc server on.
func (*Server) GetPrivKey ¶
GetPrivKey can be used to extract the private key that the autopilot created for the given litd static key.
func (*Server) ListFeatures ¶
func (m *Server) ListFeatures(_ context.Context, _ *autopilotserverrpc.ListFeaturesRequest) ( *autopilotserverrpc.ListFeaturesResponse, error)
ListFeatures converts the mockFeatures into the form that the autopilot server would.
Note: this is part of the autopilotrpc.AutopilotServer interface.
func (*Server) RegisterSession ¶
func (m *Server) RegisterSession(_ context.Context, req *autopilotserverrpc.RegisterSessionRequest) ( *autopilotserverrpc.RegisterSessionResponse, error)
RegisterSession will create a new priv key for the autopilot server and return the corresponding public key.
Note: this is part of the autopilotrpc.AutopilotServer interface.
func (*Server) ResetDefaultFeatures ¶
func (m *Server) ResetDefaultFeatures()
ResetDefaultFeatures resets the servers features set to the default set.
func (*Server) RevokeSession ¶
func (m *Server) RevokeSession(_ context.Context, req *autopilotserverrpc.RevokeSessionRequest) ( *autopilotserverrpc.RevokeSessionResponse, error)
RevokeSession revokes a single session and also stops it if it is currently active.
Note: this is part of the autopilotrpc.AutopilotServer interface.
func (*Server) SetClientState ¶
func (m *Server) SetClientState(remoteKey *btcec.PublicKey, s ClientState) error
func (*Server) SetFeatures ¶
SetFeatures can be used to override the feature set served by the mock autopilot server.
func (*Server) Terms ¶
func (m *Server) Terms(context.Context, *autopilotserverrpc.TermsRequest) ( *autopilotserverrpc.TermsResponse, error)
Terms returns any meta data from the autopilot server.
Note: this is part of the autopilotrpc.AutopilotServer interface.