From 2642433ceaa6e9597faa72ddeca4c3dfd5089de6 Mon Sep 17 00:00:00 2001 From: gammazero <11790789+gammazero@users.noreply.github.com> Date: Mon, 10 Feb 2025 16:47:01 -1000 Subject: [PATCH 1/3] Move ipld/unixfs from gogo protobuf --- ipld/unixfs/pb/Makefile | 11 - ipld/unixfs/pb/gen.go | 20 ++ ipld/unixfs/pb/unixfs.pb.go | 467 +++++++++++++++++++++--------------- ipld/unixfs/pb/unixfs.proto | 4 +- ipld/unixfs/unixfs.go | 2 +- ipld/unixfs/unixfs_test.go | 2 +- 6 files changed, 301 insertions(+), 205 deletions(-) delete mode 100644 ipld/unixfs/pb/Makefile create mode 100644 ipld/unixfs/pb/gen.go diff --git a/ipld/unixfs/pb/Makefile b/ipld/unixfs/pb/Makefile deleted file mode 100644 index 51552a096..000000000 --- a/ipld/unixfs/pb/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -PB = $(wildcard *.proto) -GO = $(PB:.proto=.pb.go) - -all: $(GO) - -%.pb.go: %.proto - protoc --proto_path=$(GOPATH)/src:. --gogo_out=. $< - -clean: - rm -f *.pb.go - rm -f *.go diff --git a/ipld/unixfs/pb/gen.go b/ipld/unixfs/pb/gen.go new file mode 100644 index 000000000..3c6995e6c --- /dev/null +++ b/ipld/unixfs/pb/gen.go @@ -0,0 +1,20 @@ +// These commands work around namespace conflicts that occur when multiple +// repositories depend on .proto files with generic filenames. Due to the way +// protobuf registers files (e.g., foo.proto or pb/foo.proto), naming +// collisions can occur when the same filename is used across different +// packages. +// +// The only way to generate a *.pb.go file that includes the full package path +// (e.g., github.com/org/repo/pb/foo.proto) is to place the .proto file in a +// directory structure that mirrors its package path. +// +// References: +// - https://protobuf.dev/reference/go/faq#namespace-conflict +// - https://github.com/golang/protobuf/issues/1122#issuecomment-2045945265 +// +//go:generate mkdir -p github.com/ipfs/boxo/ipld/unixfs/pb +//go:generate ln -f unixfs.proto github.com/ipfs/boxo/ipld/unixfs/pb/ +//go:generate protoc --go_out=. github.com/ipfs/boxo/ipld/unixfs/pb/unixfs.proto +//go:generate mv -f github.com/ipfs/boxo/ipld/unixfs/pb/unixfs.pb.go . +//go:generate rm -rf github.com +package pb diff --git a/ipld/unixfs/pb/unixfs.pb.go b/ipld/unixfs/pb/unixfs.pb.go index d02e110f2..1da20ed0d 100644 --- a/ipld/unixfs/pb/unixfs.pb.go +++ b/ipld/unixfs/pb/unixfs.pb.go @@ -1,28 +1,25 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: unixfs.proto +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.3 +// protoc v5.29.3 +// source: github.com/ipfs/boxo/ipld/unixfs/pb/unixfs.proto -package unixfs_pb +package pb import ( - fmt "fmt" - math "math" - - proto "github.com/gogo/protobuf/proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var ( - _ = proto.Marshal - _ = fmt.Errorf - _ = math.Inf +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// 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 Data_DataType int32 const ( @@ -34,23 +31,25 @@ const ( Data_HAMTShard Data_DataType = 5 ) -var Data_DataType_name = map[int32]string{ - 0: "Raw", - 1: "Directory", - 2: "File", - 3: "Metadata", - 4: "Symlink", - 5: "HAMTShard", -} - -var Data_DataType_value = map[string]int32{ - "Raw": 0, - "Directory": 1, - "File": 2, - "Metadata": 3, - "Symlink": 4, - "HAMTShard": 5, -} +// Enum value maps for Data_DataType. +var ( + Data_DataType_name = map[int32]string{ + 0: "Raw", + 1: "Directory", + 2: "File", + 3: "Metadata", + 4: "Symlink", + 5: "HAMTShard", + } + Data_DataType_value = map[string]int32{ + "Raw": 0, + "Directory": 1, + "File": 2, + "Metadata": 3, + "Symlink": 4, + "HAMTShard": 5, + } +) func (x Data_DataType) Enum() *Data_DataType { p := new(Data_DataType) @@ -59,160 +58,176 @@ func (x Data_DataType) Enum() *Data_DataType { } func (x Data_DataType) String() string { - return proto.EnumName(Data_DataType_name, int32(x)) -} - -func (x *Data_DataType) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(Data_DataType_value, data, "Data_DataType") - if err != nil { - return err - } - *x = Data_DataType(value) - return nil + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } -func (Data_DataType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_e2fd76cc44dfc7c3, []int{0, 0} +func (Data_DataType) Descriptor() protoreflect.EnumDescriptor { + return file_github.com_ipfs_boxo_ipld_unixfs_pb_unixfs_proto_enumTypes[0].Descriptor() } -type Data struct { - Type *Data_DataType `protobuf:"varint,1,req,name=Type,enum=unixfs.v1.pb.Data_DataType" json:"Type,omitempty"` - Data []byte `protobuf:"bytes,2,opt,name=Data" json:"Data,omitempty"` - Filesize *uint64 `protobuf:"varint,3,opt,name=filesize" json:"filesize,omitempty"` - Blocksizes []uint64 `protobuf:"varint,4,rep,name=blocksizes" json:"blocksizes,omitempty"` - HashType *uint64 `protobuf:"varint,5,opt,name=hashType" json:"hashType,omitempty"` - Fanout *uint64 `protobuf:"varint,6,opt,name=fanout" json:"fanout,omitempty"` - Mode *uint32 `protobuf:"varint,7,opt,name=mode" json:"mode,omitempty"` - Mtime *IPFSTimestamp `protobuf:"bytes,8,opt,name=mtime" json:"mtime,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Data) Reset() { *m = Data{} } -func (m *Data) String() string { return proto.CompactTextString(m) } -func (*Data) ProtoMessage() {} -func (*Data) Descriptor() ([]byte, []int) { - return fileDescriptor_e2fd76cc44dfc7c3, []int{0} +func (Data_DataType) Type() protoreflect.EnumType { + return &file_github.com_ipfs_boxo_ipld_unixfs_pb_unixfs_proto_enumTypes[0] } -func (m *Data) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Data.Unmarshal(m, b) +func (x Data_DataType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) } -func (m *Data) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Data.Marshal(b, m, deterministic) +// Deprecated: Do not use. +func (x *Data_DataType) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = Data_DataType(num) + return nil } -func (m *Data) XXX_Merge(src proto.Message) { - xxx_messageInfo_Data.Merge(m, src) +// Deprecated: Use Data_DataType.Descriptor instead. +func (Data_DataType) EnumDescriptor() ([]byte, []int) { + return file_github.com_ipfs_boxo_ipld_unixfs_pb_unixfs_proto_rawDescGZIP(), []int{0, 0} } -func (m *Data) XXX_Size() int { - return xxx_messageInfo_Data.Size(m) +type Data struct { + state protoimpl.MessageState `protogen:"open.v1"` + Type *Data_DataType `protobuf:"varint,1,req,name=Type,enum=github.amrom.workers.dev.boxo.ipld.unixfs.pb.Data_DataType" json:"Type,omitempty"` + Data []byte `protobuf:"bytes,2,opt,name=Data" json:"Data,omitempty"` + Filesize *uint64 `protobuf:"varint,3,opt,name=filesize" json:"filesize,omitempty"` + Blocksizes []uint64 `protobuf:"varint,4,rep,name=blocksizes" json:"blocksizes,omitempty"` + HashType *uint64 `protobuf:"varint,5,opt,name=hashType" json:"hashType,omitempty"` + Fanout *uint64 `protobuf:"varint,6,opt,name=fanout" json:"fanout,omitempty"` + Mode *uint32 `protobuf:"varint,7,opt,name=mode" json:"mode,omitempty"` + Mtime *IPFSTimestamp `protobuf:"bytes,8,opt,name=mtime" json:"mtime,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Data) Reset() { + *x = Data{} + mi := &file_github.com_ipfs_boxo_ipld_unixfs_pb_unixfs_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Data) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Data) ProtoMessage() {} + +func (x *Data) ProtoReflect() protoreflect.Message { + mi := &file_github.com_ipfs_boxo_ipld_unixfs_pb_unixfs_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -func (m *Data) XXX_DiscardUnknown() { - xxx_messageInfo_Data.DiscardUnknown(m) +// Deprecated: Use Data.ProtoReflect.Descriptor instead. +func (*Data) Descriptor() ([]byte, []int) { + return file_github.com_ipfs_boxo_ipld_unixfs_pb_unixfs_proto_rawDescGZIP(), []int{0} } -var xxx_messageInfo_Data proto.InternalMessageInfo - -func (m *Data) GetType() Data_DataType { - if m != nil && m.Type != nil { - return *m.Type +func (x *Data) GetType() Data_DataType { + if x != nil && x.Type != nil { + return *x.Type } return Data_Raw } -func (m *Data) GetData() []byte { - if m != nil { - return m.Data +func (x *Data) GetData() []byte { + if x != nil { + return x.Data } return nil } -func (m *Data) GetFilesize() uint64 { - if m != nil && m.Filesize != nil { - return *m.Filesize +func (x *Data) GetFilesize() uint64 { + if x != nil && x.Filesize != nil { + return *x.Filesize } return 0 } -func (m *Data) GetBlocksizes() []uint64 { - if m != nil { - return m.Blocksizes +func (x *Data) GetBlocksizes() []uint64 { + if x != nil { + return x.Blocksizes } return nil } -func (m *Data) GetHashType() uint64 { - if m != nil && m.HashType != nil { - return *m.HashType +func (x *Data) GetHashType() uint64 { + if x != nil && x.HashType != nil { + return *x.HashType } return 0 } -func (m *Data) GetFanout() uint64 { - if m != nil && m.Fanout != nil { - return *m.Fanout +func (x *Data) GetFanout() uint64 { + if x != nil && x.Fanout != nil { + return *x.Fanout } return 0 } -func (m *Data) GetMode() uint32 { - if m != nil && m.Mode != nil { - return *m.Mode +func (x *Data) GetMode() uint32 { + if x != nil && x.Mode != nil { + return *x.Mode } return 0 } -func (m *Data) GetMtime() *IPFSTimestamp { - if m != nil { - return m.Mtime +func (x *Data) GetMtime() *IPFSTimestamp { + if x != nil { + return x.Mtime } return nil } type Metadata struct { - MimeType *string `protobuf:"bytes,1,opt,name=MimeType" json:"MimeType,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState `protogen:"open.v1"` + MimeType *string `protobuf:"bytes,1,opt,name=MimeType" json:"MimeType,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *Metadata) Reset() { *m = Metadata{} } -func (m *Metadata) String() string { return proto.CompactTextString(m) } -func (*Metadata) ProtoMessage() {} -func (*Metadata) Descriptor() ([]byte, []int) { - return fileDescriptor_e2fd76cc44dfc7c3, []int{1} +func (x *Metadata) Reset() { + *x = Metadata{} + mi := &file_github.com_ipfs_boxo_ipld_unixfs_pb_unixfs_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *Metadata) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Metadata.Unmarshal(m, b) +func (x *Metadata) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *Metadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Metadata.Marshal(b, m, deterministic) -} - -func (m *Metadata) XXX_Merge(src proto.Message) { - xxx_messageInfo_Metadata.Merge(m, src) -} +func (*Metadata) ProtoMessage() {} -func (m *Metadata) XXX_Size() int { - return xxx_messageInfo_Metadata.Size(m) +func (x *Metadata) ProtoReflect() protoreflect.Message { + mi := &file_github.com_ipfs_boxo_ipld_unixfs_pb_unixfs_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -func (m *Metadata) XXX_DiscardUnknown() { - xxx_messageInfo_Metadata.DiscardUnknown(m) +// Deprecated: Use Metadata.ProtoReflect.Descriptor instead. +func (*Metadata) Descriptor() ([]byte, []int) { + return file_github.com_ipfs_boxo_ipld_unixfs_pb_unixfs_proto_rawDescGZIP(), []int{1} } -var xxx_messageInfo_Metadata proto.InternalMessageInfo - -func (m *Metadata) GetMimeType() string { - if m != nil && m.MimeType != nil { - return *m.MimeType +func (x *Metadata) GetMimeType() string { + if x != nil && x.MimeType != nil { + return *x.MimeType } return "" } @@ -220,6 +235,7 @@ func (m *Metadata) GetMimeType() string { // mostly copied from proto 3 - with int32 nanos changed to fixed32 for js-ipfs compatibility // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/timestamp.proto type IPFSTimestamp struct { + state protoimpl.MessageState `protogen:"open.v1"` // Represents seconds of UTC time since Unix epoch // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to // 9999-12-31T23:59:59Z inclusive. @@ -228,80 +244,151 @@ type IPFSTimestamp struct { // second values with fractions must still have non-negative nanos values // that count forward in time. Must be from 0 to 999,999,999 // inclusive. - Nanos *uint32 `protobuf:"fixed32,2,opt,name=nanos" json:"nanos,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Nanos *uint32 `protobuf:"fixed32,2,opt,name=nanos" json:"nanos,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *IPFSTimestamp) Reset() { *m = IPFSTimestamp{} } -func (m *IPFSTimestamp) String() string { return proto.CompactTextString(m) } -func (*IPFSTimestamp) ProtoMessage() {} -func (*IPFSTimestamp) Descriptor() ([]byte, []int) { - return fileDescriptor_e2fd76cc44dfc7c3, []int{2} -} -func (m *IPFSTimestamp) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_IPFSTimestamp.Unmarshal(m, b) -} -func (m *IPFSTimestamp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_IPFSTimestamp.Marshal(b, m, deterministic) +func (x *IPFSTimestamp) Reset() { + *x = IPFSTimestamp{} + mi := &file_github.com_ipfs_boxo_ipld_unixfs_pb_unixfs_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *IPFSTimestamp) XXX_Merge(src proto.Message) { - xxx_messageInfo_IPFSTimestamp.Merge(m, src) -} -func (m *IPFSTimestamp) XXX_Size() int { - return xxx_messageInfo_IPFSTimestamp.Size(m) + +func (x *IPFSTimestamp) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *IPFSTimestamp) XXX_DiscardUnknown() { - xxx_messageInfo_IPFSTimestamp.DiscardUnknown(m) + +func (*IPFSTimestamp) ProtoMessage() {} + +func (x *IPFSTimestamp) ProtoReflect() protoreflect.Message { + mi := &file_github.com_ipfs_boxo_ipld_unixfs_pb_unixfs_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_IPFSTimestamp proto.InternalMessageInfo +// Deprecated: Use IPFSTimestamp.ProtoReflect.Descriptor instead. +func (*IPFSTimestamp) Descriptor() ([]byte, []int) { + return file_github.com_ipfs_boxo_ipld_unixfs_pb_unixfs_proto_rawDescGZIP(), []int{2} +} -func (m *IPFSTimestamp) GetSeconds() int64 { - if m != nil && m.Seconds != nil { - return *m.Seconds +func (x *IPFSTimestamp) GetSeconds() int64 { + if x != nil && x.Seconds != nil { + return *x.Seconds } return 0 } -func (m *IPFSTimestamp) GetNanos() uint32 { - if m != nil && m.Nanos != nil { - return *m.Nanos +func (x *IPFSTimestamp) GetNanos() uint32 { + if x != nil && x.Nanos != nil { + return *x.Nanos } return 0 } -func init() { - proto.RegisterEnum("unixfs.v1.pb.Data_DataType", Data_DataType_name, Data_DataType_value) - proto.RegisterType((*Data)(nil), "unixfs.v1.pb.Data") - proto.RegisterType((*Metadata)(nil), "unixfs.v1.pb.Metadata") - proto.RegisterType((*IPFSTimestamp)(nil), "unixfs.pb.IPFSTimestamp") -} - -func init() { proto.RegisterFile("unixfs.proto", fileDescriptor_e2fd76cc44dfc7c3) } - -var fileDescriptor_e2fd76cc44dfc7c3 = []byte{ - // 322 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x91, 0x5f, 0x4b, 0xc3, 0x30, - 0x14, 0xc5, 0xed, 0xbf, 0xb5, 0xbb, 0xdb, 0xa4, 0x5c, 0x44, 0x82, 0x0f, 0x52, 0xfa, 0x20, 0x7d, - 0x90, 0x3e, 0xf8, 0x05, 0x44, 0x18, 0x43, 0x1f, 0x06, 0x92, 0x0d, 0xdf, 0xb3, 0x35, 0x63, 0x61, - 0x4d, 0x33, 0x9a, 0x0c, 0x9d, 0x9f, 0xd3, 0x0f, 0x24, 0x49, 0xd7, 0xe9, 0x5e, 0x4a, 0x7f, 0xb9, - 0xe7, 0x84, 0x73, 0x6e, 0x60, 0x7c, 0x68, 0xc4, 0xd7, 0x46, 0x97, 0xfb, 0x56, 0x19, 0x85, 0xc3, - 0x9e, 0x56, 0xf9, 0x8f, 0x0f, 0xe1, 0x94, 0x19, 0x86, 0x8f, 0x10, 0x2e, 0x8f, 0x7b, 0x4e, 0xbc, - 0xcc, 0x2f, 0xae, 0x9f, 0x48, 0x79, 0x96, 0x94, 0x76, 0xec, 0x3e, 0x76, 0x4e, 0x9d, 0x0a, 0xb1, - 0x73, 0x11, 0x3f, 0xf3, 0x8a, 0x31, 0xed, 0x6e, 0xb8, 0x83, 0x64, 0x23, 0x6a, 0xae, 0xc5, 0x37, - 0x27, 0x41, 0xe6, 0x15, 0x21, 0x3d, 0x33, 0xde, 0x03, 0xac, 0x6a, 0xb5, 0xde, 0x59, 0xd0, 0x24, - 0xcc, 0x82, 0x22, 0xa4, 0xff, 0x4e, 0xac, 0x77, 0xcb, 0xf4, 0xd6, 0x25, 0x88, 0x3a, 0x6f, 0xcf, - 0x78, 0x0b, 0x83, 0x0d, 0x6b, 0xd4, 0xc1, 0x90, 0x81, 0x9b, 0x9c, 0xc8, 0x66, 0x90, 0xaa, 0xe2, - 0x24, 0xce, 0xbc, 0x62, 0x42, 0xdd, 0x3f, 0x96, 0x10, 0x49, 0x23, 0x24, 0x27, 0x49, 0xe6, 0x15, - 0xa3, 0x8b, 0x1a, 0x6f, 0xef, 0xb3, 0xc5, 0x52, 0x48, 0xae, 0x0d, 0x93, 0x7b, 0xda, 0xc9, 0xf2, - 0x0f, 0x48, 0xfa, 0x66, 0x18, 0x43, 0x40, 0xd9, 0x67, 0x7a, 0x85, 0x13, 0x18, 0x4e, 0x45, 0xcb, - 0xd7, 0x46, 0xb5, 0xc7, 0xd4, 0xc3, 0x04, 0xc2, 0x99, 0xa8, 0x79, 0xea, 0xe3, 0x18, 0x92, 0x39, - 0x37, 0xac, 0x62, 0x86, 0xa5, 0x01, 0x8e, 0x20, 0x5e, 0x1c, 0x65, 0x2d, 0x9a, 0x5d, 0x1a, 0x5a, - 0xcf, 0xeb, 0xcb, 0x7c, 0xb9, 0xd8, 0xb2, 0xb6, 0x4a, 0xa3, 0xfc, 0xe1, 0x4f, 0x69, 0xbb, 0xcd, - 0x85, 0xe4, 0xa7, 0xed, 0x7a, 0xc5, 0x90, 0x9e, 0x39, 0x7f, 0x86, 0xc9, 0x45, 0x2e, 0x24, 0x10, - 0x6b, 0xbe, 0x56, 0x4d, 0xa5, 0xdd, 0x4b, 0x04, 0xb4, 0x47, 0xbc, 0x81, 0xa8, 0x61, 0x8d, 0xd2, - 0x6e, 0xe7, 0x31, 0xed, 0xe0, 0x37, 0x00, 0x00, 0xff, 0xff, 0x36, 0xaf, 0xfa, 0x7c, 0xd9, 0x01, - 0x00, 0x00, +var File_github.com_ipfs_boxo_ipld_unixfs_pb_unixfs_proto protoreflect.FileDescriptor + +var file_github.com_ipfs_boxo_ipld_unixfs_pb_unixfs_proto_rawDesc = []byte{ + 0x0a, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x70, 0x66, + 0x73, 0x2f, 0x62, 0x6f, 0x78, 0x6f, 0x2f, 0x69, 0x70, 0x6c, 0x64, 0x2f, 0x75, 0x6e, 0x69, 0x78, + 0x66, 0x73, 0x2f, 0x70, 0x62, 0x2f, 0x75, 0x6e, 0x69, 0x78, 0x66, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x1e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x62, + 0x6f, 0x78, 0x6f, 0x2e, 0x69, 0x70, 0x6c, 0x64, 0x2e, 0x75, 0x6e, 0x69, 0x78, 0x66, 0x73, 0x2e, + 0x70, 0x62, 0x22, 0xfe, 0x02, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61, 0x12, 0x41, 0x0a, 0x04, 0x54, + 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x02, 0x28, 0x0e, 0x32, 0x2d, 0x2e, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x6f, 0x78, 0x6f, 0x2e, 0x69, 0x70, 0x6c, 0x64, + 0x2e, 0x75, 0x6e, 0x69, 0x78, 0x66, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x2e, + 0x44, 0x61, 0x74, 0x61, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, + 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x44, 0x61, + 0x74, 0x61, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x69, 0x7a, 0x65, 0x12, 0x1e, + 0x0a, 0x0a, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x69, 0x7a, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, + 0x28, 0x04, 0x52, 0x0a, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x69, 0x7a, 0x65, 0x73, 0x12, 0x1a, + 0x0a, 0x08, 0x68, 0x61, 0x73, 0x68, 0x54, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x08, 0x68, 0x61, 0x73, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x61, + 0x6e, 0x6f, 0x75, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x66, 0x61, 0x6e, 0x6f, + 0x75, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x12, 0x43, 0x0a, 0x05, 0x6d, 0x74, 0x69, 0x6d, 0x65, 0x18, + 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2e, 0x62, 0x6f, 0x78, 0x6f, 0x2e, 0x69, 0x70, 0x6c, 0x64, 0x2e, 0x75, 0x6e, 0x69, + 0x78, 0x66, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x50, 0x46, 0x53, 0x54, 0x69, 0x6d, 0x65, 0x73, + 0x74, 0x61, 0x6d, 0x70, 0x52, 0x05, 0x6d, 0x74, 0x69, 0x6d, 0x65, 0x22, 0x56, 0x0a, 0x08, 0x44, + 0x61, 0x74, 0x61, 0x54, 0x79, 0x70, 0x65, 0x12, 0x07, 0x0a, 0x03, 0x52, 0x61, 0x77, 0x10, 0x00, + 0x12, 0x0d, 0x0a, 0x09, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x10, 0x01, 0x12, + 0x08, 0x0a, 0x04, 0x46, 0x69, 0x6c, 0x65, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x10, 0x03, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x79, 0x6d, 0x6c, 0x69, + 0x6e, 0x6b, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x48, 0x41, 0x4d, 0x54, 0x53, 0x68, 0x61, 0x72, + 0x64, 0x10, 0x05, 0x22, 0x26, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, + 0x1a, 0x0a, 0x08, 0x4d, 0x69, 0x6d, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x08, 0x4d, 0x69, 0x6d, 0x65, 0x54, 0x79, 0x70, 0x65, 0x22, 0x3f, 0x0a, 0x0d, 0x49, + 0x50, 0x46, 0x53, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x18, 0x0a, 0x07, + 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x01, 0x20, 0x02, 0x28, 0x03, 0x52, 0x07, 0x73, + 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x07, 0x52, 0x05, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x42, 0x25, 0x5a, 0x23, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x70, 0x66, 0x73, 0x2f, + 0x62, 0x6f, 0x78, 0x6f, 0x2f, 0x69, 0x70, 0x6c, 0x64, 0x2f, 0x75, 0x6e, 0x69, 0x78, 0x66, 0x73, + 0x2f, 0x70, 0x62, +} + +var ( + file_github.com_ipfs_boxo_ipld_unixfs_pb_unixfs_proto_rawDescOnce sync.Once + file_github.com_ipfs_boxo_ipld_unixfs_pb_unixfs_proto_rawDescData = file_github.com_ipfs_boxo_ipld_unixfs_pb_unixfs_proto_rawDesc +) + +func file_github.com_ipfs_boxo_ipld_unixfs_pb_unixfs_proto_rawDescGZIP() []byte { + file_github.com_ipfs_boxo_ipld_unixfs_pb_unixfs_proto_rawDescOnce.Do(func() { + file_github.com_ipfs_boxo_ipld_unixfs_pb_unixfs_proto_rawDescData = protoimpl.X.CompressGZIP(file_github.com_ipfs_boxo_ipld_unixfs_pb_unixfs_proto_rawDescData) + }) + return file_github.com_ipfs_boxo_ipld_unixfs_pb_unixfs_proto_rawDescData +} + +var file_github.com_ipfs_boxo_ipld_unixfs_pb_unixfs_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_github.com_ipfs_boxo_ipld_unixfs_pb_unixfs_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_github.com_ipfs_boxo_ipld_unixfs_pb_unixfs_proto_goTypes = []any{ + (Data_DataType)(0), // 0: github.amrom.workers.dev.boxo.ipld.unixfs.pb.Data.DataType + (*Data)(nil), // 1: github.amrom.workers.dev.boxo.ipld.unixfs.pb.Data + (*Metadata)(nil), // 2: github.amrom.workers.dev.boxo.ipld.unixfs.pb.Metadata + (*IPFSTimestamp)(nil), // 3: github.amrom.workers.dev.boxo.ipld.unixfs.pb.IPFSTimestamp +} +var file_github.com_ipfs_boxo_ipld_unixfs_pb_unixfs_proto_depIdxs = []int32{ + 0, // 0: github.amrom.workers.dev.boxo.ipld.unixfs.pb.Data.Type:type_name -> github.amrom.workers.dev.boxo.ipld.unixfs.pb.Data.DataType + 3, // 1: github.amrom.workers.dev.boxo.ipld.unixfs.pb.Data.mtime:type_name -> github.amrom.workers.dev.boxo.ipld.unixfs.pb.IPFSTimestamp + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_github.com_ipfs_boxo_ipld_unixfs_pb_unixfs_proto_init() } +func file_github.com_ipfs_boxo_ipld_unixfs_pb_unixfs_proto_init() { + if File_github.com_ipfs_boxo_ipld_unixfs_pb_unixfs_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_github.com_ipfs_boxo_ipld_unixfs_pb_unixfs_proto_rawDesc, + NumEnums: 1, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_github.com_ipfs_boxo_ipld_unixfs_pb_unixfs_proto_goTypes, + DependencyIndexes: file_github.com_ipfs_boxo_ipld_unixfs_pb_unixfs_proto_depIdxs, + EnumInfos: file_github.com_ipfs_boxo_ipld_unixfs_pb_unixfs_proto_enumTypes, + MessageInfos: file_github.com_ipfs_boxo_ipld_unixfs_pb_unixfs_proto_msgTypes, + }.Build() + File_github.com_ipfs_boxo_ipld_unixfs_pb_unixfs_proto = out.File + file_github.com_ipfs_boxo_ipld_unixfs_pb_unixfs_proto_rawDesc = nil + file_github.com_ipfs_boxo_ipld_unixfs_pb_unixfs_proto_goTypes = nil + file_github.com_ipfs_boxo_ipld_unixfs_pb_unixfs_proto_depIdxs = nil } diff --git a/ipld/unixfs/pb/unixfs.proto b/ipld/unixfs/pb/unixfs.proto index bd02aa410..29241c522 100644 --- a/ipld/unixfs/pb/unixfs.proto +++ b/ipld/unixfs/pb/unixfs.proto @@ -1,8 +1,8 @@ syntax = "proto2"; -package unixfs.v1.pb; +package github.amrom.workers.dev.boxo.ipld.unixfs.pb; -option go_package = "unixfs_pb"; +option go_package = "github.com/ipfs/boxo/ipld/unixfs/pb"; message Data { enum DataType { diff --git a/ipld/unixfs/unixfs.go b/ipld/unixfs/unixfs.go index 92c7671ce..3db4f540f 100644 --- a/ipld/unixfs/unixfs.go +++ b/ipld/unixfs/unixfs.go @@ -9,11 +9,11 @@ import ( "os" "time" - proto "github.com/gogo/protobuf/proto" files "github.com/ipfs/boxo/files" dag "github.com/ipfs/boxo/ipld/merkledag" pb "github.com/ipfs/boxo/ipld/unixfs/pb" ipld "github.com/ipfs/go-ipld-format" + "google.golang.org/protobuf/proto" ) // A LinkResult for any parallel enumeration of links diff --git a/ipld/unixfs/unixfs_test.go b/ipld/unixfs/unixfs_test.go index 2b5af0bfe..a3eeff48a 100644 --- a/ipld/unixfs/unixfs_test.go +++ b/ipld/unixfs/unixfs_test.go @@ -6,8 +6,8 @@ import ( "testing" "time" - proto "github.com/gogo/protobuf/proto" pb "github.com/ipfs/boxo/ipld/unixfs/pb" + "google.golang.org/protobuf/proto" ) func TestFSNode(t *testing.T) { From fb1df9070d968d95f7593e92aef0cd85224db4b9 Mon Sep 17 00:00:00 2001 From: gammazero <11790789+gammazero@users.noreply.github.com> Date: Mon, 10 Feb 2025 16:51:51 -1000 Subject: [PATCH 2/3] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 64de89251..f54204f3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ The following emojis are used to highlight certain changes: ### Changed - upgrade to `go-libp2p` [v0.39.0](https://github.com/libp2p/go-libp2p/releases/tag/v0.39.0) +- move `ipld/unixfs` from gogo protobuf [#804](https://github.com/ipfs/boxo/pull/840) ### Removed From 97711dc12a95ec3c066ddc2d9ea5581b357e2363 Mon Sep 17 00:00:00 2001 From: gammazero <11790789+gammazero@users.noreply.github.com> Date: Mon, 10 Feb 2025 17:08:35 -1000 Subject: [PATCH 3/3] update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f54204f3c..518149cd7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,7 +19,7 @@ The following emojis are used to highlight certain changes: ### Changed - upgrade to `go-libp2p` [v0.39.0](https://github.com/libp2p/go-libp2p/releases/tag/v0.39.0) -- move `ipld/unixfs` from gogo protobuf [#804](https://github.com/ipfs/boxo/pull/840) +- move `ipld/unixfs` from gogo protobuf [#840](https://github.com/ipfs/boxo/pull/840) ### Removed