From 02062d0a27abc9f0eda4c50d06334b37af64a97e Mon Sep 17 00:00:00 2001 From: Derek Nola Date: Thu, 9 Jan 2025 12:17:44 -0800 Subject: [PATCH 1/3] Define record.proto go_ package name - Use relative source to reduce static values Signed-off-by: Derek Nola --- ipns/pb/record.pb.go | 97 ++++++++++++++++++++++---------------------- ipns/pb/record.proto | 2 +- ipns/record.go | 2 +- 3 files changed, 51 insertions(+), 50 deletions(-) diff --git a/ipns/pb/record.pb.go b/ipns/pb/record.pb.go index f6eeeef89..fe5964818 100644 --- a/ipns/pb/record.pb.go +++ b/ipns/pb/record.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.35.1 -// protoc v5.28.2 +// protoc-gen-go v1.36.0 +// protoc v3.21.12 // source: record.proto package pb @@ -65,21 +65,20 @@ func (IpnsRecord_ValidityType) EnumDescriptor() ([]byte, []int) { // https://specs.ipfs.tech/ipns/ipns-record/#record-serialization-format type IpnsRecord struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + state protoimpl.MessageState `protogen:"open.v1"` // 1-6 are legacy fields used only in V1+V2 records Value []byte `protobuf:"bytes,1,opt,name=value,proto3,oneof" json:"value,omitempty"` SignatureV1 []byte `protobuf:"bytes,2,opt,name=signatureV1,proto3,oneof" json:"signatureV1,omitempty"` - ValidityType *IpnsRecord_ValidityType `protobuf:"varint,3,opt,name=validityType,proto3,enum=github.com.boxo.ipns.pb.IpnsRecord_ValidityType,oneof" json:"validityType,omitempty"` + ValidityType *IpnsRecord_ValidityType `protobuf:"varint,3,opt,name=validityType,proto3,enum=github.com.ipfs.boxo.ipns.pb.IpnsRecord_ValidityType,oneof" json:"validityType,omitempty"` Validity []byte `protobuf:"bytes,4,opt,name=validity,proto3,oneof" json:"validity,omitempty"` Sequence *uint64 `protobuf:"varint,5,opt,name=sequence,proto3,oneof" json:"sequence,omitempty"` Ttl *uint64 `protobuf:"varint,6,opt,name=ttl,proto3,oneof" json:"ttl,omitempty"` // 7-9 are V2 records - PubKey []byte `protobuf:"bytes,7,opt,name=pubKey,proto3,oneof" json:"pubKey,omitempty"` - SignatureV2 []byte `protobuf:"bytes,8,opt,name=signatureV2,proto3,oneof" json:"signatureV2,omitempty"` - Data []byte `protobuf:"bytes,9,opt,name=data,proto3,oneof" json:"data,omitempty"` + PubKey []byte `protobuf:"bytes,7,opt,name=pubKey,proto3,oneof" json:"pubKey,omitempty"` + SignatureV2 []byte `protobuf:"bytes,8,opt,name=signatureV2,proto3,oneof" json:"signatureV2,omitempty"` + Data []byte `protobuf:"bytes,9,opt,name=data,proto3,oneof" json:"data,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *IpnsRecord) Reset() { @@ -178,41 +177,43 @@ func (x *IpnsRecord) GetData() []byte { var File_record_proto protoreflect.FileDescriptor var file_record_proto_rawDesc = []byte{ - 0x0a, 0x0c, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x17, - 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x6f, 0x78, 0x6f, 0x2e, - 0x69, 0x70, 0x6e, 0x73, 0x2e, 0x70, 0x62, 0x22, 0xe9, 0x03, 0x0a, 0x0a, 0x49, 0x70, 0x6e, 0x73, - 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, - 0x01, 0x12, 0x25, 0x0a, 0x0b, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x56, 0x31, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x01, 0x52, 0x0b, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, - 0x75, 0x72, 0x65, 0x56, 0x31, 0x88, 0x01, 0x01, 0x12, 0x59, 0x0a, 0x0c, 0x76, 0x61, 0x6c, 0x69, - 0x64, 0x69, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x30, - 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x6f, 0x78, 0x6f, - 0x2e, 0x69, 0x70, 0x6e, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x70, 0x6e, 0x73, 0x52, 0x65, 0x63, - 0x6f, 0x72, 0x64, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x69, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, - 0x48, 0x02, 0x52, 0x0c, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x69, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, - 0x88, 0x01, 0x01, 0x12, 0x1f, 0x0a, 0x08, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x69, 0x74, 0x79, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x03, 0x52, 0x08, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x69, 0x74, - 0x79, 0x88, 0x01, 0x01, 0x12, 0x1f, 0x0a, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x48, 0x04, 0x52, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, - 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x15, 0x0a, 0x03, 0x74, 0x74, 0x6c, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x04, 0x48, 0x05, 0x52, 0x03, 0x74, 0x74, 0x6c, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, - 0x70, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x06, 0x52, 0x06, - 0x70, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x88, 0x01, 0x01, 0x12, 0x25, 0x0a, 0x0b, 0x73, 0x69, 0x67, - 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x56, 0x32, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x07, - 0x52, 0x0b, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x56, 0x32, 0x88, 0x01, 0x01, - 0x12, 0x17, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x08, - 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x88, 0x01, 0x01, 0x22, 0x17, 0x0a, 0x0c, 0x56, 0x61, 0x6c, - 0x69, 0x64, 0x69, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x07, 0x0a, 0x03, 0x45, 0x4f, 0x4c, - 0x10, 0x00, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x0e, 0x0a, 0x0c, - 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x56, 0x31, 0x42, 0x0f, 0x0a, 0x0d, - 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x69, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x42, 0x0b, 0x0a, - 0x09, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x69, 0x74, 0x79, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x73, - 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x06, 0x0a, 0x04, 0x5f, 0x74, 0x74, 0x6c, 0x42, - 0x09, 0x0a, 0x07, 0x5f, 0x70, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x73, - 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x56, 0x32, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x64, - 0x61, 0x74, 0x61, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x0a, 0x0c, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1c, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x69, 0x70, 0x66, 0x73, 0x2e, + 0x62, 0x6f, 0x78, 0x6f, 0x2e, 0x69, 0x70, 0x6e, 0x73, 0x2e, 0x70, 0x62, 0x22, 0xee, 0x03, 0x0a, + 0x0a, 0x49, 0x70, 0x6e, 0x73, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x19, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x25, 0x0a, 0x0b, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x56, 0x31, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x01, 0x52, 0x0b, 0x73, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x56, 0x31, 0x88, 0x01, 0x01, 0x12, 0x5e, 0x0a, + 0x0c, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x69, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x35, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2e, 0x69, 0x70, 0x66, 0x73, 0x2e, 0x62, 0x6f, 0x78, 0x6f, 0x2e, 0x69, 0x70, 0x6e, 0x73, 0x2e, + 0x70, 0x62, 0x2e, 0x49, 0x70, 0x6e, 0x73, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x56, 0x61, + 0x6c, 0x69, 0x64, 0x69, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x48, 0x02, 0x52, 0x0c, 0x76, 0x61, + 0x6c, 0x69, 0x64, 0x69, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1f, 0x0a, + 0x08, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x69, 0x74, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x48, + 0x03, 0x52, 0x08, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x69, 0x74, 0x79, 0x88, 0x01, 0x01, 0x12, 0x1f, + 0x0a, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, + 0x48, 0x04, 0x52, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, + 0x15, 0x0a, 0x03, 0x74, 0x74, 0x6c, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x48, 0x05, 0x52, 0x03, + 0x74, 0x74, 0x6c, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x70, 0x75, 0x62, 0x4b, 0x65, 0x79, + 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x06, 0x52, 0x06, 0x70, 0x75, 0x62, 0x4b, 0x65, 0x79, + 0x88, 0x01, 0x01, 0x12, 0x25, 0x0a, 0x0b, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x56, 0x32, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x07, 0x52, 0x0b, 0x73, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x56, 0x32, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x64, 0x61, + 0x74, 0x61, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x08, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, + 0x88, 0x01, 0x01, 0x22, 0x17, 0x0a, 0x0c, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x69, 0x74, 0x79, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x07, 0x0a, 0x03, 0x45, 0x4f, 0x4c, 0x10, 0x00, 0x42, 0x08, 0x0a, 0x06, + 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x56, 0x31, 0x42, 0x0f, 0x0a, 0x0d, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, + 0x69, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x76, 0x61, 0x6c, 0x69, + 0x64, 0x69, 0x74, 0x79, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, + 0x65, 0x42, 0x06, 0x0a, 0x04, 0x5f, 0x74, 0x74, 0x6c, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x70, 0x75, + 0x62, 0x4b, 0x65, 0x79, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, + 0x72, 0x65, 0x56, 0x32, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x42, 0x1e, 0x5a, + 0x1c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x70, 0x66, 0x73, + 0x2f, 0x62, 0x6f, 0x78, 0x6f, 0x2f, 0x69, 0x70, 0x6e, 0x73, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -230,11 +231,11 @@ func file_record_proto_rawDescGZIP() []byte { var file_record_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_record_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_record_proto_goTypes = []any{ - (IpnsRecord_ValidityType)(0), // 0: github.com.boxo.ipns.pb.IpnsRecord.ValidityType - (*IpnsRecord)(nil), // 1: github.com.boxo.ipns.pb.IpnsRecord + (IpnsRecord_ValidityType)(0), // 0: github.com.ipfs.boxo.ipns.pb.IpnsRecord.ValidityType + (*IpnsRecord)(nil), // 1: github.com.ipfs.boxo.ipns.pb.IpnsRecord } var file_record_proto_depIdxs = []int32{ - 0, // 0: github.com.boxo.ipns.pb.IpnsRecord.validityType:type_name -> github.com.boxo.ipns.pb.IpnsRecord.ValidityType + 0, // 0: github.com.ipfs.boxo.ipns.pb.IpnsRecord.validityType:type_name -> github.com.ipfs.boxo.ipns.pb.IpnsRecord.ValidityType 1, // [1:1] is the sub-list for method output_type 1, // [1:1] is the sub-list for method input_type 1, // [1:1] is the sub-list for extension type_name diff --git a/ipns/pb/record.proto b/ipns/pb/record.proto index 95a3b2e04..012844772 100644 --- a/ipns/pb/record.proto +++ b/ipns/pb/record.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package github.com.boxo.ipns.pb; -option go_package = ".;pb"; +option go_package = "github.com/ipfs/boxo/ipns"; // https://specs.ipfs.tech/ipns/ipns-record/#record-serialization-format message IpnsRecord { diff --git a/ipns/record.go b/ipns/record.go index ddb57ac42..f09565a8d 100644 --- a/ipns/record.go +++ b/ipns/record.go @@ -1,4 +1,4 @@ -//go:generate protoc -I=pb --go_out=pb pb/record.proto +//go:generate protoc -I=pb --go_out=paths=source_relative:pb pb/record.proto package ipns import ( From d39268a527a6e293b5fc2660ef07461a3e209b35 Mon Sep 17 00:00:00 2001 From: Derek Nola Date: Fri, 10 Jan 2025 12:36:13 -0800 Subject: [PATCH 2/3] Change record.proto to more unique ipns-record.proto Signed-off-by: Derek Nola --- ipns/pb/{record.pb.go => ipns-record.pb.go} | 135 ++++++++++---------- ipns/pb/{record.proto => ipns-record.proto} | 2 +- ipns/record.go | 2 +- 3 files changed, 69 insertions(+), 70 deletions(-) rename ipns/pb/{record.pb.go => ipns-record.pb.go} (53%) rename ipns/pb/{record.proto => ipns-record.proto} (91%) diff --git a/ipns/pb/record.pb.go b/ipns/pb/ipns-record.pb.go similarity index 53% rename from ipns/pb/record.pb.go rename to ipns/pb/ipns-record.pb.go index fe5964818..40ffa56ed 100644 --- a/ipns/pb/record.pb.go +++ b/ipns/pb/ipns-record.pb.go @@ -2,7 +2,7 @@ // versions: // protoc-gen-go v1.36.0 // protoc v3.21.12 -// source: record.proto +// source: ipns-record.proto package pb @@ -47,11 +47,11 @@ func (x IpnsRecord_ValidityType) String() string { } func (IpnsRecord_ValidityType) Descriptor() protoreflect.EnumDescriptor { - return file_record_proto_enumTypes[0].Descriptor() + return file_ipns_record_proto_enumTypes[0].Descriptor() } func (IpnsRecord_ValidityType) Type() protoreflect.EnumType { - return &file_record_proto_enumTypes[0] + return &file_ipns_record_proto_enumTypes[0] } func (x IpnsRecord_ValidityType) Number() protoreflect.EnumNumber { @@ -60,7 +60,7 @@ func (x IpnsRecord_ValidityType) Number() protoreflect.EnumNumber { // Deprecated: Use IpnsRecord_ValidityType.Descriptor instead. func (IpnsRecord_ValidityType) EnumDescriptor() ([]byte, []int) { - return file_record_proto_rawDescGZIP(), []int{0, 0} + return file_ipns_record_proto_rawDescGZIP(), []int{0, 0} } // https://specs.ipfs.tech/ipns/ipns-record/#record-serialization-format @@ -69,7 +69,7 @@ type IpnsRecord struct { // 1-6 are legacy fields used only in V1+V2 records Value []byte `protobuf:"bytes,1,opt,name=value,proto3,oneof" json:"value,omitempty"` SignatureV1 []byte `protobuf:"bytes,2,opt,name=signatureV1,proto3,oneof" json:"signatureV1,omitempty"` - ValidityType *IpnsRecord_ValidityType `protobuf:"varint,3,opt,name=validityType,proto3,enum=github.com.ipfs.boxo.ipns.pb.IpnsRecord_ValidityType,oneof" json:"validityType,omitempty"` + ValidityType *IpnsRecord_ValidityType `protobuf:"varint,3,opt,name=validityType,proto3,enum=github.com.boxo.ipns.pb.IpnsRecord_ValidityType,oneof" json:"validityType,omitempty"` Validity []byte `protobuf:"bytes,4,opt,name=validity,proto3,oneof" json:"validity,omitempty"` Sequence *uint64 `protobuf:"varint,5,opt,name=sequence,proto3,oneof" json:"sequence,omitempty"` Ttl *uint64 `protobuf:"varint,6,opt,name=ttl,proto3,oneof" json:"ttl,omitempty"` @@ -83,7 +83,7 @@ type IpnsRecord struct { func (x *IpnsRecord) Reset() { *x = IpnsRecord{} - mi := &file_record_proto_msgTypes[0] + mi := &file_ipns_record_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -95,7 +95,7 @@ func (x *IpnsRecord) String() string { func (*IpnsRecord) ProtoMessage() {} func (x *IpnsRecord) ProtoReflect() protoreflect.Message { - mi := &file_record_proto_msgTypes[0] + mi := &file_ipns_record_proto_msgTypes[0] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -108,7 +108,7 @@ func (x *IpnsRecord) ProtoReflect() protoreflect.Message { // Deprecated: Use IpnsRecord.ProtoReflect.Descriptor instead. func (*IpnsRecord) Descriptor() ([]byte, []int) { - return file_record_proto_rawDescGZIP(), []int{0} + return file_ipns_record_proto_rawDescGZIP(), []int{0} } func (x *IpnsRecord) GetValue() []byte { @@ -174,68 +174,67 @@ func (x *IpnsRecord) GetData() []byte { return nil } -var File_record_proto protoreflect.FileDescriptor +var File_ipns_record_proto protoreflect.FileDescriptor -var file_record_proto_rawDesc = []byte{ - 0x0a, 0x0c, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1c, - 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x69, 0x70, 0x66, 0x73, 0x2e, - 0x62, 0x6f, 0x78, 0x6f, 0x2e, 0x69, 0x70, 0x6e, 0x73, 0x2e, 0x70, 0x62, 0x22, 0xee, 0x03, 0x0a, +var file_ipns_record_proto_rawDesc = []byte{ + 0x0a, 0x11, 0x69, 0x70, 0x6e, 0x73, 0x2d, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x17, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, + 0x62, 0x6f, 0x78, 0x6f, 0x2e, 0x69, 0x70, 0x6e, 0x73, 0x2e, 0x70, 0x62, 0x22, 0xe9, 0x03, 0x0a, 0x0a, 0x49, 0x70, 0x6e, 0x73, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x25, 0x0a, 0x0b, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x56, 0x31, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x01, 0x52, 0x0b, 0x73, - 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x56, 0x31, 0x88, 0x01, 0x01, 0x12, 0x5e, 0x0a, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x56, 0x31, 0x88, 0x01, 0x01, 0x12, 0x59, 0x0a, 0x0c, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x69, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x35, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2e, 0x69, 0x70, 0x66, 0x73, 0x2e, 0x62, 0x6f, 0x78, 0x6f, 0x2e, 0x69, 0x70, 0x6e, 0x73, 0x2e, - 0x70, 0x62, 0x2e, 0x49, 0x70, 0x6e, 0x73, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x56, 0x61, - 0x6c, 0x69, 0x64, 0x69, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x48, 0x02, 0x52, 0x0c, 0x76, 0x61, - 0x6c, 0x69, 0x64, 0x69, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1f, 0x0a, - 0x08, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x69, 0x74, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x48, - 0x03, 0x52, 0x08, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x69, 0x74, 0x79, 0x88, 0x01, 0x01, 0x12, 0x1f, - 0x0a, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, - 0x48, 0x04, 0x52, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, - 0x15, 0x0a, 0x03, 0x74, 0x74, 0x6c, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x48, 0x05, 0x52, 0x03, - 0x74, 0x74, 0x6c, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x70, 0x75, 0x62, 0x4b, 0x65, 0x79, - 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x06, 0x52, 0x06, 0x70, 0x75, 0x62, 0x4b, 0x65, 0x79, - 0x88, 0x01, 0x01, 0x12, 0x25, 0x0a, 0x0b, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x56, 0x32, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x07, 0x52, 0x0b, 0x73, 0x69, 0x67, 0x6e, - 0x61, 0x74, 0x75, 0x72, 0x65, 0x56, 0x32, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x64, 0x61, - 0x74, 0x61, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x08, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, - 0x88, 0x01, 0x01, 0x22, 0x17, 0x0a, 0x0c, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x69, 0x74, 0x79, 0x54, - 0x79, 0x70, 0x65, 0x12, 0x07, 0x0a, 0x03, 0x45, 0x4f, 0x4c, 0x10, 0x00, 0x42, 0x08, 0x0a, 0x06, - 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, - 0x74, 0x75, 0x72, 0x65, 0x56, 0x31, 0x42, 0x0f, 0x0a, 0x0d, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, - 0x69, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x76, 0x61, 0x6c, 0x69, - 0x64, 0x69, 0x74, 0x79, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, - 0x65, 0x42, 0x06, 0x0a, 0x04, 0x5f, 0x74, 0x74, 0x6c, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x70, 0x75, - 0x62, 0x4b, 0x65, 0x79, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, - 0x72, 0x65, 0x56, 0x32, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x42, 0x1e, 0x5a, - 0x1c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x70, 0x66, 0x73, - 0x2f, 0x62, 0x6f, 0x78, 0x6f, 0x2f, 0x69, 0x70, 0x6e, 0x73, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x01, 0x28, 0x0e, 0x32, 0x30, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2e, 0x62, 0x6f, 0x78, 0x6f, 0x2e, 0x69, 0x70, 0x6e, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x70, + 0x6e, 0x73, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x69, 0x74, + 0x79, 0x54, 0x79, 0x70, 0x65, 0x48, 0x02, 0x52, 0x0c, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x69, 0x74, + 0x79, 0x54, 0x79, 0x70, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1f, 0x0a, 0x08, 0x76, 0x61, 0x6c, 0x69, + 0x64, 0x69, 0x74, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x03, 0x52, 0x08, 0x76, 0x61, + 0x6c, 0x69, 0x64, 0x69, 0x74, 0x79, 0x88, 0x01, 0x01, 0x12, 0x1f, 0x0a, 0x08, 0x73, 0x65, 0x71, + 0x75, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x48, 0x04, 0x52, 0x08, 0x73, + 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x15, 0x0a, 0x03, 0x74, 0x74, + 0x6c, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x48, 0x05, 0x52, 0x03, 0x74, 0x74, 0x6c, 0x88, 0x01, + 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x70, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, + 0x0c, 0x48, 0x06, 0x52, 0x06, 0x70, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x88, 0x01, 0x01, 0x12, 0x25, + 0x0a, 0x0b, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x56, 0x32, 0x18, 0x08, 0x20, + 0x01, 0x28, 0x0c, 0x48, 0x07, 0x52, 0x0b, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x56, 0x32, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x09, 0x20, + 0x01, 0x28, 0x0c, 0x48, 0x08, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x88, 0x01, 0x01, 0x22, 0x17, + 0x0a, 0x0c, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x69, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x07, + 0x0a, 0x03, 0x45, 0x4f, 0x4c, 0x10, 0x00, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x56, + 0x31, 0x42, 0x0f, 0x0a, 0x0d, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x69, 0x74, 0x79, 0x54, 0x79, + 0x70, 0x65, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x69, 0x74, 0x79, 0x42, + 0x0b, 0x0a, 0x09, 0x5f, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x06, 0x0a, 0x04, + 0x5f, 0x74, 0x74, 0x6c, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x70, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x42, + 0x0e, 0x0a, 0x0c, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x56, 0x32, 0x42, + 0x07, 0x0a, 0x05, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x42, 0x1e, 0x5a, 0x1c, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x70, 0x66, 0x73, 0x2f, 0x62, 0x6f, 0x78, 0x6f, + 0x2f, 0x69, 0x70, 0x6e, 0x73, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_record_proto_rawDescOnce sync.Once - file_record_proto_rawDescData = file_record_proto_rawDesc + file_ipns_record_proto_rawDescOnce sync.Once + file_ipns_record_proto_rawDescData = file_ipns_record_proto_rawDesc ) -func file_record_proto_rawDescGZIP() []byte { - file_record_proto_rawDescOnce.Do(func() { - file_record_proto_rawDescData = protoimpl.X.CompressGZIP(file_record_proto_rawDescData) +func file_ipns_record_proto_rawDescGZIP() []byte { + file_ipns_record_proto_rawDescOnce.Do(func() { + file_ipns_record_proto_rawDescData = protoimpl.X.CompressGZIP(file_ipns_record_proto_rawDescData) }) - return file_record_proto_rawDescData + return file_ipns_record_proto_rawDescData } -var file_record_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_record_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_record_proto_goTypes = []any{ - (IpnsRecord_ValidityType)(0), // 0: github.com.ipfs.boxo.ipns.pb.IpnsRecord.ValidityType - (*IpnsRecord)(nil), // 1: github.com.ipfs.boxo.ipns.pb.IpnsRecord +var file_ipns_record_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_ipns_record_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_ipns_record_proto_goTypes = []any{ + (IpnsRecord_ValidityType)(0), // 0: github.com.boxo.ipns.pb.IpnsRecord.ValidityType + (*IpnsRecord)(nil), // 1: github.com.boxo.ipns.pb.IpnsRecord } -var file_record_proto_depIdxs = []int32{ - 0, // 0: github.com.ipfs.boxo.ipns.pb.IpnsRecord.validityType:type_name -> github.com.ipfs.boxo.ipns.pb.IpnsRecord.ValidityType +var file_ipns_record_proto_depIdxs = []int32{ + 0, // 0: github.com.boxo.ipns.pb.IpnsRecord.validityType:type_name -> github.com.boxo.ipns.pb.IpnsRecord.ValidityType 1, // [1:1] is the sub-list for method output_type 1, // [1:1] is the sub-list for method input_type 1, // [1:1] is the sub-list for extension type_name @@ -243,29 +242,29 @@ var file_record_proto_depIdxs = []int32{ 0, // [0:1] is the sub-list for field type_name } -func init() { file_record_proto_init() } -func file_record_proto_init() { - if File_record_proto != nil { +func init() { file_ipns_record_proto_init() } +func file_ipns_record_proto_init() { + if File_ipns_record_proto != nil { return } - file_record_proto_msgTypes[0].OneofWrappers = []any{} + file_ipns_record_proto_msgTypes[0].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_record_proto_rawDesc, + RawDescriptor: file_ipns_record_proto_rawDesc, NumEnums: 1, NumMessages: 1, NumExtensions: 0, NumServices: 0, }, - GoTypes: file_record_proto_goTypes, - DependencyIndexes: file_record_proto_depIdxs, - EnumInfos: file_record_proto_enumTypes, - MessageInfos: file_record_proto_msgTypes, + GoTypes: file_ipns_record_proto_goTypes, + DependencyIndexes: file_ipns_record_proto_depIdxs, + EnumInfos: file_ipns_record_proto_enumTypes, + MessageInfos: file_ipns_record_proto_msgTypes, }.Build() - File_record_proto = out.File - file_record_proto_rawDesc = nil - file_record_proto_goTypes = nil - file_record_proto_depIdxs = nil + File_ipns_record_proto = out.File + file_ipns_record_proto_rawDesc = nil + file_ipns_record_proto_goTypes = nil + file_ipns_record_proto_depIdxs = nil } diff --git a/ipns/pb/record.proto b/ipns/pb/ipns-record.proto similarity index 91% rename from ipns/pb/record.proto rename to ipns/pb/ipns-record.proto index 012844772..260681a25 100644 --- a/ipns/pb/record.proto +++ b/ipns/pb/ipns-record.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package github.com.boxo.ipns.pb; -option go_package = "github.com/ipfs/boxo/ipns"; +option go_package = "github.com/ipfs/boxo/ipns/pb"; // https://specs.ipfs.tech/ipns/ipns-record/#record-serialization-format message IpnsRecord { diff --git a/ipns/record.go b/ipns/record.go index f09565a8d..147190a3b 100644 --- a/ipns/record.go +++ b/ipns/record.go @@ -1,4 +1,4 @@ -//go:generate protoc -I=pb --go_out=paths=source_relative:pb pb/record.proto +//go:generate protoc -I=pb --go_out=paths=source_relative:pb pb/ipns-record.proto package ipns import ( From 34a082c8e31462c5b61bfe6630a602397393c0bb Mon Sep 17 00:00:00 2001 From: guillaumemichel Date: Thu, 16 Jan 2025 11:37:10 +0100 Subject: [PATCH 3/3] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f1574d2c..3f98ac052 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ The following emojis are used to highlight certain changes: ### Fixed - `gateway` Fix redirect URLs for subdirectories with characters that need escaping. [#779](https://github.com/ipfs/boxo/pull/779) +- `ipns` Defined a `go_package` name in `ipns-record.proto` to avoid protobuf conflicts [#789](https://github.com/ipfs/boxo/pull/789) ### Security