mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
loopd: add swap server TLS cert path
We need the ability to connect to a swap server that uses a self-signed certificate. The LSAT proxy cannot proxy insecure gRPC requests since they don't conform to the HTTP 1.1 standard. Therefore the LSAT proxy fill only serve TLS connections. This means, we need the TLS path option to specify the certificate the test environment LSAT proxy uses.
This commit is contained in:
parent
8b8b878440
commit
49cbe9aa63
6 changed files with 44 additions and 22 deletions
|
|
@ -27,12 +27,13 @@ type lndConfig struct {
|
|||
type viewParameters struct{}
|
||||
|
||||
type config struct {
|
||||
ShowVersion bool `short:"V" long:"version" description:"Display version information and exit"`
|
||||
Insecure bool `long:"insecure" description:"disable tls"`
|
||||
Network string `long:"network" description:"network to run on" choice:"regtest" choice:"testnet" choice:"mainnet" choice:"simnet"`
|
||||
SwapServer string `long:"swapserver" description:"swap server address host:port"`
|
||||
RPCListen string `long:"rpclisten" description:"Address to listen on for gRPC clients"`
|
||||
RESTListen string `long:"restlisten" description:"Address to listen on for REST clients"`
|
||||
ShowVersion bool `short:"V" long:"version" description:"Display version information and exit"`
|
||||
Insecure bool `long:"insecure" description:"disable tls"`
|
||||
Network string `long:"network" description:"network to run on" choice:"regtest" choice:"testnet" choice:"mainnet" choice:"simnet"`
|
||||
SwapServer string `long:"swapserver" description:"swap server address host:port"`
|
||||
TLSPathSwapSrv string `long:"tlspathswapserver" description:"Path to swap server tls certificate. Only needed if the swap server uses a self-signed certificate."`
|
||||
RPCListen string `long:"rpclisten" description:"Address to listen on for gRPC clients"`
|
||||
RESTListen string `long:"restlisten" description:"Address to listen on for REST clients"`
|
||||
|
||||
LogDir string `long:"logdir" description:"Directory to log output."`
|
||||
MaxLogFiles int `long:"maxlogfiles" description:"Maximum logfiles to keep (0 for no rotation)"`
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ func daemon(config *config) error {
|
|||
// Create an instance of the loop client library.
|
||||
swapClient, cleanup, err := getClient(
|
||||
config.Network, config.SwapServer, config.Insecure,
|
||||
&lnd.LndServices,
|
||||
config.TLSPathSwapSrv, &lnd.LndServices,
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ func getLnd(network string, cfg *lndConfig) (*lndclient.GrpcLndServices, error)
|
|||
}
|
||||
|
||||
// getClient returns an instance of the swap client.
|
||||
func getClient(network, swapServer string, insecure bool,
|
||||
func getClient(network, swapServer string, insecure bool, tlsPathServer string,
|
||||
lnd *lndclient.LndServices) (*loop.Client, func(), error) {
|
||||
|
||||
storeDir, err := getStoreDir(network)
|
||||
|
|
@ -25,7 +25,7 @@ func getClient(network, swapServer string, insecure bool,
|
|||
}
|
||||
|
||||
swapClient, cleanUp, err := loop.NewClient(
|
||||
storeDir, swapServer, insecure, lnd,
|
||||
storeDir, swapServer, insecure, tlsPathServer, lnd,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
|
|
|
|||
|
|
@ -24,7 +24,8 @@ func view(config *config) error {
|
|||
defer lnd.Close()
|
||||
|
||||
swapClient, cleanup, err := getClient(
|
||||
config.Network, config.SwapServer, config.Insecure, &lnd.LndServices,
|
||||
config.Network, config.SwapServer, config.Insecure,
|
||||
config.TLSPathSwapSrv, &lnd.LndServices,
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue