Documentation
¶
Index ¶
- Constants
- Variables
- func Context(ctx context.Context, rules *Ruleset) context.Context
- func Middleware(rules *Ruleset) func(http.Handler) http.Handler
- type CommercialISPRule
- func (rule *CommercialISPRule) Name() string
- func (rule *CommercialISPRule) Report(ctx context.Context, sample *model.Sample, user, reason string)
- func (rule *CommercialISPRule) Test(ctx context.Context, sample *model.Sample) int
- func (rule *CommercialISPRule) Update(backend isps.Interface) func(ctx context.Context) error
- func (rule *CommercialISPRule) UpdateOther(ctx context.Context) error
- type DEPRule
- func (rule *DEPRule) Name() string
- func (rule *DEPRule) Report(ctx context.Context, sample *model.Sample, user, reason string)
- func (rule *DEPRule) ReportDEP(ctx context.Context, domain, source, reason string) error
- func (rule *DEPRule) Test(ctx context.Context, sample *model.Sample) int
- func (rule *DEPRule) UnreportDEP(ctx context.Context, domain string) error
- type DomainsRule
- type NetworksRule
- func (rule *NetworksRule) Name() string
- func (rule *NetworksRule) Report(ctx context.Context, sample *model.Sample, user, reason string)
- func (rule *NetworksRule) ReportSubnet(ctx context.Context, cidr, source, reason string) error
- func (rule *NetworksRule) Test(ctx context.Context, sample *model.Sample) int
- func (rule *NetworksRule) UnreportSubnet(ctx context.Context, cidr string) error
- type RateBucket
- type RateLimitRule
- type Rule
- type Ruleset
- type TorExitRule
Constants ¶
View Source
const ( PASS int = 0 FAIL int = 1 SKIP int = 2 )
Returned from the execution of a rule to indicate the result
View Source
const (
EXIT_LIST_URL string = "https://check.torproject.org/torbulkexitlist"
)
View Source
const (
LRU_SIZE = 1024
)
Variables ¶
View Source
var (
ErrNoSuchRule = errors.New("No such rule")
)
Functions ¶
Types ¶
type CommercialISPRule ¶
type CommercialISPRule struct {
// contains filtered or unexported fields
}
Rule that blocks IP addresses associated with commercial ISPs
func NewCommercialISPRule ¶
func NewCommercialISPRule(conf *config.Config) *CommercialISPRule
Creates a commercial ISP rule.
func (*CommercialISPRule) Name ¶
func (rule *CommercialISPRule) Name() string
func (*CommercialISPRule) UpdateOther ¶
func (rule *CommercialISPRule) UpdateOther(ctx context.Context) error
type DEPRule ¶
type DEPRule struct {
// contains filtered or unexported fields
}
Rule that blocks domain names from a blacklist
type DomainsRule ¶
type DomainsRule struct {
// contains filtered or unexported fields
}
Rule that blocks domain names from a blacklist
func (*DomainsRule) Name ¶
func (rule *DomainsRule) Name() string
type NetworksRule ¶
type NetworksRule struct {
// contains filtered or unexported fields
}
Rule that blocks IP addresses from a network blacklist
func (*NetworksRule) Name ¶
func (rule *NetworksRule) Name() string
func (*NetworksRule) ReportSubnet ¶
func (rule *NetworksRule) ReportSubnet(ctx context.Context, cidr, source, reason string) error
func (*NetworksRule) UnreportSubnet ¶
func (rule *NetworksRule) UnreportSubnet(ctx context.Context, cidr string) error
type RateBucket ¶
type RateLimitRule ¶
type RateLimitRule struct {
// contains filtered or unexported fields
}
func NewRateLimitRule ¶
func NewRateLimitRule(conf *config.Config) *RateLimitRule
Creates a Tor exit rule.
func (*RateLimitRule) Name ¶
func (rule *RateLimitRule) Name() string
type Rule ¶
type Rule interface { // Returns the name of this rule. Name() string // Tests a given sample against this rule. Returns PASS, FAIL, or SKIP. Test(ctx context.Context, sample *model.Sample) int // Reports a given sample as abuse. Report(ctx context.Context, sample *model.Sample, user, reason string) }
The "rule" interface implements an abuse-testing rule.
type Ruleset ¶
type Ruleset struct {
// contains filtered or unexported fields
}
func ForContext ¶
Returns the Ruleset associated with this context.
type TorExitRule ¶
type TorExitRule struct {
// contains filtered or unexported fields
}
Rule that blocks IP addresses associated with Tor exit nodes
func (*TorExitRule) Name ¶
func (rule *TorExitRule) Name() string
Source Files
¶
Click to show internal directories.
Click to hide internal directories.