status-go/vendor/github.com/multiformats/go-multicodec
RichΛrd 0babdad17b
chore: upgrade go-waku to v0.5 (#3213)
* chore: upgrade go-waku to v0.5
* chore: add println and logs to check what's being stored in the enr, and preemptively delete the multiaddr field (#3219)
* feat: add wakuv2 test (#3218)
2023-02-22 17:58:17 -04:00
..
.gitmodules feat: wakuv2 store (#2780) 2022-08-19 12:34:07 -04:00
LICENSE feat: wakuv2 store (#2780) 2022-08-19 12:34:07 -04:00
LICENSE-APACHE feat: wakuv2 store (#2780) 2022-08-19 12:34:07 -04:00
LICENSE-MIT feat: wakuv2 store (#2780) 2022-08-19 12:34:07 -04:00
README.md chore: upgrade go-waku to v0.5 (#3213) 2023-02-22 17:58:17 -04:00
code.go feat: wakuv2 store (#2780) 2022-08-19 12:34:07 -04:00
code_string.go chore: upgrade go-waku to v0.5 (#3213) 2023-02-22 17:58:17 -04:00
code_table.go chore: upgrade go-waku to v0.5 (#3213) 2023-02-22 17:58:17 -04:00
version.json chore: upgrade go-waku to v0.5 (#3213) 2023-02-22 17:58:17 -04:00

README.md

go-multicodec

standard-readme compliant

Generated Go constants for the multicodec table used by the multiformats projects.

Table of Contents

Install

go-multicodec is a standard Go module:

go get github.com/multiformats/go-multicodec

Type

Code describes an integer reserved in the multicodec table, defined at multiformats/multicodec/table.csv.

type Code uint64

Usage

Importing Code constant

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.

Code from string

var multicodec.Code code 
err := code.Set("libp2p-key")

Code from uint64

rawCode := multicodec.Code(0x55)

Generator

With old table.csv

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.

With updated table.csv

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

Maintainers

@mvdan.

Contribute

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.

License

SPDX-License-Identifier: Apache-2.0 OR MIT