diff --git a/certificate/authorization/authorizations_test.go b/certificate/authorization/authorizations_test.go
index 5ad6c0b3c..ee5173b54 100644
--- a/certificate/authorization/authorizations_test.go
+++ b/certificate/authorization/authorizations_test.go
@@ -15,6 +15,7 @@ import (
"github.com/stretchr/testify/require"
"storj.io/storj/certificate/certificateclient"
+ "storj.io/storj/pkg/pb"
"storj.io/storj/pkg/peertls/tlsopts"
"storj.io/storj/pkg/rpc"
"storj.io/storj/pkg/storj"
@@ -230,7 +231,7 @@ func TestNewClient(t *testing.T) {
defer ctx.Check(conn.Close)
- client := certificateclient.NewClientFrom(conn.CertificatesClient())
+ client := certificateclient.NewClientFrom(pb.NewDRPCCertificatesClient(conn.Raw()))
assert.NoError(t, err)
assert.NotNil(t, client)
diff --git a/certificate/certificateclient/client.go b/certificate/certificateclient/client.go
index eadc30a80..2e35841d7 100644
--- a/certificate/certificateclient/client.go
+++ b/certificate/certificateclient/client.go
@@ -41,7 +41,7 @@ func New(ctx context.Context, dialer rpc.Dialer, address string) (_ *Client, err
return &Client{
conn: conn,
- client: conn.CertificatesClient(),
+ client: pb.NewDRPCCertificatesClient(conn.Raw()),
}, nil
}
diff --git a/cmd/inspector/main.go b/cmd/inspector/main.go
index 308462071..f4974d787 100644
--- a/cmd/inspector/main.go
+++ b/cmd/inspector/main.go
@@ -132,10 +132,10 @@ func NewInspector(address, path string) (*Inspector, error) {
return &Inspector{
conn: conn,
identity: id,
- overlayclient: conn.OverlayInspectorClient(),
- irrdbclient: conn.IrreparableInspectorClient(),
- healthclient: conn.HealthInspectorClient(),
- paymentsClient: conn.PaymentsClient(),
+ overlayclient: pb.NewDRPCOverlayInspectorClient(conn.Raw()),
+ irrdbclient: pb.NewDRPCIrreparableInspectorClient(conn.Raw()),
+ healthclient: pb.NewDRPCHealthInspectorClient(conn.Raw()),
+ paymentsClient: pb.NewDRPCPaymentsClient(conn.Raw()),
}, nil
}
diff --git a/cmd/storagenode/dashboard.go b/cmd/storagenode/dashboard.go
index 286500945..5f06f547a 100644
--- a/cmd/storagenode/dashboard.go
+++ b/cmd/storagenode/dashboard.go
@@ -40,7 +40,7 @@ func dialDashboardClient(ctx context.Context, address string) (*dashboardClient,
}
func (dash *dashboardClient) dashboard(ctx context.Context) (*pb.DashboardResponse, error) {
- return dash.conn.PieceStoreInspectorClient().Dashboard(ctx, &pb.DashboardRequest{})
+ return pb.NewDRPCPieceStoreInspectorClient(dash.conn.Raw()).Dashboard(ctx, &pb.DashboardRequest{})
}
func (dash *dashboardClient) close() error {
diff --git a/cmd/storagenode/gracefulexit.go b/cmd/storagenode/gracefulexit.go
index c15fb64af..ca7060368 100644
--- a/cmd/storagenode/gracefulexit.go
+++ b/cmd/storagenode/gracefulexit.go
@@ -37,15 +37,15 @@ func dialGracefulExitClient(ctx context.Context, address string) (*gracefulExitC
}
func (client *gracefulExitClient) getNonExitingSatellites(ctx context.Context) (*pb.GetNonExitingSatellitesResponse, error) {
- return client.conn.NodeGracefulExitClient().GetNonExitingSatellites(ctx, &pb.GetNonExitingSatellitesRequest{})
+ return pb.NewDRPCNodeGracefulExitClient(client.conn.Raw()).GetNonExitingSatellites(ctx, &pb.GetNonExitingSatellitesRequest{})
}
func (client *gracefulExitClient) initGracefulExit(ctx context.Context, req *pb.InitiateGracefulExitRequest) (*pb.ExitProgress, error) {
- return client.conn.NodeGracefulExitClient().InitiateGracefulExit(ctx, req)
+ return pb.NewDRPCNodeGracefulExitClient(client.conn.Raw()).InitiateGracefulExit(ctx, req)
}
func (client *gracefulExitClient) getExitProgress(ctx context.Context) (*pb.GetExitProgressResponse, error) {
- return client.conn.NodeGracefulExitClient().GetExitProgress(ctx, &pb.GetExitProgressRequest{})
+ return pb.NewDRPCNodeGracefulExitClient(client.conn.Raw()).GetExitProgress(ctx, &pb.GetExitProgressRequest{})
}
func (client *gracefulExitClient) close() error {
diff --git a/pkg/rpc/alias.go b/pkg/rpc/alias.go
deleted file mode 100644
index d10dc3558..000000000
--- a/pkg/rpc/alias.go
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright (C) 2019 Storj Labs, Inc.
-// See LICENSE for copying information.
-
-package rpc
-
-import (
- "storj.io/storj/pkg/pb"
- "storj.io/storj/pkg/rpc/rpcpool"
-)
-
-// RawConn is a type alias to a drpc client connection
-type RawConn = rpcpool.Conn
-
-// CertificatesClient returns a CertificatesClient for this connection
-func (c *Conn) CertificatesClient() pb.DRPCCertificatesClient {
- return pb.NewDRPCCertificatesClient(c.raw)
-}
-
-// ContactClient returns a ContactClient for this connection
-func (c *Conn) ContactClient() pb.DRPCContactClient {
- return pb.NewDRPCContactClient(c.raw)
-}
-
-// HealthInspectorClient returns a HealthInspectorClient for this connection
-func (c *Conn) HealthInspectorClient() pb.DRPCHealthInspectorClient {
- return pb.NewDRPCHealthInspectorClient(c.raw)
-}
-
-// IrreparableInspectorClient returns a IrreparableInspectorClient for this connection
-func (c *Conn) IrreparableInspectorClient() pb.DRPCIrreparableInspectorClient {
- return pb.NewDRPCIrreparableInspectorClient(c.raw)
-}
-
-// MetainfoClient returns a MetainfoClient for this connection
-func (c *Conn) MetainfoClient() pb.DRPCMetainfoClient {
- return pb.NewDRPCMetainfoClient(c.raw)
-}
-
-// NodeClient returns a NodeClient for this connection
-func (c *Conn) NodeClient() pb.DRPCNodeClient {
- return pb.NewDRPCNodeClient(c.raw)
-}
-
-// NodeGracefulExitClient returns a NodeGracefulExitClient for this connection
-func (c *Conn) NodeGracefulExitClient() pb.DRPCNodeGracefulExitClient {
- return pb.NewDRPCNodeGracefulExitClient(c.raw)
-}
-
-// NodeStatsClient returns a NodeStatsClient for this connection
-func (c *Conn) NodeStatsClient() pb.DRPCNodeStatsClient {
- return pb.NewDRPCNodeStatsClient(c.raw)
-}
-
-// OrdersClient returns a OrdersClient for this connection
-func (c *Conn) OrdersClient() pb.DRPCOrdersClient {
- return pb.NewDRPCOrdersClient(c.raw)
-}
-
-// OverlayInspectorClient returns a OverlayInspectorClient for this connection
-func (c *Conn) OverlayInspectorClient() pb.DRPCOverlayInspectorClient {
- return pb.NewDRPCOverlayInspectorClient(c.raw)
-}
-
-// PaymentsClient returns a PaymentsClient for this connection
-func (c *Conn) PaymentsClient() pb.DRPCPaymentsClient {
- return pb.NewDRPCPaymentsClient(c.raw)
-}
-
-// PieceStoreInspectorClient returns a PieceStoreInspectorClient for this connection
-func (c *Conn) PieceStoreInspectorClient() pb.DRPCPieceStoreInspectorClient {
- return pb.NewDRPCPieceStoreInspectorClient(c.raw)
-}
-
-// PiecestoreClient returns a PiecestoreClient for this connection
-func (c *Conn) PiecestoreClient() pb.DRPCPiecestoreClient {
- return pb.NewDRPCPiecestoreClient(c.raw)
-}
-
-// ReferralManagerClient returns a ReferralManagerClient for this connection
-func (c *Conn) ReferralManagerClient() pb.DRPCReferralManagerClient {
- return pb.NewDRPCReferralManagerClient(c.raw)
-}
-
-// SatelliteGracefulExitClient returns a SatelliteGracefulExitClient for this connection
-func (c *Conn) SatelliteGracefulExitClient() pb.DRPCSatelliteGracefulExitClient {
- return pb.NewDRPCSatelliteGracefulExitClient(c.raw)
-}
-
-// VouchersClient returns a VouchersClient for this connection
-func (c *Conn) VouchersClient() pb.DRPCVouchersClient {
- return pb.NewDRPCVouchersClient(c.raw)
-}
diff --git a/pkg/rpc/conn.go b/pkg/rpc/conn.go
index 6ea2a533d..e17919832 100644
--- a/pkg/rpc/conn.go
+++ b/pkg/rpc/conn.go
@@ -7,8 +7,12 @@ import (
"crypto/tls"
"storj.io/storj/pkg/identity"
+ "storj.io/storj/pkg/rpc/rpcpool"
)
+// RawConn is a type alias to a drpc client connection
+type RawConn = rpcpool.Conn
+
// Conn is a wrapper around a drpc client connection.
type Conn struct {
state tls.ConnectionState
@@ -25,3 +29,8 @@ func (c *Conn) ConnectionState() tls.ConnectionState { return c.state }
func (c *Conn) PeerIdentity() (*identity.PeerIdentity, error) {
return identity.PeerIdentityFromChain(c.state.PeerCertificates)
}
+
+// Raw returns the underlying connection.
+func (c *Conn) Raw() *RawConn {
+ return c.raw
+}
diff --git a/pkg/rpc/gen.go b/pkg/rpc/gen.go
deleted file mode 100644
index a6609b689..000000000
--- a/pkg/rpc/gen.go
+++ /dev/null
@@ -1,192 +0,0 @@
-// Copyright (C) 2019 Storj Labs, Inc.
-// See LICENSE for copying information.
-//
-// This code generates the compat_drpc and compat_grpc files by reading in
-// protobuf definitions. Its purpose is to generate a bunch of type aliases
-// and forwarding functions so that a build tag transparently swaps out the
-// concrete implementations of the rpcs.
-
-// +build ignore
-
-package main
-
-import (
- "bytes"
- "fmt"
- "go/format"
- "io"
- "io/ioutil"
- "log"
- "os"
- "path/filepath"
- "regexp"
- "sort"
- "strings"
-
- "github.com/zeebo/errs"
-)
-
-func main() {
- if err := run(); err != nil {
- log.Fatalf("%+v", err)
- }
-}
-
-func usage() error {
- return errs.New("usage: %s
drpc