Rename connect option to rpcconnect.
The connect option is already used by btcd to force a connection to other full node peers. Wallet does not talk directly with these peers, so the connect option is being renamed to something unique for an RPC client connection.
This commit is contained in:
parent
04a6cb2176
commit
17ebf9461f
3 changed files with 9 additions and 8 deletions
11
config.go
11
config.go
|
@ -50,7 +50,7 @@ var (
|
|||
type config struct {
|
||||
ShowVersion bool `short:"V" long:"version" description:"Display version information and exit"`
|
||||
CAFile string `long:"cafile" description:"File containing root certificates to authenticate a TLS connections with btcd"`
|
||||
Connect string `short:"c" long:"connect" description:"Server and port of btcd instance to connect to (default localhost:18334, mainnet: localhost:8334)"`
|
||||
RPCConnect string `short:"c" long:"rpcconnect" description:"Hostname/IP and port of btcd RPC server to connect to (default localhost:18334, mainnet: localhost:8334)"`
|
||||
DebugLevel string `short:"d" long:"debuglevel" description:"Logging level {trace, debug, info, warn, error, critical}"`
|
||||
ConfigFile string `short:"C" long:"configfile" description:"Path to configuration file"`
|
||||
SvrListeners []string `long:"rpclisten" description:"Listen for RPC/websocket connections on this interface/port (default port: 18332, mainnet: 8332)"`
|
||||
|
@ -218,12 +218,13 @@ func loadConfig() (*config, []string, error) {
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
if cfg.Connect == "" {
|
||||
cfg.Connect = activeNetParams.connect
|
||||
if cfg.RPCConnect == "" {
|
||||
cfg.RPCConnect = activeNetParams.connect
|
||||
}
|
||||
|
||||
// Add default port to connect flag if missing.
|
||||
cfg.Connect = normalizeAddress(cfg.Connect, activeNetParams.btcdPort)
|
||||
cfg.RPCConnect = normalizeAddress(cfg.RPCConnect,
|
||||
activeNetParams.btcdPort)
|
||||
|
||||
// If CAFile is unset, choose either the copy or local btcd cert.
|
||||
if cfg.CAFile == "" {
|
||||
|
@ -232,7 +233,7 @@ func loadConfig() (*config, []string, error) {
|
|||
// If the CA copy does not exist, check if we're connecting to
|
||||
// a local btcd and switch to its RPC cert if it exists.
|
||||
if !fileExists(cfg.CAFile) {
|
||||
host, _, err := net.SplitHostPort(cfg.Connect)
|
||||
host, _, err := net.SplitHostPort(cfg.RPCConnect)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
; proxypass=
|
||||
|
||||
; The server and port used for btcd websocket connections.
|
||||
; connect=localhost:18334
|
||||
; rpcconnect=localhost:18334
|
||||
|
||||
; File containing root certificates to authenticate a TLS connections with btcd
|
||||
; cafile=~/.btcwallet/btcd.cert
|
||||
|
|
|
@ -627,7 +627,7 @@ func (s *server) checkAuth(r *http.Request) error {
|
|||
|
||||
// BtcdWS opens a websocket connection to a btcd instance.
|
||||
func BtcdWS(certificates []byte) (*websocket.Conn, error) {
|
||||
url := fmt.Sprintf("wss://%s/ws", cfg.Connect)
|
||||
url := fmt.Sprintf("wss://%s/ws", cfg.RPCConnect)
|
||||
config, err := websocket.NewConfig(url, "https://localhost/")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -655,7 +655,7 @@ func BtcdWS(certificates []byte) (*websocket.Conn, error) {
|
|||
Username: cfg.ProxyUser,
|
||||
Password: cfg.ProxyPass,
|
||||
}
|
||||
conn, err := proxy.Dial("tcp", cfg.Connect)
|
||||
conn, err := proxy.Dial("tcp", cfg.RPCConnect)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue