Skip to content

Latest commit

 

History

History
58 lines (40 loc) · 1.52 KB

README.md

File metadata and controls

58 lines (40 loc) · 1.52 KB

go-multiaddr-vsock

multiaddr support for VSOCK

Adds support to multiaddr addresses such as /vsock/3/xtcp/55555 to allow virtio-vsock as communication channel.

Install

go get github.com/balena/go-multiaddr-vsock

Usage

Example

Simple

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)

Protocols

// get the multiaddr protocol description objects
m1.Protocols()
// []Protocol{
//   Protocol{ Code: 40, Name: 'vsock'},
//   Protocol{ Code: 7777972, Name: 'xtcp'},
// }

Contribute

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

MIT © 2023 Guilherme Versiani