protocol

package
v0.17.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package protocol defines the libp2p webmesh protocol.

Index

Constants

View Source
const (
	// SecurityID is the protocol ID of the security protocol.
	SecurityID = "/webmesh/1.0.0"
	// ID is the ID for the webmesh libp2p transport protocol.
	ProtocolID = "webmesh-v1"
	// ProtocolPath is the path for the webmesh libp2p transport protocol.
	ProtocolPath = "/" + ProtocolID
	// ProtocolCode is the code for the webmesh libp2p transport protocol.
	ProtocolCode = 613
	// P_WEBMESH is the code for the webmesh libp2p protocol.
	P_WEBMESH = ProtocolCode
	// SignalingPort is the port assumed for signaling.
	SignalingPort = 61820
	// PrefixSize is the size of the remote local address prefix.
	PrefixSize = 112
)

Variables

View Source
var ErrNoPeerID = fmt.Errorf("no peer ID in webmesh multiaddr")

ErrNoPeerID is returned when a webmesh multiaddr does not contain a peer ID.

View Source
var ErrNoRedezvous = fmt.Errorf("no rendezvous in webmesh multiaddr")

ErrNoRedezvous is returned when a webmesh multiaddr does not contain a rendezvous.

View Source
var Protocol = multiaddr.Protocol{
	Name:       ProtocolID,
	Code:       P_WEBMESH,
	VCode:      multiaddr.CodeToVarint(P_WEBMESH),
	Size:       -1,
	Path:       false,
	Transcoder: multiaddr.NewTranscoderFromFunctions(protocolStrToBytes, protocolBytesToStr, validateBytes),
}

Protocol is the webmesh libp2p protocol.

Functions

func Decapsulate

func Decapsulate(addr multiaddr.Multiaddr) multiaddr.Multiaddr

Decapsulate strips the webmesh component from the given multiaddr.

func DecapsulateAddr

func DecapsulateAddr(addr multiaddr.Multiaddr) (protocol string, port string, err error)

DecapsulateAddr returns the protocol and port from the multiaddr

func Encapsulate

func Encapsulate(addr multiaddr.Multiaddr, pid peer.ID) multiaddr.Multiaddr

Encapsulate appends the webmesh protocol to the given address.

func IsQUICAddr

func IsQUICAddr(addr multiaddr.Multiaddr) bool

IsQUICAddr returns true if the given multiaddr is a QUIC multiaddr.

func IsUnencryptedAddr

func IsUnencryptedAddr(addr multiaddr.Multiaddr) bool

IsUnencryptedAddr returns true if the given multiaddr is an unencrypted multiaddr.

func IsWebmeshAddr

func IsWebmeshAddr(addr multiaddr.Multiaddr) bool

IsWebmeshAddr returns true if the given multiaddr is a webmesh multiaddr.

func IsWebmeshCapableAddr

func IsWebmeshCapableAddr(addr multiaddr.Multiaddr) bool

IsWebmeshCapableAddr returns true if the given multiaddr is a webmesh-capable multiaddr.

func IsWebtransportAddr

func IsWebtransportAddr(addr multiaddr.Multiaddr) bool

IsWebtransportAddr returns true if the given multiaddr is a webtransport multiaddr.

func PeerIDFromWebmeshAddr

func PeerIDFromWebmeshAddr(addr multiaddr.Multiaddr) (peer.ID, error)

PeerIDFromWebmeshAddr returns the peer ID argument from a webmesh multiaddr.

func RendezvousFromWebmeshAddr

func RendezvousFromWebmeshAddr(addr multiaddr.Multiaddr) (string, error)

RendezvousFromWebmeshAddr returns the rendezvous argument from a webmesh multiaddr.

func WithPeerID

func WithPeerID(pid peer.ID) multiaddr.Multiaddr

WithPeerID returns a webmesh multiaddr with the given peer ID.

func WithPeerIDAndRendezvous

func WithPeerIDAndRendezvous(pid peer.ID, rendezvous string) multiaddr.Multiaddr

WithPeerIDAndRendezvous returns a webmesh multiaddr with the given peer ID and rendezvous.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL