diff --git a/README.md b/README.md index 4f54343..89da041 100644 --- a/README.md +++ b/README.md @@ -59,10 +59,17 @@ fmt.Println("Got CID: ", c) #### Creating a CID from scratch ```go + +import ( + cid "github.com/ipfs/go-cid" + mc "github.com/multiformats/go-multicodec" + mh "github.com/multiformats/go-multihash" +) + // Create a cid manually by specifying the 'prefix' parameters pref := cid.Prefix{ Version: 1, - Codec: cid.Raw, + Codec: mc.Raw, MhType: mh.SHA2_256, MhLength: -1, // default length } diff --git a/cid.go b/cid.go index 71ee4ba..bc5704a 100644 --- a/cid.go +++ b/cid.go @@ -47,11 +47,12 @@ var ( ErrInvalidEncoding = errors.New("invalid base encoding") ) -// These are multicodec-packed content types. The should match -// the codes described in the authoritative document: -// https://github.com/multiformats/multicodec/blob/master/table.csv +// Consts below are DEPRECATED and left only for legacy reasons: +// +// Modern code should use consts from go-multicodec instead: +// const ( - // core IPLD + // common ones Raw = 0x55 DagProtobuf = 0x70 // https://ipld.io/docs/codecs/known/dag-pb/ DagCBOR = 0x71 // https://ipld.io/docs/codecs/known/dag-cbor/