multi: address linter issues

This commit is contained in:
Oliver Gugger
2023-06-15 14:11:09 +02:00
parent e571d6f13c
commit f17b877806
3 changed files with 19 additions and 8 deletions

View File

@@ -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)

View File

@@ -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() {

View File

@@ -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, "",