Documentation ¶
Index ¶
- Constants
- type ClientHandler
- type Config
- type Endpoint
- func (ep *Endpoint) AddRouter(router *endpoint.Router, params ...interface{}) (string, error)
- func (ep *Endpoint) Close() error
- func (ep *Endpoint) Destroy()
- func (ep *Endpoint) Id() string
- func (ep *Endpoint) Init(ruleConfig types.Config, configuration types.Configuration) error
- func (ep *Endpoint) New() types.Node
- func (ep *Endpoint) Printf(format string, v ...interface{})
- func (ep *Endpoint) RemoveRouter(routerId string, params ...interface{}) error
- func (ep *Endpoint) Start() error
- func (ep *Endpoint) Type() string
- type RegexpRouter
- type RequestMessage
- func (r *RequestMessage) Body() []byte
- func (r *RequestMessage) Conn() net.Conn
- func (r RequestMessage) From() string
- func (r *RequestMessage) GetError() error
- func (r *RequestMessage) GetMsg() *types.RuleMsg
- func (r *RequestMessage) GetParam(key string) string
- func (r *RequestMessage) Headers() textproto.MIMEHeader
- func (r *RequestMessage) SetBody(body []byte)
- func (r *RequestMessage) SetError(err error)
- func (r *RequestMessage) SetMsg(msg *types.RuleMsg)
- func (r *RequestMessage) SetStatusCode(statusCode int)
- type ResponseMessage
- func (r *ResponseMessage) Body() []byte
- func (r *ResponseMessage) From() string
- func (r *ResponseMessage) GetError() error
- func (r *ResponseMessage) GetMsg() *types.RuleMsg
- func (r *ResponseMessage) GetParam(key string) string
- func (r *ResponseMessage) Headers() textproto.MIMEHeader
- func (r *ResponseMessage) SetBody(body []byte)
- func (r *ResponseMessage) SetError(err error)
- func (r *ResponseMessage) SetMsg(msg *types.RuleMsg)
- func (r *ResponseMessage) SetStatusCode(statusCode int)
Constants ¶
View Source
const ( // Type 组件类型 Type = "net" // RemoteAddrKey 远程地址键 RemoteAddrKey = "remoteAddr" // PingData 心跳数据 PingData = "ping" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientHandler ¶
type ClientHandler struct {
// contains filtered or unexported fields
}
type Config ¶
type Config struct { // 通信协议,可以是tcp、udp、ip4:1、ip6:ipv6-icmp、ip6:58、unix、unixgram,以及net包支持的协议类型。默认tcp协议 Protocol string // 服务器的地址,格式为host:port Server string // 读取超时,用于设置读取数据的超时时间,单位为秒,可以为0表示不设置超时 ReadTimeout int }
Config endpoint组件的配置
type Endpoint ¶
type Endpoint struct { // 嵌入endpoint.BaseEndpoint,继承其方法 endpoint.BaseEndpoint // 配置 Config Config // rulego配置 RuleConfig types.Config // contains filtered or unexported fields }
Endpoint net endpoint组件 支持通过正则表达式把匹配的消息路由到指定路由
func (*Endpoint) RemoveRouter ¶
type RegexpRouter ¶
type RegexpRouter struct {
// contains filtered or unexported fields
}
RegexpRouter 正则表达式路由
type RequestMessage ¶
type RequestMessage struct {
// contains filtered or unexported fields
}
RequestMessage 请求消息
func (*RequestMessage) Body ¶
func (r *RequestMessage) Body() []byte
func (*RequestMessage) Conn ¶
func (r *RequestMessage) Conn() net.Conn
func (*RequestMessage) GetError ¶
func (r *RequestMessage) GetError() error
func (*RequestMessage) GetMsg ¶
func (r *RequestMessage) GetMsg() *types.RuleMsg
func (*RequestMessage) GetParam ¶
func (r *RequestMessage) GetParam(key string) string
func (*RequestMessage) Headers ¶
func (r *RequestMessage) Headers() textproto.MIMEHeader
func (*RequestMessage) SetBody ¶
func (r *RequestMessage) SetBody(body []byte)
func (*RequestMessage) SetError ¶
func (r *RequestMessage) SetError(err error)
func (*RequestMessage) SetMsg ¶
func (r *RequestMessage) SetMsg(msg *types.RuleMsg)
func (*RequestMessage) SetStatusCode ¶
func (r *RequestMessage) SetStatusCode(statusCode int)
SetStatusCode 不提供设置响应状态码
type ResponseMessage ¶
type ResponseMessage struct {
// contains filtered or unexported fields
}
ResponseMessage 响应消息
func (*ResponseMessage) Body ¶
func (r *ResponseMessage) Body() []byte
func (*ResponseMessage) From ¶
func (r *ResponseMessage) From() string
func (*ResponseMessage) GetError ¶
func (r *ResponseMessage) GetError() error
func (*ResponseMessage) GetMsg ¶
func (r *ResponseMessage) GetMsg() *types.RuleMsg
func (*ResponseMessage) GetParam ¶
func (r *ResponseMessage) GetParam(key string) string
func (*ResponseMessage) Headers ¶
func (r *ResponseMessage) Headers() textproto.MIMEHeader
func (*ResponseMessage) SetBody ¶
func (r *ResponseMessage) SetBody(body []byte)
func (*ResponseMessage) SetError ¶
func (r *ResponseMessage) SetError(err error)
func (*ResponseMessage) SetMsg ¶
func (r *ResponseMessage) SetMsg(msg *types.RuleMsg)
func (*ResponseMessage) SetStatusCode ¶
func (r *ResponseMessage) SetStatusCode(statusCode int)
Click to show internal directories.
Click to hide internal directories.