Documentation
¶
Index ¶
Constants ¶
const ( // DefaultMsgRate is the default message rate for a given mailbox that // we'll allow. We'll allow one message every 500 milliseconds, or 2 // messages per second. DefaultMsgRate = time.Millisecond * 500 // DefaultMsgBurstAllowance is the default burst rate that we'll allow // for messages. If a new message is about to exceed the burst rate, // then we'll allow it up to this burst allowance. DefaultMsgBurstAllowance = 10 // DefaultBufSize is the default number of bytes that are read in a // single operation. DefaultBufSize = 4096 )
const Subsystem = "APER"
Variables ¶
This section is empty.
Functions ¶
func SetupLoggers ¶
func SetupLoggers(root *build.RotatingLogWriter, intercept signal.Interceptor)
SetupLoggers initializes all package-global logger variables.
Types ¶
type Aperture ¶
type Aperture struct {
// contains filtered or unexported fields
}
Aperture is the main type of the aperture service. It holds all components that are required for the authenticating reverse proxy to do its job.
func NewAperture ¶
NewAperture creates a new instance of the Aperture service.
func (*Aperture) UpdateServices ¶
UpdateServices instructs the proxy to re-initialize its internal configuration of backend services. This can be used to add or remove backends at run time or enable/disable authentication on the fly.
type AuthConfig ¶
type AuthConfig struct { // LndHost is the hostname of the LND instance to connect to. LndHost string `long:"lndhost" description:"Hostname of the LND instance to connect to"` TLSPath string `long:"tlspath" description:"Path to LND instance's tls certificate"` MacDir string `long:"macdir" description:"Directory containing LND instance's macaroons"` Network string `` /* 128-byte string literal not displayed */ Disable bool `long:"disable" description:"Whether to disable LND auth."` }
type Config ¶
type Config struct { // ListenAddr is the listening address that we should use to allow Aperture // to listen for requests. ListenAddr string `long:"listenaddr" description:"The interface we should listen on for client requests."` // ServerName can be set to a fully qualifying domain name that should // be used while creating a certificate through Let's Encrypt. ServerName string `long:"servername" description:"Server name (FQDN) to use for the TLS certificate."` // AutoCert can be set to true if aperture should try to create a valid // certificate through Let's Encrypt using ServerName. AutoCert bool `long:"autocert" description:"Automatically create a Let's Encrypt cert using ServerName."` // Insecure can be set to disable TLS on incoming connections. Insecure bool `long:"insecure" description:"Listen on an insecure connection, disabling TLS for incoming connections."` // StaticRoot is the folder where the static content served by the proxy // is located. StaticRoot string `long:"staticroot" description:"The folder where the static content is located."` // ServeStatic defines if static content should be served from the // directory defined by StaticRoot. ServeStatic bool `long:"servestatic" description:"Flag to enable or disable static content serving."` Etcd *EtcdConfig `group:"etcd" namespace:"etcd"` Authenticator *AuthConfig `group:"authenticator" namespace:"authenticator"` Tor *TorConfig `group:"tor" namespace:"tor"` // Services is a list of JSON objects in string format, which specify // each backend service to Aperture. Services []*proxy.Service `long:"service" description:"Configurations for each Aperture backend service."` // HashMail is the configuration section for configuring the Lightning // Node Connect mailbox server. HashMail *HashMailConfig `long:"hashmail" description:"Configuration for the Lightning Node Connect mailbox server."` // DebugLevel is a string defining the log level for the service either // for all subsystems the same or individual level by subsystem. DebugLevel string `long:"debuglevel" description:"Debug level for the Aperture application and its subsystems."` // ConfigFile points aperture to an alternative config file. ConfigFile string `long:"configfile" description:"Custom path to a config file."` // BaseDir is a custom directory to store all aperture flies. BaseDir string `long:"basedir" description:"Directory to place all of aperture's files in."` }
type EtcdConfig ¶
type HashMailConfig ¶
type HashMailConfig struct { Enabled bool `long:"enabled"` MessageRate time.Duration `long:"messagerate" description:"The average minimum time that should pass between each message."` MessageBurstAllowance int `long:"messageburstallowance" description:"The burst rate we allow for messages."` // PromListenAddr is the listening address that we should use to allow // the main Prometheus server to scrape our metrics. PromListenAddr string `long:"promlistenaddr" description:"the interface we should listen on for prometheus"` }
type InvoiceClient ¶
type InvoiceClient interface { // ListInvoices returns a paginated list of all invoices known to lnd. ListInvoices(ctx context.Context, in *lnrpc.ListInvoiceRequest, opts ...grpc.CallOption) (*lnrpc.ListInvoiceResponse, error) // SubscribeInvoices subscribes to updates on invoices. SubscribeInvoices(ctx context.Context, in *lnrpc.InvoiceSubscription, opts ...grpc.CallOption) ( lnrpc.Lightning_SubscribeInvoicesClient, error) // AddInvoice adds a new invoice to lnd. AddInvoice(ctx context.Context, in *lnrpc.Invoice, opts ...grpc.CallOption) (*lnrpc.AddInvoiceResponse, error) }
InvoiceClient is an interface that only implements part of a full lnd client, namely the part around the invoices we need for the challenger to work.
type InvoiceRequestGenerator ¶
InvoiceRequestGenerator is a function type that returns a new request for the lnrpc.AddInvoice call.
type LndChallenger ¶
type LndChallenger struct {
// contains filtered or unexported fields
}
LndChallenger is a challenger that uses an lnd backend to create new LSAT payment challenges.
func NewLndChallenger ¶
func NewLndChallenger(cfg *AuthConfig, genInvoiceReq InvoiceRequestGenerator, errChan chan<- error) (*LndChallenger, error)
NewLndChallenger creates a new challenger that uses the given connection details to connect to an lnd backend to create payment challenges.
func (*LndChallenger) NewChallenge ¶
NewChallenge creates a new LSAT payment challenge, returning a payment request (invoice) and the corresponding payment hash.
NOTE: This is part of the mint.Challenger interface.
func (*LndChallenger) Start ¶
func (l *LndChallenger) Start() error
Start starts the challenger's main work which is to keep track of all invoices and their states. For that the backing lnd node is queried for all invoices on startup and the a subscription to all subsequent invoice updates is created.
func (*LndChallenger) VerifyInvoiceStatus ¶
func (l *LndChallenger) VerifyInvoiceStatus(hash lntypes.Hash, state lnrpc.Invoice_InvoiceState, timeout time.Duration) error
VerifyInvoiceStatus checks that an invoice identified by a payment hash has the desired status. To make sure we don't fail while the invoice update is still on its way, we try several times until either the desired status is set or the given timeout is reached.
NOTE: This is part of the auth.InvoiceChecker interface.
type TorConfig ¶
type TorConfig struct { Control string `long:"control" description:"The host:port of the Tor instance."` ListenPort uint16 `` /* 226-byte string literal not displayed */ VirtualPort uint16 `long:"virtualport" description:"The port through which the onion services created can be reached at."` V2 bool `long:"v2" description:"Whether we should listen for client requests through a v2 onion service."` V3 bool `long:"v3" description:"Whether we should listen for client requests through a v3 onion service."` }