Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
github.com/multiformats/go-multicodec
Generated Go constants for the multicodec table used by the multiformats projects.
go-multicodec
is a standard Go module:
go get github.com/multiformats/go-multicodec
Code
describes an integer reserved in the multicodec table, defined at multiformats/multicodec/table.csv.
type Code uint64
package main
import "github.com/multiformats/go-multicodec"
func main() {
code := multicodec.Sha2_256 // Code
name := multicodec.Sha2_256.String()
}
The corresponding name
value for each codec from the multicodecs table can be accessed via its String
method. For example, multicodec.Sha2_256.String()
will return sha2-256
.
var multicodec.Code code
err := code.Set("libp2p-key")
rawCode := multicodec.Code(0x55)
To generate the constants yourself:
$ git clone https://github.com/multiformats/go-multicodec
$ cd go-multicodec
$ git submodule init && git submodule update
$ go generate
Note: You may need to install stringer
via go install golang.org/x/tools/cmd/stringer
.
To generate the constants for the latest table.csv:
$ git clone https://github.com/multiformats/go-multicodec
$ cd go-multicodec
$ git submodule init
$ git submodule update --remote # updates ./multicodec/table.csv to upstream version
$ go generate
Contributions welcome. Please check out the issues.
Check out our contributing document for more information on how we work, and about contributing in general. Please be aware that all interactions related to multiformats are subject to the IPFS Code of Conduct.
Small note: If editing the README, please conform to the standard-readme specification.
SPDX-License-Identifier: Apache-2.0 OR MIT
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.