Documentation
¶
Index ¶
- Variables
- func Get(name string) (string, bool)
- func NewMuxWithConfig(conf *Config) (stream.Handler, error)
- func RegisterRegexp(name string, pattern string)
- func Unread(reader io.Reader, prefix []byte) io.Reader
- func UnreadStream(rwc stream.Stream, prefix []byte) stream.Stream
- func UnwrapUnread(reader io.Reader) (io.Reader, []byte)
- func UnwrapUnreadStream(rwc stream.Stream) (stream.Stream, []byte)
- type Config
- type Mux
- func (m *Mux) HandlePrefix(prefix string, handler stream.Handler) error
- func (m *Mux) HandleRegexp(pattern string, handler stream.Handler) error
- func (m *Mux) Handler(r io.Reader) (handler stream.Handler, prefix []byte, err error)
- func (m *Mux) NotFound(handler stream.Handler) error
- func (m *Mux) ServeStream(ctx context.Context, stm stream.Stream)
- type Route
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNotFound = fmt.Errorf("error not found")
)
Functions ¶
func NewMuxWithConfig ¶
NewProtoMux create a new Mux with config.
func RegisterRegexp ¶
Types ¶
type Mux ¶
type Mux struct {
// contains filtered or unexported fields
}
Mux is an Applicative protocol multiplexer It matches the prefix of each incoming reader against a list of registered patterns and calls the handler for the pattern that most closely matches the Handler.
func (*Mux) Handler ¶
Handler returns most matching handler and prefix bytes data to use for the given reader.
Click to show internal directories.
Click to hide internal directories.