multistream

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const ProtocolID = "/multistream/1.0.0"

Variables

View Source
var ErrIncorrectVersion = errors.New("client connected with incorrect version")
View Source
var ErrNotSupported = errors.New("protocol not supported")
View Source
var ErrTooLarge = errors.New("incoming message was too large")

Functions

func Ls

func Ls(rw io.ReadWriter) ([]string, error)

func ReadNextToken

func ReadNextToken(rw io.ReadWriter) (string, error)

func ReadNextTokenBytes

func ReadNextTokenBytes(rw io.ReadWriter) ([]byte, error)

func SelectOneOf

func SelectOneOf(protos []string, rwc io.ReadWriteCloser) (string, error)

func SelectProtoOrFail

func SelectProtoOrFail(proto string, rwc io.ReadWriteCloser) error

Types

type Handler

type Handler struct {
	MatchFunc func(string) bool
	Handle    HandlerFunc
	AddName   string
}

type HandlerFunc

type HandlerFunc func(string, io.ReadWriteCloser) error

type Multistream

type Multistream interface {
	io.ReadWriteCloser
}

func NewMSSelect

func NewMSSelect(c io.ReadWriteCloser, proto string) Multistream

func NewMultistream

func NewMultistream(c io.ReadWriteCloser, proto string) Multistream

type MultistreamMuxer

type MultistreamMuxer struct {
	// contains filtered or unexported fields
}

func NewMultistreamMuxer

func NewMultistreamMuxer() *MultistreamMuxer

func (*MultistreamMuxer) AddHandler

func (msm *MultistreamMuxer) AddHandler(protocol string, handler HandlerFunc)

func (*MultistreamMuxer) AddHandlerWithFunc

func (msm *MultistreamMuxer) AddHandlerWithFunc(protocol string, match func(string) bool, handler HandlerFunc)

func (*MultistreamMuxer) Handle

func (msm *MultistreamMuxer) Handle(rwc io.ReadWriteCloser) error

func (*MultistreamMuxer) Ls

func (msm *MultistreamMuxer) Ls(w io.Writer) error

func (*MultistreamMuxer) Negotiate

func (msm *MultistreamMuxer) Negotiate(rwc io.ReadWriteCloser) (string, HandlerFunc, error)

func (*MultistreamMuxer) NegotiateLazy

func (msm *MultistreamMuxer) NegotiateLazy(rwc io.ReadWriteCloser) (Multistream, string, HandlerFunc, error)

func (*MultistreamMuxer) Protocols

func (msm *MultistreamMuxer) Protocols() []string

func (*MultistreamMuxer) RemoveHandler

func (msm *MultistreamMuxer) RemoveHandler(protocol string)

Jump to

Keyboard shortcuts

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