Documentation ¶
Index ¶
Constants ¶
View Source
const ( ActionLog = "log" // allow and log ActionBlock = "block" // block ActionCaptcha = "captcha" // block and show captcha // TODO ActionAllow = "allow" // allow )
Variables ¶
View Source
var AllActions = []*ActionDefinition{ { Name: "阻止", Code: ActionBlock, Instance: new(BlockAction), }, { Name: "允许通过", Code: ActionAllow, Instance: new(AllowAction), }, { Name: "允许并记录日志", Code: ActionLog, Instance: new(LogAction), }, }
Functions ¶
func FindActionName ¶
func FindActionName(action ActionString) string
Types ¶
type ActionDefinition ¶
type ActionDefinition struct { Name string Code ActionString Description string Instance ActionInterface }
type ActionInterface ¶
type ActionInterface interface {
Perform(writer http.ResponseWriter) (allow bool)
}
func FindActionInstance ¶
func FindActionInstance(action ActionString) ActionInterface
type ActionString ¶
type ActionString = string
type AllowAction ¶
type AllowAction struct { }
func (*AllowAction) Perform ¶
func (this *AllowAction) Perform(writer http.ResponseWriter) (allow bool)
type BlockAction ¶
type BlockAction struct { StatusCode int `yaml:"statusCode" json:"statusCode"` Body string `yaml:"body" json:"body"` // supports HTML URL string `yaml:"url" json:"url"` }
func (*BlockAction) Perform ¶
func (this *BlockAction) Perform(writer http.ResponseWriter) (allow bool)
Click to show internal directories.
Click to hide internal directories.