Skip to content

v0.2.0

Compare
Choose a tag to compare
@lidel lidel released this 21 Apr 20:41
· 67 commits to master since this release
b2064d7

What's Changed

BREAKING CHANGE

Converting code to string and vice versa will no longer be done with go-cid (#137), go-multicodec should be used instead.

NOTE: old mapping was invalid, and switching to go-multicodec will change the meaning of code 0x70 and 0x71 and strings cbor and protobuf:

  • protobuf string now correctly points at code 0x50 (was 0x70, which is dag-pb)
    • 0x70 code is mapped to dag-pb (was protobuf before)
  • cbor string now correctly points at code 0x51 (was 0x71, which is dag-cbor)
    • 0x71 code is now mapped to dag-cbor (was cbor before)

Refactor guide

Old way (go-cid < 0.2.0)

cid "github.com/ipfs/go-cid"

// string → code
code := cid.Codecs["libp2p-key"]

// code → string
string := cid.CodecToStr[code]

New way (with go-multicodec)

mc "github.com/multiformats/go-multicodec"

// string → code
var mc.Code code 
code.Set("libp2p-key")

// code → string
code.String()

New Contributors

Full Changelog: v0.1.0...v0.2.0