Documentation
¶
Overview ¶
Package protocol defines the libp2p webmesh protocol.
Index ¶
- Constants
- Variables
- func Decapsulate(addr multiaddr.Multiaddr) multiaddr.Multiaddr
- func DecapsulateAddr(addr multiaddr.Multiaddr) (protocol string, port string, err error)
- func Encapsulate(addr multiaddr.Multiaddr, pid peer.ID) multiaddr.Multiaddr
- func IsQUICAddr(addr multiaddr.Multiaddr) bool
- func IsUnencryptedAddr(addr multiaddr.Multiaddr) bool
- func IsWebmeshAddr(addr multiaddr.Multiaddr) bool
- func IsWebmeshCapableAddr(addr multiaddr.Multiaddr) bool
- func IsWebtransportAddr(addr multiaddr.Multiaddr) bool
- func PeerIDFromWebmeshAddr(addr multiaddr.Multiaddr) (peer.ID, error)
- func RendezvousFromWebmeshAddr(addr multiaddr.Multiaddr) (string, error)
- func WithPeerID(pid peer.ID) multiaddr.Multiaddr
- func WithPeerIDAndRendezvous(pid peer.ID, rendezvous string) multiaddr.Multiaddr
Constants ¶
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 ¶
var ErrNoPeerID = fmt.Errorf("no peer ID in webmesh multiaddr")
ErrNoPeerID is returned when a webmesh multiaddr does not contain a peer ID.
var ErrNoRedezvous = fmt.Errorf("no rendezvous in webmesh multiaddr")
ErrNoRedezvous is returned when a webmesh multiaddr does not contain a rendezvous.
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 ¶
DecapsulateAddr returns the protocol and port from the multiaddr
func Encapsulate ¶
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 ¶
PeerIDFromWebmeshAddr returns the peer ID argument from a webmesh multiaddr.
func RendezvousFromWebmeshAddr ¶
RendezvousFromWebmeshAddr returns the rendezvous argument from a webmesh multiaddr.
func WithPeerID ¶
WithPeerID returns a webmesh multiaddr with the given peer ID.
func WithPeerIDAndRendezvous ¶
WithPeerIDAndRendezvous returns a webmesh multiaddr with the given peer ID and rendezvous.
Types ¶
This section is empty.