Skip to content

Commit

Permalink
Merge pull request #2013 from oasisprotocol/ptrus/feature/localhost-i…
Browse files Browse the repository at this point in the history
…nsecure

client-sdk: allow insecure connections to localhost address
  • Loading branch information
ptrus authored Oct 16, 2024
2 parents 3b02f11 + 885a055 commit aa03472
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
6 changes: 0 additions & 6 deletions client-sdk/go/config/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package config
import (
"fmt"
"net/url"
"strings"

"github.com/oasisprotocol/oasis-core/go/common/crypto/hash"
)
Expand Down Expand Up @@ -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:")
}
2 changes: 1 addition & 1 deletion client-sdk/go/connection/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
Expand Down

0 comments on commit aa03472

Please sign in to comment.