@@ -47,19 +47,21 @@ var (
47
47
ErrInvalidEncoding = errors .New ("invalid base encoding" )
48
48
)
49
49
50
- // These are multicodec-packed content types. The should match
51
- // the codes described in the authoritative document:
52
- // https://github.com/multiformats/multicodec/blob/master/table.csv
50
+ // Consts below are DEPRECATED and left only for legacy reasons:
51
+ // <https://github.com/ipfs/go-cid/pull/137>
52
+ // Modern code should use consts from go-multicodec instead:
53
+ // <https://github.com/multiformats/go-multicodec>
53
54
const (
54
- Raw = 0x55
55
-
56
- DagProtobuf = 0x70
57
- DagCBOR = 0x71
58
- Libp2pKey = 0x72
59
-
60
- GitRaw = 0x78
61
-
62
- DagJOSE = 0x85
55
+ // common ones
56
+ Raw = 0x55
57
+ DagProtobuf = 0x70 // https://ipld.io/docs/codecs/known/dag-pb/
58
+ DagCBOR = 0x71 // https://ipld.io/docs/codecs/known/dag-cbor/
59
+ DagJSON = 0x0129 // https://ipld.io/docs/codecs/known/dag-json/
60
+ Libp2pKey = 0x72 // https://github.com/libp2p/specs/blob/master/peer-ids/peer-ids.md#peer-ids
61
+
62
+ // other
63
+ GitRaw = 0x78
64
+ DagJOSE = 0x85 // https://ipld.io/specs/codecs/dag-jose/spec/
63
65
EthBlock = 0x90
64
66
EthBlockList = 0x91
65
67
EthTxTrie = 0x92
@@ -81,64 +83,6 @@ const (
81
83
FilCommitmentSealed = 0xf102
82
84
)
83
85
84
- // Codecs maps the name of a codec to its type
85
- var Codecs = map [string ]uint64 {
86
- "v0" : DagProtobuf ,
87
- "raw" : Raw ,
88
- "protobuf" : DagProtobuf ,
89
- "cbor" : DagCBOR ,
90
- "libp2p-key" : Libp2pKey ,
91
- "git-raw" : GitRaw ,
92
- "eth-block" : EthBlock ,
93
- "eth-block-list" : EthBlockList ,
94
- "eth-tx-trie" : EthTxTrie ,
95
- "eth-tx" : EthTx ,
96
- "eth-tx-receipt-trie" : EthTxReceiptTrie ,
97
- "eth-tx-receipt" : EthTxReceipt ,
98
- "eth-state-trie" : EthStateTrie ,
99
- "eth-account-snapshot" : EthAccountSnapshot ,
100
- "eth-storage-trie" : EthStorageTrie ,
101
- "bitcoin-block" : BitcoinBlock ,
102
- "bitcoin-tx" : BitcoinTx ,
103
- "zcash-block" : ZcashBlock ,
104
- "zcash-tx" : ZcashTx ,
105
- "decred-block" : DecredBlock ,
106
- "decred-tx" : DecredTx ,
107
- "dash-block" : DashBlock ,
108
- "dash-tx" : DashTx ,
109
- "fil-commitment-unsealed" : FilCommitmentUnsealed ,
110
- "fil-commitment-sealed" : FilCommitmentSealed ,
111
- "dag-jose" : DagJOSE ,
112
- }
113
-
114
- // CodecToStr maps the numeric codec to its name
115
- var CodecToStr = map [uint64 ]string {
116
- Raw : "raw" ,
117
- DagProtobuf : "protobuf" ,
118
- DagCBOR : "cbor" ,
119
- GitRaw : "git-raw" ,
120
- EthBlock : "eth-block" ,
121
- EthBlockList : "eth-block-list" ,
122
- EthTxTrie : "eth-tx-trie" ,
123
- EthTx : "eth-tx" ,
124
- EthTxReceiptTrie : "eth-tx-receipt-trie" ,
125
- EthTxReceipt : "eth-tx-receipt" ,
126
- EthStateTrie : "eth-state-trie" ,
127
- EthAccountSnapshot : "eth-account-snapshot" ,
128
- EthStorageTrie : "eth-storage-trie" ,
129
- BitcoinBlock : "bitcoin-block" ,
130
- BitcoinTx : "bitcoin-tx" ,
131
- ZcashBlock : "zcash-block" ,
132
- ZcashTx : "zcash-tx" ,
133
- DecredBlock : "decred-block" ,
134
- DecredTx : "decred-tx" ,
135
- DashBlock : "dash-block" ,
136
- DashTx : "dash-tx" ,
137
- FilCommitmentUnsealed : "fil-commitment-unsealed" ,
138
- FilCommitmentSealed : "fil-commitment-sealed" ,
139
- DagJOSE : "dag-jose" ,
140
- }
141
-
142
86
// tryNewCidV0 tries to convert a multihash into a CIDv0 CID and returns an
143
87
// error on failure.
144
88
func tryNewCidV0 (mhash mh.Multihash ) (Cid , error ) {
0 commit comments