Documentation ¶
Index ¶
- Constants
- type Config
- type Guard
- type Handler
- type HandlerFunc
- type Message
- type Server
- type ServerGuard
- func (s *ServerGuard) Dispatch(mtype string, message *Message)
- func (s *ServerGuard) ForceValidate() *ServerGuard
- func (s *ServerGuard) GetHandlers() *gmap.IntAnyMap
- func (s *ServerGuard) GetMessage() (message *Message, err error)
- func (s *ServerGuard) HandleRequest(originMsg *Message)
- func (s *ServerGuard) IsSafeMode() bool
- func (s *ServerGuard) Push(handler Handler, pattern message.MessageType)
- func (s *ServerGuard) PushFunc(handler HandlerFunc, pattern message.MessageType)
- func (s *ServerGuard) RegisterMessageType(message map[string]message.MessageType)
- func (s *ServerGuard) Serve()
- func (s *ServerGuard) TypeToEvent(t string) message.MessageType
- func (s *ServerGuard) Validate() *ServerGuard
Constants ¶
View Source
const (
SUCCESS_EMPTY_RESPONSE = "success"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler interface {
Handle(message *Message) interface{}
}
Handler is interface to handle message
type Message ¶
Message message is alias of gjson.Json openplatform 参考 https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/api/component_verify_ticket.html officialaccount 参考 https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Receiving_standard_messages.html gjson.Json 参考 https://www.goframe.org/encoding/gjson/index
type ServerGuard ¶
type ServerGuard struct { Guard Guard Config Config Request *ehttp.Request AlwaysValidate bool Response *ehttp.Response Logger *log.Logger Encryptor *encryptor.Encryptor MuxEntry *gmap.IntAnyMap MessageGroup *gmap.StrIntMap // contains filtered or unexported fields }
func New ¶
func New(config Config, request *http.Request, writer http.ResponseWriter) *ServerGuard
New
func (*ServerGuard) Dispatch ¶
func (s *ServerGuard) Dispatch(mtype string, message *Message)
func (*ServerGuard) ForceValidate ¶
func (s *ServerGuard) ForceValidate() *ServerGuard
ForceValidate set to force validation the request
func (*ServerGuard) GetMessage ¶
func (s *ServerGuard) GetMessage() (message *Message, err error)
GetMessage
func (*ServerGuard) HandleRequest ¶
func (s *ServerGuard) HandleRequest(originMsg *Message)
return response
func (*ServerGuard) IsSafeMode ¶
func (s *ServerGuard) IsSafeMode() bool
IsSafeMode check the request message is the safe mode.
func (*ServerGuard) Push ¶
func (s *ServerGuard) Push(handler Handler, pattern message.MessageType)
Push
func (*ServerGuard) PushFunc ¶
func (s *ServerGuard) PushFunc(handler HandlerFunc, pattern message.MessageType)
PushFunc
func (*ServerGuard) RegisterMessageType ¶
func (s *ServerGuard) RegisterMessageType(message map[string]message.MessageType)
Register message type
func (*ServerGuard) TypeToEvent ¶
func (s *ServerGuard) TypeToEvent(t string) message.MessageType
TypeToEvent
func (*ServerGuard) Validate ¶
func (s *ServerGuard) Validate() *ServerGuard
Validate validate request source
Click to show internal directories.
Click to hide internal directories.