proto

package
v0.1.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2023 License: Apache-2.0, MIT Imports: 5 Imported by: 0

Documentation

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 Namespace

func Namespace(ns string) []protocol.ID

Namespace returns the subprotocol family for the supplied namespace.

func Parts

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

Parts splits the protocol.ID into its constituent components

func Root

func Root(ns string) protocol.ID

Root returns the protocol ID for the supplied namespace.

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[ID ~string](id ID) MatchFunc

func Match

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

func NewMatcher

func NewMatcher(ns string) MatchFunc

NewMatcher returns a stream matcher for a protocol.ID that matches the pattern: /ww/<version>/<ns>

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