From 885a055e2796a4f89c8d60f6b830fbdab81f2612 Mon Sep 17 00:00:00 2001 From: ptrus Date: Tue, 1 Oct 2024 12:16:50 +0200 Subject: [PATCH] client-sdk: allow insecure connections to localhost address --- client-sdk/go/config/network.go | 6 ------ client-sdk/go/connection/connection.go | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/client-sdk/go/config/network.go b/client-sdk/go/config/network.go index ed96ce0499..2557902132 100644 --- a/client-sdk/go/config/network.go +++ b/client-sdk/go/config/network.go @@ -3,7 +3,6 @@ package config import ( "fmt" "net/url" - "strings" "github.com/oasisprotocol/oasis-core/go/common/crypto/hash" ) @@ -136,8 +135,3 @@ func (n *Network) Validate() error { return nil } - -// IsLocalRPC checks whether the RPC endpoint points to a local UNIX socket. -func (n *Network) IsLocalRPC() bool { - return strings.HasPrefix(n.RPC, "unix:") -} diff --git a/client-sdk/go/connection/connection.go b/client-sdk/go/connection/connection.go index afa2ebc4d0..8cb31d091b 100644 --- a/client-sdk/go/connection/connection.go +++ b/client-sdk/go/connection/connection.go @@ -105,7 +105,7 @@ func Connect(ctx context.Context, net *config.Network) (Connection, error) { // omitting the chain context check. func ConnectNoVerify(_ context.Context, net *config.Network) (Connection, error) { var dialOpts []grpc.DialOption - switch net.IsLocalRPC() { + switch cmnGrpc.IsLocalAddress(net.RPC) { case true: // No TLS needed for local nodes. dialOpts = append(dialOpts, grpc.WithTransportCredentials(insecure.NewCredentials()))