add --notls option to disable connecting with TLS
ok oga@
This commit is contained in:
parent
295cc873f4
commit
9e57a6c5be
2 changed files with 5 additions and 4 deletions
|
@ -274,7 +274,10 @@ func makeVerifyChain(args []interface{}) (btcjson.Cmd, error) {
|
||||||
func send(cfg *config, msg []byte) (interface{}, error) {
|
func send(cfg *config, msg []byte) (interface{}, error) {
|
||||||
var reply btcjson.Reply
|
var reply btcjson.Reply
|
||||||
var err error
|
var err error
|
||||||
if cfg.RPCCert != "" || cfg.TlsSkipVerify {
|
if cfg.NoTls || (cfg.RPCCert == "" && !cfg.TlsSkipVerify) {
|
||||||
|
reply, err = btcjson.RpcCommand(cfg.RPCUser, cfg.RPCPassword,
|
||||||
|
cfg.RPCServer, msg)
|
||||||
|
} else {
|
||||||
var pem []byte
|
var pem []byte
|
||||||
if cfg.RPCCert != "" {
|
if cfg.RPCCert != "" {
|
||||||
pem, err = ioutil.ReadFile(cfg.RPCCert)
|
pem, err = ioutil.ReadFile(cfg.RPCCert)
|
||||||
|
@ -285,9 +288,6 @@ func send(cfg *config, msg []byte) (interface{}, error) {
|
||||||
reply, err = btcjson.TlsRpcCommand(cfg.RPCUser,
|
reply, err = btcjson.TlsRpcCommand(cfg.RPCUser,
|
||||||
cfg.RPCPassword, cfg.RPCServer, msg, pem,
|
cfg.RPCPassword, cfg.RPCServer, msg, pem,
|
||||||
cfg.TlsSkipVerify)
|
cfg.TlsSkipVerify)
|
||||||
} else {
|
|
||||||
reply, err = btcjson.RpcCommand(cfg.RPCUser, cfg.RPCPassword,
|
|
||||||
cfg.RPCServer, msg)
|
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
@ -26,6 +26,7 @@ type config struct {
|
||||||
RPCPassword string `short:"P" long:"rpcpass" default-mask:"-" description:"RPC password"`
|
RPCPassword string `short:"P" long:"rpcpass" default-mask:"-" description:"RPC password"`
|
||||||
RPCServer string `short:"s" long:"rpcserver" description:"RPC server to connect to"`
|
RPCServer string `short:"s" long:"rpcserver" description:"RPC server to connect to"`
|
||||||
RPCCert string `short:"c" long:"rpccert" description:"RPC server certificate chain for validation"`
|
RPCCert string `short:"c" long:"rpccert" description:"RPC server certificate chain for validation"`
|
||||||
|
NoTls bool `long:"notls" description:"Disable TLS"`
|
||||||
TlsSkipVerify bool `long:"skipverify" description:"Do not verify tls certificates (not recommended!)"`
|
TlsSkipVerify bool `long:"skipverify" description:"Do not verify tls certificates (not recommended!)"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue