protoutil

package
v0.0.0-...-055f8da Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2023 License: Apache-2.0, MIT Imports: 4 Imported by: 2

Documentation

Overview

Package protoutil contains utilities for working with libp2p's protocol.ID.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendStrings

func AppendStrings(id protocol.ID, ss ...string) protocol.ID

AppendStrings to a protocol.ID

func Join

func Join(ids ...protocol.ID) protocol.ID

Join multiple protocol.IDs into one, using the path separator.

func Parts

func Parts(id protocol.ID) []protocol.ID

Parts splits the protocol.ID into its constituent components

func Split

func Split(id protocol.ID) (base, end protocol.ID)

Split the protocol into its base path and its end-component.

Types

type MatchFunc

type MatchFunc func(string) (string, bool)

func Exactly

func Exactly(s string) MatchFunc

func Match

func Match(ms ...MatchFunc) (f MatchFunc)

func Prefix

func Prefix(prefix protocol.ID) MatchFunc

func SemVer

func SemVer(version string) MatchFunc

SemVer returns a function that compares the protocol ID with the supplied semantic version string. It returns true iff the major version numbers are identical.

SemVer is compliant with the Semantic Versioning 2.0.0 spec. https://semver.org/

func Suffix

func Suffix(suffix protocol.ID) (f MatchFunc)

func (MatchFunc) Match

func (f MatchFunc) Match(id protocol.ID) bool

func (MatchFunc) Then

func (f MatchFunc) Then(next MatchFunc) MatchFunc

Jump to

Keyboard shortcuts

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