mux

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2023 License: Apache-2.0 Imports: 8 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MuxDefault = NewMessageMux()
)

Functions

This section is empty.

Types

type Handler

type Handler interface {
	ServeConn(req *MessageRequest, writer ResponseWriter)
}

type HandlerFunc

type HandlerFunc func(*MessageContainer, ResponseWriter)

type MessageContainer

type MessageContainer struct {
	Header  http.Header
	Message *model.Message
	// contains filtered or unexported fields
}

func (*MessageContainer) Parameter

func (c *MessageContainer) Parameter(name string) string

type MessageExpression

type MessageExpression struct {
	VarNames []string
	VarCount int
	Matcher  *regexp.Regexp
}

func NewExpression

func NewExpression() *MessageExpression

func (*MessageExpression) GetExpression

func (exp *MessageExpression) GetExpression(resource string) *MessageExpression

type MessageMux

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

func Entry

func Entry(pattern *MessagePattern, handle func(*MessageContainer, ResponseWriter)) *MessageMux

func NewMessageMux

func NewMessageMux() *MessageMux

func (*MessageMux) AddFilter

func (mux *MessageMux) AddFilter(filter *filter.MessageFilter)

func (*MessageMux) Entry

func (mux *MessageMux) Entry(pattern *MessagePattern, handle func(*MessageContainer, ResponseWriter)) *MessageMux

func (*MessageMux) ServeConn

func (mux *MessageMux) ServeConn(req *MessageRequest, writer ResponseWriter)

type MessageMuxEntry

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

func NewEntry

func NewEntry(pattern *MessagePattern, handle func(*MessageContainer, ResponseWriter)) *MessageMuxEntry

func (*MessageMuxEntry) Handle

func (entry *MessageMuxEntry) Handle(handle func(*MessageContainer, ResponseWriter)) *MessageMuxEntry

func (*MessageMuxEntry) Pattern

func (entry *MessageMuxEntry) Pattern(pattern *MessagePattern) *MessageMuxEntry

type MessagePattern

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

func NewPattern

func NewPattern(resource string) *MessagePattern

func (*MessagePattern) Match

func (pattern *MessagePattern) Match(message *model.Message) bool

func (*MessagePattern) Op

func (pattern *MessagePattern) Op(operation string) *MessagePattern

func (*MessagePattern) Res

func (pattern *MessagePattern) Res(resource string) *MessagePattern

type MessageRequest

type MessageRequest struct {
	Header  http.Header
	Message *model.Message
}

type ResponseWriter

type ResponseWriter interface {
	WriteResponse(msg *model.Message, content interface{})
	WriteError(msg *model.Message, err string)
}

Jump to

Keyboard shortcuts

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