diff --git a/aperture.go b/aperture.go index 2d04773..a78c5d9 100644 --- a/aperture.go +++ b/aperture.go @@ -8,6 +8,7 @@ import ( "fmt" "io" "net/http" + _ "net/http/pprof" // Blank import to set up profiling HTTP handlers. "os" "path/filepath" "regexp" @@ -35,12 +36,10 @@ import ( "golang.org/x/net/http2/h2c" "google.golang.org/grpc" "google.golang.org/grpc/credentials" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/keepalive" "google.golang.org/protobuf/encoding/protojson" "gopkg.in/yaml.v2" - - // Blank import to set up profiling HTTP handlers. - _ "net/http/pprof" ) const ( @@ -867,7 +866,9 @@ func createHashMailServer(cfg *Config) ([]proxy.LocalService, func(), error) { &tls.Config{InsecureSkipVerify: true}, )) if cfg.Insecure { - restProxyTLSOpt = grpc.WithInsecure() + restProxyTLSOpt = grpc.WithTransportCredentials( + insecure.NewCredentials(), + ) } mux := gateway.NewServeMux(customMarshalerOption) diff --git a/hashmail_server_test.go b/hashmail_server_test.go index 29dbbf6..8ea1507 100644 --- a/hashmail_server_test.go +++ b/hashmail_server_test.go @@ -17,6 +17,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/test/bufconn" ) @@ -42,7 +43,11 @@ func TestHashMailServerReturnStream(t *testing.T) { setupAperture(t) // Create a client and connect it to the server. - conn, err := grpc.Dial(testApertureAddress, grpc.WithInsecure()) + conn, err := grpc.Dial( + testApertureAddress, grpc.WithTransportCredentials( + insecure.NewCredentials(), + ), + ) require.NoError(t, err) client := hashmailrpc.NewHashMailClient(conn) @@ -114,7 +119,11 @@ func TestHashMailServerLargeMessage(t *testing.T) { setupAperture(t) // Create a client and connect it to the server. - conn, err := grpc.Dial(testApertureAddress, grpc.WithInsecure()) + conn, err := grpc.Dial( + testApertureAddress, grpc.WithTransportCredentials( + insecure.NewCredentials(), + ), + ) require.NoError(t, err) client := hashmailrpc.NewHashMailClient(conn) @@ -410,7 +419,7 @@ func (h *hashMailHarness) newClientConn() *grpc.ClientConn { conn, err := grpc.Dial("bufnet", grpc.WithContextDialer( func(ctx context.Context, s string) (net.Conn, error) { return h.lis.Dial() - }), grpc.WithInsecure(), + }), grpc.WithTransportCredentials(insecure.NewCredentials()), ) require.NoError(h.t, err) h.t.Cleanup(func() { diff --git a/pricer/grpcPricer.go b/pricer/grpcPricer.go index f9f84ca..4a0ab25 100644 --- a/pricer/grpcPricer.go +++ b/pricer/grpcPricer.go @@ -9,6 +9,7 @@ import ( "github.com/lightninglabs/aperture/pricesrpc" "google.golang.org/grpc" "google.golang.org/grpc/credentials" + "google.golang.org/grpc/credentials/insecure" ) // Config holds all the config values required to initialise the GRPCPricer. @@ -44,7 +45,7 @@ func NewGRPCPricer(cfg *Config) (*GRPCPricer, error) { ) if cfg.Insecure { - opt = grpc.WithInsecure() + opt = grpc.WithTransportCredentials(insecure.NewCredentials()) } else { tlsCredentials, err := credentials.NewClientTLSFromFile( cfg.TLSCertPath, "",