multiaddr support for VSOCK
Adds support to multiaddr
addresses such as /vsock/3/xtcp/55555
to allow virtio-vsock
as communication channel.
go get github.com/balena/go-multiaddr-vsock
import (
_ "github.com/balena/go-multiaddr-vsock"
ma "github.com/multiformats/go-multiaddr"
)
// construct from a string (err signals parse failure)
m1, err := ma.NewMultiaddr("/vsock/3/xtcp/1234")
// construct from bytes (err signals parse failure)
m2, err := ma.NewMultiaddrBytes(m1.Bytes())
// true
strings.Equal(m1.String(), "/vsock/3/xtcp/1234")
strings.Equal(m1.String(), m2.String())
bytes.Equal(m1.Bytes(), m2.Bytes())
m1.Equal(m2)
m2.Equal(m1)
// get the multiaddr protocol description objects
m1.Protocols()
// []Protocol{
// Protocol{ Code: 40, Name: 'vsock'},
// Protocol{ Code: 7777972, Name: 'xtcp'},
// }
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.
MIT © 2023 Guilherme Versiani