Closed
Description
https://github.com/ipfs/go-cid/pull/137/files is removing hardcoded mapping tables from go-cid
,
and we need a replacement for people who will be migrating to go-multicodec
I want to document the best way way of doing string → code and code → string
My understanding is that:
Old way (go-cid)
cid "github.com/ipfs/go-cid"
// string → code
code := cid.Codecs["libp2p-key"]
// code → string
string := cid.CodecToStr[code]
New way (go-multicodec)
mc "github.com/multiformats/go-multicodec"
// string → code
var mc.Code code
code.Set("libp2p-key")
// code → string
code.String()
@mvdan any thoughts if this is good enough?
Should we add StrToCodec
and CodecToStr
maps to go-multicodec, or is it not worth it?
Metadata
Metadata
Assignees
Labels
No labels