Documentation
¶
Index ¶
Constants ¶
View Source
const ( SuccessEmptyResponse = "success" EchoStr = "echostr" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EchoStrMode ¶ added in v0.2.0
type EchoStrMode int
EchoStrMode echostr验证模式
const ( // EchoStrPlain 明文直接返回(公众号) EchoStrPlain EchoStrMode = iota // EchoStrDecrypt 需要解密后返回(企业微信) EchoStrDecrypt )
type EncryptMode ¶ added in v0.2.0
type EncryptMode int
EncryptMode 加密模式
const ( // EncryptModeAuto 自动检测 aes/明文(公众号) EncryptModeAuto EncryptMode = iota // EncryptModeAES 强制 AES 加密(企业微信) EncryptModeAES )
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server 统一服务端
func (*Server) Dispatch ¶
func (s *Server) Dispatch( request *http.Request, writer http.ResponseWriter, handler contracts.EventHandler, )
Dispatch 直接调度事件处理(跳过路由匹配)
func (*Server) On ¶ added in v0.2.0
func (s *Server) On(handler contracts.EventHandler, eventTypes ...event.EventType)
On 注册事件处理器,支持多个事件类型绑定同一个 handler
func (*Server) Serve ¶
func (s *Server) Serve(request *http.Request, writer http.ResponseWriter)
Serve 处理微信回调请求
func (*Server) Use ¶ added in v0.2.0
func (s *Server) Use(middlewares ...contracts.Middleware)
Use 注册全局中间件
type ServerOption ¶ added in v0.2.0
type ServerOption func(*Server)
ServerOption 服务端配置
func WithEchoStrMode ¶ added in v0.2.0
func WithEchoStrMode(mode EchoStrMode) ServerOption
WithEchoStrMode 设置echostr验证模式
func WithEncryptMode ¶ added in v0.2.0
func WithEncryptMode(mode EncryptMode) ServerOption
WithEncryptMode 设置加密模式
Click to show internal directories.
Click to hide internal directories.