From 0206ecb03104316b1e1bf6cf3a4dbe61126065d2 Mon Sep 17 00:00:00 2001 From: Elle Mouton Date: Wed, 30 Jun 2021 10:40:41 +0200 Subject: [PATCH] multi: add disable authenticator option To make it easier to use aperture in a setup where we only need its proxy functionality but not its LSAT capabilities, we add the option to disable the authenticator. This makes it possible to run aperture without needing to connect it to an lnd node. --- aperture.go | 25 +++++++++++++++---------- config.go | 2 ++ 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/aperture.go b/aperture.go index a5e09b3..6eebe91 100644 --- a/aperture.go +++ b/aperture.go @@ -161,15 +161,18 @@ func (a *Aperture) Start(errChan chan error) error { Value: price, }, nil } - a.challenger, err = NewLndChallenger( - a.cfg.Authenticator, genInvoiceReq, errChan, - ) - if err != nil { - return err - } - err = a.challenger.Start() - if err != nil { - return err + + if !a.cfg.Authenticator.Disable { + a.challenger, err = NewLndChallenger( + a.cfg.Authenticator, genInvoiceReq, errChan, + ) + if err != nil { + return err + } + err = a.challenger.Start() + if err != nil { + return err + } } // Create the proxy and connect it to lnd. @@ -267,7 +270,9 @@ func (a *Aperture) UpdateServices(services []*proxy.Service) error { func (a *Aperture) Stop() error { var returnErr error - a.challenger.Stop() + if a.challenger != nil { + a.challenger.Stop() + } // Shut down our client and server connections now. This should cause // the first goroutine to quit. diff --git a/config.go b/config.go index 84f891c..42a51f6 100644 --- a/config.go +++ b/config.go @@ -31,6 +31,8 @@ type AuthConfig struct { MacDir string `long:"macdir"` Network string `long:"network"` + + Disable bool `long:"disable"` } type TorConfig struct {