Documentation
¶
Index ¶
- func SortConfKeys(keys []string) []string
- type BaseModule
- type JSONModule
- type List
- type Listener
- type Map
- type Module
- type Node
- type ProxyPassModule
- type Req
- type Res
- type RootModule
- type Route
- type RoutesModule
- type Scalar
- type ServerModule
- type SetUrlModule
- type SimpleModule
- type StaticModule
- type TextModule
- type UpstreamModule
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SortConfKeys ¶
Here to sort conf keys, to keep the module initial in right orders
Types ¶
type BaseModule ¶
type BaseModule struct {
// contains filtered or unexported fields
}
func (*BaseModule) GetName ¶
func (base *BaseModule) GetName() string
func (*BaseModule) Next ¶
func (base *BaseModule) Next() Module
func (*BaseModule) SetName ¶
func (base *BaseModule) SetName(name string)
func (*BaseModule) SetNext ¶
func (base *BaseModule) SetNext(next Module)
type JSONModule ¶
type JSONModule struct {
BaseModule
// contains filtered or unexported fields
}
func NewJSONModule ¶
func NewJSONModule(node Node) *JSONModule
func (*JSONModule) Init ¶
func (m *JSONModule) Init(node Node)
type Listener ¶
type Listener struct {
Address string
Servers map[string]*ServerModule
DefaultServer *ServerModule
}
func NewListener ¶
func (*Listener) AddServer ¶
func (lsn *Listener) AddServer(server *ServerModule)
type Module ¶
type Module interface {
// Init(Node)
// true to break, false to next
SetName(string)
GetName() string
SetNext(Module)
Next() Module
// prcess request and response, return true if processed
Process(*Req, *Res) bool
}
Relations between module is tree like
type ProxyPassModule ¶
type ProxyPassModule struct {
BaseModule
}
func NewProxyPassModule ¶
func NewProxyPassModule(node Node) *ProxyPassModule
type Res ¶
type Res struct {
Req *Req
// contains filtered or unexported fields
}
implement http.ResponseWriter
func (*Res) IsProcessed ¶
type RootModule ¶
type RootModule struct {
Upstreams map[string]*UpstreamModule
Listeners map[string]*Listener
}
func NewRootModule ¶
func NewRootModule(root Node) *RootModule
func (*RootModule) Init ¶
func (root *RootModule) Init(node Node)
func (*RootModule) Run ¶
func (root *RootModule) Run()
type RoutesModule ¶
type RoutesModule struct {
BaseModule
Routes []*Route
}
func NewRoutesModule ¶
func NewRoutesModule(node Node) *RoutesModule
func (*RoutesModule) Init ¶
func (m *RoutesModule) Init(node Node)
type ServerModule ¶
func NewServerModule ¶
func NewServerModule(host string, node Node) *ServerModule
type SetUrlModule ¶
type SetUrlModule struct {
BaseModule
}
func NewSetUrlModule ¶
func NewSetUrlModule(node Scalar) *SetUrlModule
type SimpleModule ¶
type SimpleModule struct {
Modules []Module
}
func (*SimpleModule) GetSubModules ¶
func (sm *SimpleModule) GetSubModules() []Module
func (*SimpleModule) ProcessSubModuels ¶
func (sm *SimpleModule) ProcessSubModuels(req *Req, res *Res) bool
type StaticModule ¶
type StaticModule struct {
BaseModule
// contains filtered or unexported fields
}
func NewStaticModule ¶
func NewStaticModule(node Node) *StaticModule
func (*StaticModule) Init ¶
func (m *StaticModule) Init(node Node)
type TextModule ¶
type TextModule struct {
BaseModule
// contains filtered or unexported fields
}
func NewTextModule ¶
func NewTextModule(node Node) *TextModule
func (*TextModule) Init ¶
func (m *TextModule) Init(node Node)
type UpstreamModule ¶
type UpstreamModule struct {
// contains filtered or unexported fields
}
func NewUpstreamModule ¶
func NewUpstreamModule(node Node) *UpstreamModule
func (*UpstreamModule) AddNode ¶
func (up *UpstreamModule) AddNode(node Node)
func (*UpstreamModule) Init ¶
func (up *UpstreamModule) Init(node Node)
Click to show internal directories.
Click to hide internal directories.