diff --git a/Jenkinsfile.public b/Jenkinsfile.public index d14268c9e..b1a35a0e2 100644 --- a/Jenkinsfile.public +++ b/Jenkinsfile.public @@ -58,6 +58,8 @@ pipeline { sh 'check-mod-tidy -mod .build/go.mod.orig' sh 'make check-monitoring' sh 'make test-wasm-size' + + sh 'protolock status' } } diff --git a/Makefile b/Makefile index a2d44b58e..85a1b731c 100644 --- a/Makefile +++ b/Makefile @@ -378,3 +378,6 @@ diagrams-graphml: bump-dependencies: go get storj.io/common@main storj.io/private@main storj.io/uplink@main go mod tidy + +update-proto-lock: + protolock commit --ignore "satellite/internalpb,storagenode/internalpb,cmd/metainfo-migration/fastpb" \ No newline at end of file diff --git a/certificate/authorization/authorizations.go b/certificate/authorization/authorizations.go index b219cc936..b9f2f673c 100644 --- a/certificate/authorization/authorizations.go +++ b/certificate/authorization/authorizations.go @@ -20,8 +20,8 @@ import ( "github.com/zeebo/errs" "storj.io/common/identity" - "storj.io/common/pb" "storj.io/common/rpc/rpcpeer" + "storj.io/storj/certificate/certificatepb" ) const ( @@ -63,7 +63,7 @@ type Token struct { // ClaimOpts hold parameters for claiming an authorization. type ClaimOpts struct { - Req *pb.SigningRequest + Req *certificatepb.SigningRequest Peer *rpcpeer.Peer ChainBytes [][]byte MinDifficulty uint16 diff --git a/certificate/authorization/authorizations_test.go b/certificate/authorization/authorizations_test.go index 42f84d6ee..5757dc521 100644 --- a/certificate/authorization/authorizations_test.go +++ b/certificate/authorization/authorizations_test.go @@ -15,12 +15,12 @@ import ( "github.com/stretchr/testify/require" "storj.io/common/identity/testidentity" - "storj.io/common/pb" "storj.io/common/peertls/tlsopts" "storj.io/common/rpc" "storj.io/common/storj" "storj.io/common/testcontext" "storj.io/storj/certificate/certificateclient" + "storj.io/storj/certificate/certificatepb" ) var ( @@ -231,7 +231,7 @@ func TestNewClient(t *testing.T) { defer ctx.Check(conn.Close) - client := certificateclient.NewClientFrom(pb.NewDRPCCertificatesClient(conn)) + client := certificateclient.NewClientFrom(certificatepb.NewDRPCCertificatesClient(conn)) assert.NoError(t, err) assert.NotNil(t, client) diff --git a/certificate/authorization/db_test.go b/certificate/authorization/db_test.go index b73b61c8f..d250a5757 100644 --- a/certificate/authorization/db_test.go +++ b/certificate/authorization/db_test.go @@ -17,9 +17,9 @@ import ( "storj.io/common/identity" "storj.io/common/identity/testidentity" - "storj.io/common/pb" "storj.io/common/rpc/rpcpeer" "storj.io/common/testcontext" + "storj.io/storj/certificate/certificatepb" "storj.io/storj/storage" ) @@ -223,7 +223,7 @@ func TestAuthorizationDB_Claim_Valid(t *testing.T) { } now := time.Now() - req := &pb.SigningRequest{ + req := &certificatepb.SigningRequest{ AuthToken: auths[0].Token.String(), Timestamp: now.Unix(), } @@ -311,7 +311,7 @@ func TestAuthorizationDB_Claim_Invalid(t *testing.T) { t.Run("double claim", func(t *testing.T) { err = authDB.Claim(ctx, &ClaimOpts{ - Req: &pb.SigningRequest{ + Req: &certificatepb.SigningRequest{ AuthToken: auths[claimedIndex].Token.String(), Timestamp: time.Now().Unix(), }, @@ -339,7 +339,7 @@ func TestAuthorizationDB_Claim_Invalid(t *testing.T) { t.Run("invalid timestamp", func(t *testing.T) { err = authDB.Claim(ctx, &ClaimOpts{ - Req: &pb.SigningRequest{ + Req: &certificatepb.SigningRequest{ AuthToken: auths[unclaimedIndex].Token.String(), // NB: 1 day ago Timestamp: time.Now().Unix() - 86400, @@ -364,7 +364,7 @@ func TestAuthorizationDB_Claim_Invalid(t *testing.T) { t.Run("invalid difficulty", func(t *testing.T) { err = authDB.Claim(ctx, &ClaimOpts{ - Req: &pb.SigningRequest{ + Req: &certificatepb.SigningRequest{ AuthToken: auths[unclaimedIndex].Token.String(), Timestamp: time.Now().Unix(), }, diff --git a/certificate/certificateclient/client.go b/certificate/certificateclient/client.go index 9f221e855..3e615e3ac 100644 --- a/certificate/certificateclient/client.go +++ b/certificate/certificateclient/client.go @@ -11,9 +11,9 @@ import ( "github.com/zeebo/errs" "storj.io/common/identity" - "storj.io/common/pb" "storj.io/common/peertls/tlsopts" "storj.io/common/rpc" + "storj.io/storj/certificate/certificatepb" ) var mon = monkit.Package() @@ -24,10 +24,10 @@ type Config struct { TLS tlsopts.Config } -// Client implements pb.DRPCCertificatesClient. +// Client implements certificatepb.DRPCCertificatesClient. type Client struct { conn *rpc.Conn - client pb.DRPCCertificatesClient + client certificatepb.DRPCCertificatesClient } // New creates a new certificate signing rpc client. @@ -41,13 +41,13 @@ func New(ctx context.Context, dialer rpc.Dialer, address string) (_ *Client, err return &Client{ conn: conn, - client: pb.NewDRPCCertificatesClient(conn), + client: certificatepb.NewDRPCCertificatesClient(conn), }, nil } // NewClientFrom creates a new certificate signing client from an existing // cert signing client. -func NewClientFrom(client pb.DRPCCertificatesClient) *Client { +func NewClientFrom(client certificatepb.DRPCCertificatesClient) *Client { return &Client{ client: client, } @@ -75,7 +75,7 @@ func (config Config) Sign(ctx context.Context, ident *identity.FullIdentity, aut func (client *Client) Sign(ctx context.Context, tokenStr string) (_ [][]byte, err error) { defer mon.Task()(&ctx)(&err) - res, err := client.client.Sign(ctx, &pb.SigningRequest{ + res, err := client.client.Sign(ctx, &certificatepb.SigningRequest{ AuthToken: tokenStr, Timestamp: time.Now().Unix(), }) diff --git a/certificate/certificatepb/certificate.pb.go b/certificate/certificatepb/certificate.pb.go new file mode 100644 index 000000000..ee844508e --- /dev/null +++ b/certificate/certificatepb/certificate.pb.go @@ -0,0 +1,130 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: certificate.proto + +package certificatepb + +import ( + fmt "fmt" + math "math" + + proto "github.com/gogo/protobuf/proto" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type SigningRequest struct { + AuthToken string `protobuf:"bytes,1,opt,name=auth_token,json=authToken,proto3" json:"auth_token,omitempty"` + Timestamp int64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SigningRequest) Reset() { *m = SigningRequest{} } +func (m *SigningRequest) String() string { return proto.CompactTextString(m) } +func (*SigningRequest) ProtoMessage() {} +func (*SigningRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_c0d34c34dd33be4b, []int{0} +} +func (m *SigningRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SigningRequest.Unmarshal(m, b) +} +func (m *SigningRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SigningRequest.Marshal(b, m, deterministic) +} +func (m *SigningRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SigningRequest.Merge(m, src) +} +func (m *SigningRequest) XXX_Size() int { + return xxx_messageInfo_SigningRequest.Size(m) +} +func (m *SigningRequest) XXX_DiscardUnknown() { + xxx_messageInfo_SigningRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_SigningRequest proto.InternalMessageInfo + +func (m *SigningRequest) GetAuthToken() string { + if m != nil { + return m.AuthToken + } + return "" +} + +func (m *SigningRequest) GetTimestamp() int64 { + if m != nil { + return m.Timestamp + } + return 0 +} + +type SigningResponse struct { + Chain [][]byte `protobuf:"bytes,1,rep,name=chain,proto3" json:"chain,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SigningResponse) Reset() { *m = SigningResponse{} } +func (m *SigningResponse) String() string { return proto.CompactTextString(m) } +func (*SigningResponse) ProtoMessage() {} +func (*SigningResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_c0d34c34dd33be4b, []int{1} +} +func (m *SigningResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SigningResponse.Unmarshal(m, b) +} +func (m *SigningResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SigningResponse.Marshal(b, m, deterministic) +} +func (m *SigningResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_SigningResponse.Merge(m, src) +} +func (m *SigningResponse) XXX_Size() int { + return xxx_messageInfo_SigningResponse.Size(m) +} +func (m *SigningResponse) XXX_DiscardUnknown() { + xxx_messageInfo_SigningResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_SigningResponse proto.InternalMessageInfo + +func (m *SigningResponse) GetChain() [][]byte { + if m != nil { + return m.Chain + } + return nil +} + +func init() { + proto.RegisterType((*SigningRequest)(nil), "node.SigningRequest") + proto.RegisterType((*SigningResponse)(nil), "node.SigningResponse") +} + +func init() { proto.RegisterFile("certificate.proto", fileDescriptor_c0d34c34dd33be4b) } + +var fileDescriptor_c0d34c34dd33be4b = []byte{ + // 198 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x8f, 0x41, 0x4b, 0x80, 0x40, + 0x10, 0x85, 0x31, 0x2d, 0x70, 0x90, 0xa2, 0xc5, 0x40, 0xa2, 0x40, 0xbc, 0xb4, 0x74, 0x58, 0x21, + 0xff, 0x41, 0x9e, 0xbb, 0x6c, 0x9d, 0xba, 0xc4, 0x6a, 0x93, 0x6e, 0xe1, 0xee, 0xe6, 0x8e, 0xff, + 0x3f, 0x56, 0x21, 0xad, 0xdb, 0x9b, 0x0f, 0xe6, 0xf1, 0x3d, 0xb8, 0xec, 0x71, 0x26, 0xfd, 0xa1, + 0x7b, 0x45, 0x28, 0xdc, 0x6c, 0xc9, 0xb2, 0xc4, 0xd8, 0x77, 0xac, 0x9e, 0xe0, 0xfc, 0x59, 0x0f, + 0x46, 0x9b, 0x41, 0xe2, 0xf7, 0x82, 0x9e, 0xd8, 0x2d, 0x80, 0x5a, 0x68, 0x7c, 0x23, 0xfb, 0x85, + 0xa6, 0x88, 0xca, 0x88, 0xa7, 0x32, 0x0d, 0xe4, 0x25, 0x00, 0x76, 0x03, 0x29, 0xe9, 0x09, 0x3d, + 0xa9, 0xc9, 0x15, 0x27, 0x65, 0xc4, 0x63, 0xb9, 0x83, 0xea, 0x0e, 0x2e, 0x7e, 0xeb, 0xbc, 0xb3, + 0xc6, 0x23, 0xcb, 0xe1, 0xb4, 0x1f, 0x95, 0x0e, 0x55, 0x31, 0xcf, 0xe4, 0x76, 0x3c, 0xb4, 0x90, + 0xb5, 0xbb, 0x92, 0x67, 0x0d, 0x24, 0xe1, 0x91, 0xe5, 0x22, 0x68, 0x89, 0xbf, 0x4e, 0xd7, 0x57, + 0xff, 0xe8, 0x56, 0xfd, 0x78, 0xff, 0xca, 0x3d, 0xd9, 0xf9, 0x53, 0x68, 0x5b, 0xaf, 0xa1, 0x3e, + 0xcc, 0x3c, 0x66, 0xd7, 0x75, 0x67, 0xeb, 0xea, 0xe6, 0x27, 0x00, 0x00, 0xff, 0xff, 0x63, 0xd9, + 0xed, 0xce, 0x0a, 0x01, 0x00, 0x00, +} diff --git a/certificate/certificatepb/certificate.proto b/certificate/certificatepb/certificate.proto new file mode 100644 index 000000000..8772cfad8 --- /dev/null +++ b/certificate/certificatepb/certificate.proto @@ -0,0 +1,20 @@ +// Copyright (C) 2019 Storj Labs, Inc. +// See LICENSE for copying information. + +syntax = "proto3"; +option go_package = "storj.io/storj/certificate/certificatepb"; + +package node; + +service Certificates { + rpc Sign(SigningRequest) returns (SigningResponse); +} + +message SigningRequest { + string auth_token = 1; + int32 timestamp = 2; +} + +message SigningResponse { + repeated bytes chain = 1; +} diff --git a/certificate/certificatepb/certificate_drpc.pb.go b/certificate/certificatepb/certificate_drpc.pb.go new file mode 100644 index 000000000..bfcc4fdc5 --- /dev/null +++ b/certificate/certificatepb/certificate_drpc.pb.go @@ -0,0 +1,115 @@ +// Code generated by protoc-gen-go-drpc. DO NOT EDIT. +// protoc-gen-go-drpc version: v0.0.20 +// source: certificate.proto + +package certificatepb + +import ( + bytes "bytes" + context "context" + errors "errors" + + jsonpb "github.com/gogo/protobuf/jsonpb" + proto "github.com/gogo/protobuf/proto" + + drpc "storj.io/drpc" + drpcerr "storj.io/drpc/drpcerr" +) + +type drpcEncoding_File_certificate_proto struct{} + +func (drpcEncoding_File_certificate_proto) Marshal(msg drpc.Message) ([]byte, error) { + return proto.Marshal(msg.(proto.Message)) +} + +func (drpcEncoding_File_certificate_proto) Unmarshal(buf []byte, msg drpc.Message) error { + return proto.Unmarshal(buf, msg.(proto.Message)) +} + +func (drpcEncoding_File_certificate_proto) JSONMarshal(msg drpc.Message) ([]byte, error) { + var buf bytes.Buffer + err := new(jsonpb.Marshaler).Marshal(&buf, msg.(proto.Message)) + if err != nil { + return nil, err + } + return buf.Bytes(), nil +} + +func (drpcEncoding_File_certificate_proto) JSONUnmarshal(buf []byte, msg drpc.Message) error { + return jsonpb.Unmarshal(bytes.NewReader(buf), msg.(proto.Message)) +} + +type DRPCCertificatesClient interface { + DRPCConn() drpc.Conn + + Sign(ctx context.Context, in *SigningRequest) (*SigningResponse, error) +} + +type drpcCertificatesClient struct { + cc drpc.Conn +} + +func NewDRPCCertificatesClient(cc drpc.Conn) DRPCCertificatesClient { + return &drpcCertificatesClient{cc} +} + +func (c *drpcCertificatesClient) DRPCConn() drpc.Conn { return c.cc } + +func (c *drpcCertificatesClient) Sign(ctx context.Context, in *SigningRequest) (*SigningResponse, error) { + out := new(SigningResponse) + err := c.cc.Invoke(ctx, "/node.Certificates/Sign", drpcEncoding_File_certificate_proto{}, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +type DRPCCertificatesServer interface { + Sign(context.Context, *SigningRequest) (*SigningResponse, error) +} + +type DRPCCertificatesUnimplementedServer struct{} + +func (s *DRPCCertificatesUnimplementedServer) Sign(context.Context, *SigningRequest) (*SigningResponse, error) { + return nil, drpcerr.WithCode(errors.New("Unimplemented"), 12) +} + +type DRPCCertificatesDescription struct{} + +func (DRPCCertificatesDescription) NumMethods() int { return 1 } + +func (DRPCCertificatesDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) { + switch n { + case 0: + return "/node.Certificates/Sign", drpcEncoding_File_certificate_proto{}, + func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { + return srv.(DRPCCertificatesServer). + Sign( + ctx, + in1.(*SigningRequest), + ) + }, DRPCCertificatesServer.Sign, true + default: + return "", nil, nil, nil, false + } +} + +func DRPCRegisterCertificates(mux drpc.Mux, impl DRPCCertificatesServer) error { + return mux.Register(impl, DRPCCertificatesDescription{}) +} + +type DRPCCertificates_SignStream interface { + drpc.Stream + SendAndClose(*SigningResponse) error +} + +type drpcCertificates_SignStream struct { + drpc.Stream +} + +func (x *drpcCertificates_SignStream) SendAndClose(m *SigningResponse) error { + if err := x.MsgSend(m, drpcEncoding_File_certificate_proto{}); err != nil { + return err + } + return x.CloseSend() +} diff --git a/certificate/certificatepb/doc.go b/certificate/certificatepb/doc.go new file mode 100644 index 000000000..946bf2d59 --- /dev/null +++ b/certificate/certificatepb/doc.go @@ -0,0 +1,7 @@ +// Copyright (C) 2021 Storj Labs, Inc. +// See LICENSE for copying information. + +// Package certificatepb contains protobuf definitions for certificate signing. +package certificatepb + +//go:generate go run gen.go diff --git a/certificate/certificatepb/gen.go b/certificate/certificatepb/gen.go new file mode 100644 index 000000000..529e04bf1 --- /dev/null +++ b/certificate/certificatepb/gen.go @@ -0,0 +1,121 @@ +// Copyright (C) 2019 Storj Labs, Inc. +// See LICENSE for copying information. + +// +build ignore + +package main + +import ( + "flag" + "fmt" + "io/ioutil" + "os" + "os/exec" + "path/filepath" + "strings" +) + +var ( + mainpkg = flag.String("pkg", "storj.io/storj/certificate/certificatepb", "main package name") + protoc = flag.String("protoc", "protoc", "protoc compiler") +) + +var ignoreProto = map[string]bool{ + "gogo.proto": true, +} + +func ignore(files []string) []string { + xs := []string{} + for _, file := range files { + if !ignoreProto[file] { + xs = append(xs, file) + } + } + return xs +} + +// Programs needed for code generation: +// +// github.com/ckaznocha/protoc-gen-lint +// storj.io/drpc/cmd/protoc-gen-drpc +// github.com/nilslice/protolock/cmd/protolock + +func main() { + flag.Parse() + + // TODO: protolock + + { + // cleanup previous files + localfiles, err := filepath.Glob("*.pb.go") + check(err) + + all := []string{} + all = append(all, localfiles...) + for _, match := range all { + _ = os.Remove(match) + } + } + + { + protofiles, err := filepath.Glob("*.proto") + check(err) + + protofiles = ignore(protofiles) + + overrideImports := ",Mgoogle/protobuf/timestamp.proto=" + *mainpkg + args := []string{ + "--lint_out=.", + "--gogo_out=paths=source_relative" + overrideImports + ":.", + "--go-drpc_out=protolib=github.com/gogo/protobuf,paths=source_relative:.", + "-I=.", + } + args = append(args, protofiles...) + + // generate new code + cmd := exec.Command(*protoc, args...) + fmt.Println(strings.Join(cmd.Args, " ")) + out, err := cmd.CombinedOutput() + if len(out) > 0 { + fmt.Println(string(out)) + } + check(err) + } + + { + files, err := filepath.Glob("*.pb.go") + check(err) + for _, file := range files { + process(file) + } + } + + { + // format code to get rid of extra imports + out, err := exec.Command("goimports", "-local", "storj.io", "-w", ".").CombinedOutput() + if len(out) > 0 { + fmt.Println(string(out)) + } + check(err) + } +} + +func process(file string) { + data, err := ioutil.ReadFile(file) + check(err) + + source := string(data) + + // When generating code to the same path as proto, it will + // end up generating an `import _ "."`, the following replace removes it. + source = strings.Replace(source, `_ "."`, "", -1) + + err = ioutil.WriteFile(file, []byte(source), 0644) + check(err) +} + +func check(err error) { + if err != nil { + panic(err) + } +} diff --git a/certificate/endpoint.go b/certificate/endpoint.go index d05de2363..093dad302 100644 --- a/certificate/endpoint.go +++ b/certificate/endpoint.go @@ -9,16 +9,16 @@ import ( "go.uber.org/zap" "storj.io/common/identity" - "storj.io/common/pb" "storj.io/common/rpc/rpcpeer" "storj.io/common/rpc/rpcstatus" "storj.io/storj/certificate/authorization" + "storj.io/storj/certificate/certificatepb" "storj.io/storj/certificate/rpcerrs" ) // Endpoint implements pb.CertificatesServer. type Endpoint struct { - pb.DRPCCertificatesUnimplementedServer + certificatepb.DRPCCertificatesUnimplementedServer rpclog *rpcerrs.Log log *zap.Logger @@ -47,7 +47,7 @@ func NewEndpoint(log *zap.Logger, ca *identity.FullCertificateAuthority, authori // Sign signs the CA certificate of the remote peer's identity with the `certs.ca` certificate. // Returns a certificate chain consisting of the remote peer's CA followed by the CA chain. -func (endpoint Endpoint) Sign(ctx context.Context, req *pb.SigningRequest) (_ *pb.SigningResponse, err error) { +func (endpoint Endpoint) Sign(ctx context.Context, req *certificatepb.SigningRequest) (_ *certificatepb.SigningResponse, err error) { defer mon.Task()(&ctx)(&err) peer, err := rpcpeer.FromContext(ctx) if err != nil { @@ -99,7 +99,7 @@ func (endpoint Endpoint) Sign(ctx context.Context, req *pb.SigningRequest) (_ *p zap.Stringer("truncated token", tokenFormatter), ) - return &pb.SigningResponse{ + return &certificatepb.SigningResponse{ Chain: signedChainBytes, }, nil } diff --git a/certificate/peer.go b/certificate/peer.go index 92418277c..3ad820bff 100644 --- a/certificate/peer.go +++ b/certificate/peer.go @@ -14,9 +14,9 @@ import ( "storj.io/common/errs2" "storj.io/common/identity" - "storj.io/common/pb" "storj.io/common/peertls/tlsopts" "storj.io/storj/certificate/authorization" + "storj.io/storj/certificate/certificatepb" "storj.io/storj/pkg/revocation" "storj.io/storj/pkg/server" ) @@ -85,7 +85,7 @@ func New(log *zap.Logger, ident *identity.FullIdentity, ca *identity.FullCertifi peer.AuthorizationDB = authorizationDB peer.Certificate.Endpoint = NewEndpoint(log.Named("certificate"), ca, authorizationDB, uint16(config.MinDifficulty)) - if err := pb.DRPCRegisterCertificates(peer.Server.DRPC(), peer.Certificate.Endpoint); err != nil { + if err := certificatepb.DRPCRegisterCertificates(peer.Server.DRPC(), peer.Certificate.Endpoint); err != nil { return nil, Error.Wrap(errs.Combine(err, peer.Close())) } diff --git a/certificate/peer_test.go b/certificate/peer_test.go index 6d2ee07c7..258486dc7 100644 --- a/certificate/peer_test.go +++ b/certificate/peer_test.go @@ -16,7 +16,6 @@ import ( "storj.io/common/identity" "storj.io/common/identity/testidentity" - "storj.io/common/pb" "storj.io/common/peertls/tlsopts" "storj.io/common/pkcrypto" "storj.io/common/rpc" @@ -26,6 +25,7 @@ import ( "storj.io/storj/certificate" "storj.io/storj/certificate/authorization" "storj.io/storj/certificate/certificateclient" + "storj.io/storj/certificate/certificatepb" "storj.io/storj/pkg/server" ) @@ -172,7 +172,7 @@ func TestCertificateSigner_Sign(t *testing.T) { peerCtx := rpcpeer.NewContext(ctx, peer) certSigner := certificate.NewEndpoint(zaptest.NewLogger(t), ca, authDB, 0) - req := pb.SigningRequest{ + req := certificatepb.SigningRequest{ Timestamp: time.Now().Unix(), AuthToken: auths[0].Token.String(), } diff --git a/proto.lock b/proto.lock new file mode 100644 index 000000000..2669762d3 --- /dev/null +++ b/proto.lock @@ -0,0 +1,880 @@ +{ + "definitions": [ + { + "protopath": "certificate:/:certificatepb:/:certificate.proto", + "def": { + "messages": [ + { + "name": "SigningRequest", + "fields": [ + { + "id": 1, + "name": "auth_token", + "type": "string" + }, + { + "id": 2, + "name": "timestamp", + "type": "int32" + } + ] + }, + { + "name": "SigningResponse", + "fields": [ + { + "id": 1, + "name": "chain", + "type": "bytes", + "is_repeated": true + } + ] + } + ], + "services": [ + { + "name": "Certificates", + "rpcs": [ + { + "name": "Sign", + "in_type": "SigningRequest", + "out_type": "SigningResponse" + } + ] + } + ], + "package": { + "name": "node" + }, + "options": [ + { + "name": "go_package", + "value": "storj.io/storj/certificate/certificatepb" + } + ] + } + }, + { + "protopath": "private:/:multinodepb:/:gogo.proto", + "def": { + "messages": [ + { + "name": "google.protobuf.EnumOptions", + "fields": [ + { + "id": 62001, + "name": "goproto_enum_prefix", + "type": "bool" + }, + { + "id": 62021, + "name": "goproto_enum_stringer", + "type": "bool" + }, + { + "id": 62022, + "name": "enum_stringer", + "type": "bool" + }, + { + "id": 62023, + "name": "enum_customname", + "type": "string" + }, + { + "id": 62024, + "name": "enumdecl", + "type": "bool" + } + ] + }, + { + "name": "google.protobuf.EnumValueOptions", + "fields": [ + { + "id": 66001, + "name": "enumvalue_customname", + "type": "string" + } + ] + }, + { + "name": "google.protobuf.FileOptions", + "fields": [ + { + "id": 63001, + "name": "goproto_getters_all", + "type": "bool" + }, + { + "id": 63002, + "name": "goproto_enum_prefix_all", + "type": "bool" + }, + { + "id": 63003, + "name": "goproto_stringer_all", + "type": "bool" + }, + { + "id": 63004, + "name": "verbose_equal_all", + "type": "bool" + }, + { + "id": 63005, + "name": "face_all", + "type": "bool" + }, + { + "id": 63006, + "name": "gostring_all", + "type": "bool" + }, + { + "id": 63007, + "name": "populate_all", + "type": "bool" + }, + { + "id": 63008, + "name": "stringer_all", + "type": "bool" + }, + { + "id": 63009, + "name": "onlyone_all", + "type": "bool" + }, + { + "id": 63013, + "name": "equal_all", + "type": "bool" + }, + { + "id": 63014, + "name": "description_all", + "type": "bool" + }, + { + "id": 63015, + "name": "testgen_all", + "type": "bool" + }, + { + "id": 63016, + "name": "benchgen_all", + "type": "bool" + }, + { + "id": 63017, + "name": "marshaler_all", + "type": "bool" + }, + { + "id": 63018, + "name": "unmarshaler_all", + "type": "bool" + }, + { + "id": 63019, + "name": "stable_marshaler_all", + "type": "bool" + }, + { + "id": 63020, + "name": "sizer_all", + "type": "bool" + }, + { + "id": 63021, + "name": "goproto_enum_stringer_all", + "type": "bool" + }, + { + "id": 63022, + "name": "enum_stringer_all", + "type": "bool" + }, + { + "id": 63023, + "name": "unsafe_marshaler_all", + "type": "bool" + }, + { + "id": 63024, + "name": "unsafe_unmarshaler_all", + "type": "bool" + }, + { + "id": 63025, + "name": "goproto_extensions_map_all", + "type": "bool" + }, + { + "id": 63026, + "name": "goproto_unrecognized_all", + "type": "bool" + }, + { + "id": 63027, + "name": "gogoproto_import", + "type": "bool" + }, + { + "id": 63028, + "name": "protosizer_all", + "type": "bool" + }, + { + "id": 63029, + "name": "compare_all", + "type": "bool" + }, + { + "id": 63030, + "name": "typedecl_all", + "type": "bool" + }, + { + "id": 63031, + "name": "enumdecl_all", + "type": "bool" + }, + { + "id": 63032, + "name": "goproto_registration", + "type": "bool" + }, + { + "id": 63033, + "name": "messagename_all", + "type": "bool" + }, + { + "id": 63034, + "name": "goproto_sizecache_all", + "type": "bool" + }, + { + "id": 63035, + "name": "goproto_unkeyed_all", + "type": "bool" + } + ] + }, + { + "name": "google.protobuf.MessageOptions", + "fields": [ + { + "id": 64001, + "name": "goproto_getters", + "type": "bool" + }, + { + "id": 64003, + "name": "goproto_stringer", + "type": "bool" + }, + { + "id": 64004, + "name": "verbose_equal", + "type": "bool" + }, + { + "id": 64005, + "name": "face", + "type": "bool" + }, + { + "id": 64006, + "name": "gostring", + "type": "bool" + }, + { + "id": 64007, + "name": "populate", + "type": "bool" + }, + { + "id": 67008, + "name": "stringer", + "type": "bool" + }, + { + "id": 64009, + "name": "onlyone", + "type": "bool" + }, + { + "id": 64013, + "name": "equal", + "type": "bool" + }, + { + "id": 64014, + "name": "description", + "type": "bool" + }, + { + "id": 64015, + "name": "testgen", + "type": "bool" + }, + { + "id": 64016, + "name": "benchgen", + "type": "bool" + }, + { + "id": 64017, + "name": "marshaler", + "type": "bool" + }, + { + "id": 64018, + "name": "unmarshaler", + "type": "bool" + }, + { + "id": 64019, + "name": "stable_marshaler", + "type": "bool" + }, + { + "id": 64020, + "name": "sizer", + "type": "bool" + }, + { + "id": 64023, + "name": "unsafe_marshaler", + "type": "bool" + }, + { + "id": 64024, + "name": "unsafe_unmarshaler", + "type": "bool" + }, + { + "id": 64025, + "name": "goproto_extensions_map", + "type": "bool" + }, + { + "id": 64026, + "name": "goproto_unrecognized", + "type": "bool" + }, + { + "id": 64028, + "name": "protosizer", + "type": "bool" + }, + { + "id": 64030, + "name": "typedecl", + "type": "bool" + }, + { + "id": 64033, + "name": "messagename", + "type": "bool" + }, + { + "id": 64034, + "name": "goproto_sizecache", + "type": "bool" + }, + { + "id": 64035, + "name": "goproto_unkeyed", + "type": "bool" + } + ] + }, + { + "name": "google.protobuf.FieldOptions", + "fields": [ + { + "id": 65001, + "name": "nullable", + "type": "bool" + }, + { + "id": 65002, + "name": "embed", + "type": "bool" + }, + { + "id": 65003, + "name": "customtype", + "type": "string" + }, + { + "id": 65004, + "name": "customname", + "type": "string" + }, + { + "id": 65005, + "name": "jsontag", + "type": "string" + }, + { + "id": 65006, + "name": "moretags", + "type": "string" + }, + { + "id": 65007, + "name": "casttype", + "type": "string" + }, + { + "id": 65008, + "name": "castkey", + "type": "string" + }, + { + "id": 65009, + "name": "castvalue", + "type": "string" + }, + { + "id": 65010, + "name": "stdtime", + "type": "bool" + }, + { + "id": 65011, + "name": "stdduration", + "type": "bool" + }, + { + "id": 65012, + "name": "wktpointer", + "type": "bool" + }, + { + "id": 65013, + "name": "compare", + "type": "bool" + } + ] + } + ], + "imports": [ + { + "path": "google/protobuf/descriptor.proto" + } + ], + "package": { + "name": "gogoproto" + }, + "options": [ + { + "name": "java_package", + "value": "com.google.protobuf" + }, + { + "name": "java_outer_classname", + "value": "GoGoProtos" + } + ] + } + }, + { + "protopath": "private:/:multinodepb:/:multinode.proto", + "def": { + "messages": [ + { + "name": "RequestHeader", + "fields": [ + { + "id": 1, + "name": "api_key", + "type": "bytes" + } + ] + }, + { + "name": "DiskSpaceRequest", + "fields": [ + { + "id": 1, + "name": "header", + "type": "RequestHeader" + } + ] + }, + { + "name": "DiskSpaceResponse", + "fields": [ + { + "id": 1, + "name": "allocated", + "type": "int64" + }, + { + "id": 2, + "name": "used_pieces", + "type": "int64" + }, + { + "id": 3, + "name": "used_trash", + "type": "int64" + }, + { + "id": 4, + "name": "free", + "type": "int64" + }, + { + "id": 5, + "name": "available", + "type": "int64" + }, + { + "id": 6, + "name": "overused", + "type": "int64" + } + ] + }, + { + "name": "BandwidthMonthSummaryRequest", + "fields": [ + { + "id": 1, + "name": "header", + "type": "RequestHeader" + } + ] + }, + { + "name": "BandwidthMonthSummaryResponse", + "fields": [ + { + "id": 1, + "name": "used", + "type": "int64" + } + ] + }, + { + "name": "VersionRequest", + "fields": [ + { + "id": 1, + "name": "header", + "type": "RequestHeader" + } + ] + }, + { + "name": "VersionResponse", + "fields": [ + { + "id": 1, + "name": "version", + "type": "string" + } + ] + }, + { + "name": "LastContactRequest", + "fields": [ + { + "id": 1, + "name": "header", + "type": "RequestHeader" + } + ] + }, + { + "name": "LastContactResponse", + "fields": [ + { + "id": 1, + "name": "last_contact", + "type": "google.protobuf.Timestamp", + "options": [ + { + "name": "(gogoproto.stdtime)", + "value": "true" + }, + { + "name": "(gogoproto.nullable)", + "value": "false" + } + ] + } + ] + }, + { + "name": "ReputationRequest", + "fields": [ + { + "id": 1, + "name": "header", + "type": "RequestHeader" + }, + { + "id": 2, + "name": "satellite_id", + "type": "bytes", + "options": [ + { + "name": "(gogoproto.customtype)", + "value": "NodeID" + }, + { + "name": "(gogoproto.nullable)", + "value": "false" + } + ] + } + ] + }, + { + "name": "ReputationResponse", + "fields": [ + { + "id": 1, + "name": "online", + "type": "Online" + }, + { + "id": 2, + "name": "audit", + "type": "Audit" + } + ], + "messages": [ + { + "name": "Online", + "fields": [ + { + "id": 1, + "name": "score", + "type": "double" + } + ] + }, + { + "name": "Audit", + "fields": [ + { + "id": 1, + "name": "score", + "type": "double" + }, + { + "id": 2, + "name": "suspension_score", + "type": "double" + } + ] + } + ] + }, + { + "name": "TrustedSatellitesRequest", + "fields": [ + { + "id": 1, + "name": "header", + "type": "RequestHeader" + } + ] + }, + { + "name": "TrustedSatellitesResponse", + "fields": [ + { + "id": 1, + "name": "trusted_satellites", + "type": "NodeURL", + "is_repeated": true + } + ], + "messages": [ + { + "name": "NodeURL", + "fields": [ + { + "id": 1, + "name": "node_id", + "type": "bytes", + "options": [ + { + "name": "(gogoproto.customtype)", + "value": "NodeID" + }, + { + "name": "(gogoproto.nullable)", + "value": "false" + } + ] + }, + { + "id": 2, + "name": "address", + "type": "string" + } + ] + } + ] + }, + { + "name": "EarnedRequest", + "fields": [ + { + "id": 1, + "name": "header", + "type": "RequestHeader" + } + ] + }, + { + "name": "EarnedResponse", + "fields": [ + { + "id": 1, + "name": "total", + "type": "int64" + } + ] + }, + { + "name": "EarnedPerSatelliteRequest", + "fields": [ + { + "id": 1, + "name": "header", + "type": "RequestHeader" + } + ] + }, + { + "name": "EarnedPerSatelliteResponse", + "fields": [ + { + "id": 1, + "name": "earned_satellite", + "type": "EarnedSatellite", + "is_repeated": true + } + ] + }, + { + "name": "EarnedSatellite", + "fields": [ + { + "id": 1, + "name": "total", + "type": "int64" + }, + { + "id": 2, + "name": "satellite_id", + "type": "bytes", + "options": [ + { + "name": "(gogoproto.customtype)", + "value": "NodeID" + }, + { + "name": "(gogoproto.nullable)", + "value": "false" + } + ] + } + ] + } + ], + "services": [ + { + "name": "Storage", + "rpcs": [ + { + "name": "DiskSpace", + "in_type": "DiskSpaceRequest", + "out_type": "DiskSpaceResponse" + } + ] + }, + { + "name": "Bandwidth", + "rpcs": [ + { + "name": "MonthSummary", + "in_type": "BandwidthMonthSummaryRequest", + "out_type": "BandwidthMonthSummaryResponse" + } + ] + }, + { + "name": "Node", + "rpcs": [ + { + "name": "Version", + "in_type": "VersionRequest", + "out_type": "VersionResponse" + }, + { + "name": "LastContact", + "in_type": "LastContactRequest", + "out_type": "LastContactResponse" + }, + { + "name": "Reputation", + "in_type": "ReputationRequest", + "out_type": "ReputationResponse" + }, + { + "name": "TrustedSatellites", + "in_type": "TrustedSatellitesRequest", + "out_type": "TrustedSatellitesResponse" + } + ] + }, + { + "name": "Payout", + "rpcs": [ + { + "name": "Earned", + "in_type": "EarnedRequest", + "out_type": "EarnedResponse" + }, + { + "name": "EarnedPerSatellite", + "in_type": "EarnedPerSatelliteRequest", + "out_type": "EarnedPerSatelliteResponse" + } + ] + } + ], + "imports": [ + { + "path": "gogo.proto" + }, + { + "path": "google/protobuf/timestamp.proto" + } + ], + "package": { + "name": "multinode" + }, + "options": [ + { + "name": "go_package", + "value": "storj.io/storj/private/multinodepb" + } + ] + } + } + ] +} \ No newline at end of file