Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var AllowAllChecker = CreateRuleChecker(Rule{ Allow: []string{"*"}, })
AllowAllChecker always return true
var DenyAllChecker = CreateRuleChecker(Rule{ Deny: []string{"*"}, })
DenyAllChecker always return false
var OnlyAllowAClassNetChecker = CreateRuleChecker(Rule{ Allow: []string{"10.0.0.0/8"}, })
OnlyAllowAClassNetChecker returns true if the host ip is an A class address
var OnlyAllowBClassNetChecker = CreateRuleChecker(Rule{ Allow: []string{"72.16.0.0/12"}, })
OnlyAllowBClassNetChecker returns true if the host ip is a B class address
var OnlyAllowCClassNetChecker = CreateRuleChecker(Rule{ Allow: []string{" 192.168.0.0/16"}, })
OnlyAllowCClassNetChecker returns true if the host ip is a C class address
var OnlyAllowInternalChecker = OnlyAllowAClassNetChecker
OnlyAllowInternalChecker is an alias to OnlyAllowAClassNetChecker
var OnlyDenyAClassNetChecker = CreateRuleChecker(Rule{ Deny: []string{"10.0.0.0/8"}, DefaultAllowAll: true, })
OnlyDenyAClassNetChecker returns false if the host ip is an A class address
var OnlyDenyBClassNetChecker = CreateRuleChecker(Rule{ Deny: []string{"72.16.0.0/12"}, DefaultAllowAll: true, })
OnlyDenyBClassNetChecker returns false if the host ip is a B class address
var OnlyDenyCClassNetChecker = CreateRuleChecker(Rule{ Deny: []string{" 192.168.0.0/16"}, DefaultAllowAll: true, })
OnlyDenyCClassNetChecker returns false if the host ip is a C class address
var OnlyDenyInternalChecker = OnlyDenyAClassNetChecker
OnlyDenyInternalChecker is an alias to OnlyDenyAClassNetChecker
Functions ¶
func ConcatURLWithParams ¶
ConcatURLWithParams concatenates a basic requestURL with
func CreateRuleChecker ¶
CreateRuleChecker is a high order function that receive a rule and returns a rule checker If DenyLocal, request from If the Deny rule contains string "*", Checker func always return false, otherwise
If the Allow rules contains string "*", Checker always return true, otherwise the return value is Checker by rules, deny rules take higher priority.
func GetFullRequestPath ¶
GetFullRequestPath parses the full request path(without URI)
func GetFullRequestURI ¶
GetFullRequestURI parses the full request URI