Merge pull request #432 from carlaKC/export-listnerconfig

loopd: export NewListenerConfig
pull/438/head
Carla Kirk-Cohen 3 years ago committed by GitHub
commit 04b4f0a389
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -34,8 +34,8 @@ var (
errOnlyStartOnce = fmt.Errorf("daemon can only be started once") errOnlyStartOnce = fmt.Errorf("daemon can only be started once")
) )
// listenerCfg holds closures used to retrieve listeners for the gRPC services. // ListenerCfg holds closures used to retrieve listeners for the gRPC services.
type listenerCfg struct { type ListenerCfg struct {
// grpcListener returns a TLS listener to use for the gRPC server, based // grpcListener returns a TLS listener to use for the gRPC server, based
// on the passed TLS configuration. // on the passed TLS configuration.
grpcListener func(*tls.Config) (net.Listener, error) grpcListener func(*tls.Config) (net.Listener, error)
@ -66,7 +66,7 @@ type Daemon struct {
ErrChan chan error ErrChan chan error
cfg *Config cfg *Config
listenerCfg *listenerCfg listenerCfg *ListenerCfg
internalErrChan chan error internalErrChan chan error
lnd *lndclient.GrpcLndServices lnd *lndclient.GrpcLndServices
@ -90,7 +90,7 @@ type Daemon struct {
} }
// New creates a new instance of the loop client daemon. // New creates a new instance of the loop client daemon.
func New(config *Config, lisCfg *listenerCfg) *Daemon { func New(config *Config, lisCfg *ListenerCfg) *Daemon {
return &Daemon{ return &Daemon{
// We send exactly one error on this channel if something goes // We send exactly one error on this channel if something goes
// wrong at runtime. Or a nil value if the shutdown was // wrong at runtime. Or a nil value if the shutdown was

@ -48,10 +48,10 @@ type RPCConfig struct {
LndConn net.Conn LndConn net.Conn
} }
// newListenerCfg creates and returns a new listenerCfg from the passed config // NewListenerConfig creates and returns a new listenerCfg from the passed
// and RPCConfig. // config and RPCConfig.
func newListenerCfg(config *Config, rpcCfg RPCConfig) *listenerCfg { func NewListenerConfig(config *Config, rpcCfg RPCConfig) *ListenerCfg {
return &listenerCfg{ return &ListenerCfg{
grpcListener: func(tlsCfg *tls.Config) (net.Listener, error) { grpcListener: func(tlsCfg *tls.Config) (net.Listener, error) {
// If a custom RPC listener is set, we will listen on // If a custom RPC listener is set, we will listen on
// it instead of the regular tcp socket. // it instead of the regular tcp socket.
@ -218,7 +218,7 @@ func Run(rpcCfg RPCConfig) error {
// Print the version before executing either primary directive. // Print the version before executing either primary directive.
log.Infof("Version: %v", loop.Version()) log.Infof("Version: %v", loop.Version())
lisCfg := newListenerCfg(&config, rpcCfg) lisCfg := NewListenerConfig(&config, rpcCfg)
// Execute command. // Execute command.
if parser.Active == nil { if parser.Active == nil {

@ -11,7 +11,7 @@ import (
) )
// view prints all swaps currently in the database. // view prints all swaps currently in the database.
func view(config *Config, lisCfg *listenerCfg) error { func view(config *Config, lisCfg *ListenerCfg) error {
network := lndclient.Network(config.Network) network := lndclient.Network(config.Network)
lnd, err := lisCfg.getLnd(network, config.Lnd) lnd, err := lisCfg.getLnd(network, config.Lnd)

Loading…
Cancel
Save