From 8fbd7c8a3aa1c1afb73db29048c003821b834a40 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Tue, 17 Oct 2023 20:15:41 +0530 Subject: [PATCH] Use non-secure Nitro client connection --- cmd/serve.go | 15 ++++----------- go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/cmd/serve.go b/cmd/serve.go index 89d98c0a..f7482c74 100644 --- a/cmd/serve.go +++ b/cmd/serve.go @@ -134,7 +134,9 @@ func serve() { } else { log.Info("Connecting to a remote Nitro node") - nitroRpcClient, err := initNitroRpcClient(&nitroConfig.RemoteNode) + // TODO: Read from config file + isSecure := false + nitroRpcClient, err := nitroRpc.NewHttpRpcClient(nitroConfig.RemoteNode.NitroEndpoint, isSecure) if err != nil { logWithCommand.Fatal(err) } @@ -505,7 +507,7 @@ func initNitroRpcServer(node *nitroNode.Node, pm paymentsmanager.PaymentsManager return nil, err } - rpcServer, err := nitroRpc.NewRpcServer(pm, node, transport) + rpcServer, err := nitroRpc.NewRpcServer(node, pm, transport) if err != nil { return nil, err } @@ -513,12 +515,3 @@ func initNitroRpcServer(node *nitroNode.Node, pm paymentsmanager.PaymentsManager slog.Info("Completed Nitro RPC server initialization") return rpcServer, nil } - -func initNitroRpcClient(config *s.RemoteNitroNodeConfig) (nitroRpc.RpcClientApi, error) { - clientConnection, err := nitroHttpTransport.NewHttpTransportAsClient(config.NitroEndpoint, 10*time.Millisecond) - if err != nil { - logWithCommand.Fatal(err) - } - - return nitroRpc.NewRpcClient(clientConnection) -} diff --git a/go.mod b/go.mod index a2b873b5..27a85176 100644 --- a/go.mod +++ b/go.mod @@ -302,4 +302,4 @@ replace ( github.com/cerc-io/ipfs-ethdb/v5 => github.com/cerc-io/ipfs-ethdb/v5 v5.0.1-alpha.0.20231013070931-0b1a36562a28 ) -replace github.com/statechannels/go-nitro v0.1.1 => github.com/deep-stack/go-nitro v0.0.0-20231016095715-e033149edb71 +replace github.com/statechannels/go-nitro v0.1.1 => github.com/deep-stack/go-nitro v0.0.0-20231017143751-3469db76815b diff --git a/go.sum b/go.sum index 5df11747..ad2934aa 100644 --- a/go.sum +++ b/go.sum @@ -184,8 +184,8 @@ github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5il github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= -github.com/deep-stack/go-nitro v0.0.0-20231016095715-e033149edb71 h1:/AG4iXW0TO8iIRvGrdhOoh42zODMzJ/Zao/jXuJskS0= -github.com/deep-stack/go-nitro v0.0.0-20231016095715-e033149edb71/go.mod h1:YYQvj9es00ZfLTwxZLM1M0ihUrqz8+lU2c10G06My3A= +github.com/deep-stack/go-nitro v0.0.0-20231017143751-3469db76815b h1:CvaeDMfBN+d+8sKxjTDT9WjLAxYlo9HfmIT+8Z/+YTc= +github.com/deep-stack/go-nitro v0.0.0-20231017143751-3469db76815b/go.mod h1:YYQvj9es00ZfLTwxZLM1M0ihUrqz8+lU2c10G06My3A= github.com/deepmap/oapi-codegen v1.6.0/go.mod h1:ryDa9AgbELGeB+YEXE1dR53yAjHwFvE9iAUlWl9Al3M= github.com/deepmap/oapi-codegen v1.8.2 h1:SegyeYGcdi0jLLrpbCMoJxnUUn8GBXHsvr4rbzjuhfU= github.com/deepmap/oapi-codegen v1.8.2/go.mod h1:YLgSKSDv/bZQB7N4ws6luhozi3cEdRktEqrX88CvjIw=