mirror of
https://github.com/lightninglabs/faraday.git
synced 2026-08-13 12:33:35 +02:00
Move the gRPC/REST server lifecycle, macaroon service management, and TLS setup from frdrpcserver.RPCServer to a new Faraday struct in the faraday package. This leaves RPCServer as a pure RPC request handler with only business logic methods. The Faraday struct embeds *frdrpcserver.RPCServer and takes ownership of all infrastructure concerns: gRPC/REST server creation, macaroon service setup, TLS configuration, and start/stop lifecycle. The frdrpcserver.Config is slimmed down to just Lnd and BitcoinClient. The macaroons.go file is also moved from frdrpcserver to the faraday package, as the macaroon constants are now used by the Faraday struct directly.
29 lines
905 B
Go
29 lines
905 B
Go
package faraday
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
const (
|
|
// faradayMacaroonLocation is the value we use for the faraday
|
|
// macaroons' "Location" field when baking them.
|
|
faradayMacaroonLocation = "faraday"
|
|
|
|
// macDatabaseOpenTimeout is how long we wait for acquiring the lock on
|
|
// the macaroon database before we give up with an error.
|
|
macDatabaseOpenTimeout = time.Second * 5
|
|
)
|
|
|
|
var (
|
|
|
|
// macDbDefaultPw is the default encryption password used to encrypt the
|
|
// faraday macaroon database. The macaroon service requires us to set a
|
|
// non-nil password so we set it to an empty string. This will cause the
|
|
// keys to be encrypted on disk but won't provide any security at all as
|
|
// the password is known to anyone.
|
|
//
|
|
// TODO(guggero): Allow the password to be specified by the user. Needs
|
|
// create/unlock calls in the RPC. Using a password should be optional
|
|
// though.
|
|
macDbDefaultPw = []byte("")
|
|
)
|