Documentation ¶
Index ¶
- Variables
- type APITrafficBlacklistPostRequestBody
- type APITrafficWhitelistPostRequestBody
- type AutobanProfile
- type ListOfTopItem
- type Monitoring
- func (s *Monitoring) Add(ip net.IP, timestamp time.Time) error
- func (s *Monitoring) Clear(ctx context.Context) error
- func (s *Monitoring) ClearIP(ctx context.Context, ip net.IP) error
- func (s *Monitoring) ExistsIP(ip net.IP) (bool, error)
- func (s *Monitoring) GC(ctx context.Context) (int64, error)
- func (s *Monitoring) ListByBanProfile(ctx context.Context, profile AutobanProfile) ([]net.IP, error)
- func (s *Monitoring) ListOfTop(ctx context.Context, limit int) ([]ListOfTopItem, error)
- func (s *Monitoring) Listen(url string, queue string, quitChan chan bool) error
- type MonitoringInputMessage
- type Traffic
- func (s *Traffic) AutoBan(ctx context.Context) error
- func (s *Traffic) AutoBanByProfile(ctx context.Context, profile AutobanProfile) error
- func (s *Traffic) AutoWhitelist(ctx context.Context) error
- func (s *Traffic) AutoWhitelistIP(ctx context.Context, ip net.IP) error
- func (s *Traffic) SetupPrivateRouter(r *gin.Engine)
- type Whitelist
- func (s *Whitelist) Add(ctx context.Context, ip net.IP, desc string) error
- func (s *Whitelist) Exists(ctx context.Context, ip net.IP) (bool, error)
- func (s *Whitelist) Get(ctx context.Context, ip net.IP) (*WhitelistItem, error)
- func (s *Whitelist) List(ctx context.Context) ([]*WhitelistItem, error)
- func (s *Whitelist) MatchAuto(ip net.IP) (bool, string)
- func (s *Whitelist) Remove(ctx context.Context, ip net.IP) error
- type WhitelistItem
Constants ¶
This section is empty.
Variables ¶
View Source
var AutobanProfiles = []AutobanProfile{ { Limit: dailyLimit, Reason: "daily limit", Group: []string{}, Time: dailyLimitDuration, }, { Limit: hourlyLimit, Reason: "hourly limit", Group: []string{"hour"}, Time: hourlyLimitDuration, }, { Limit: tenMinsLimit, Reason: "ten min limit", Group: []string{"hour", "tenminute"}, Time: time.Hour * hoursInDay, }, { Limit: oneMinLimit, Reason: "min limit", Group: []string{"hour", "tenminute", "minute"}, Time: halfDay, }, }
AutobanProfiles AutobanProfiles.
View Source
var ErrWhitelistItemNotFound = errors.New("whitelist item not found")
Functions ¶
This section is empty.
Types ¶
type APITrafficBlacklistPostRequestBody ¶
type APITrafficBlacklistPostRequestBody struct { IP net.IP `json:"ip"` Period int `json:"period"` Reason string `json:"reason"` }
APITrafficBlacklistPostRequestBody APITrafficBlacklistPostRequestBody.
type AutobanProfile ¶
AutobanProfile AutobanProfile.
type ListOfTopItem ¶
ListOfTopItem ListOfTopItem.
type Monitoring ¶
type Monitoring struct {
// contains filtered or unexported fields
}
Monitoring Main Object.
func NewMonitoring ¶
func NewMonitoring(db *goqu.Database) (*Monitoring, error)
NewMonitoring constructor.
func (*Monitoring) Clear ¶
func (s *Monitoring) Clear(ctx context.Context) error
Clear removes all collected data.
func (*Monitoring) ExistsIP ¶
func (s *Monitoring) ExistsIP(ip net.IP) (bool, error)
ExistsIP ban list already contains IP.
func (*Monitoring) GC ¶
func (s *Monitoring) GC(ctx context.Context) (int64, error)
GC Garbage Collect.
func (*Monitoring) ListByBanProfile ¶
func (s *Monitoring) ListByBanProfile(ctx context.Context, profile AutobanProfile) ([]net.IP, error)
ListByBanProfile ListByBanProfile.
func (*Monitoring) ListOfTop ¶
func (s *Monitoring) ListOfTop(ctx context.Context, limit int) ([]ListOfTopItem, error)
ListOfTop ListOfTop.
type MonitoringInputMessage ¶
MonitoringInputMessage InputMessage.
type Traffic ¶
type Traffic struct { Monitoring *Monitoring Whitelist *Whitelist Ban *ban.Repository // contains filtered or unexported fields }
Traffic Traffic.
func NewTraffic ¶
func NewTraffic( pool *goqu.Database, autowpDB *goqu.Database, enforcer *casbin.Enforcer, ban *ban.Repository, userExtractor *users.UserExtractor, ) (*Traffic, error)
NewTraffic constructor.
func (*Traffic) AutoBanByProfile ¶
func (s *Traffic) AutoBanByProfile(ctx context.Context, profile AutobanProfile) error
func (*Traffic) AutoWhitelistIP ¶
func (*Traffic) SetupPrivateRouter ¶
type Whitelist ¶
type Whitelist struct {
// contains filtered or unexported fields
}
Whitelist Main Object.
func NewWhitelist ¶
NewWhitelist constructor.
func (*Whitelist) List ¶
func (s *Whitelist) List(ctx context.Context) ([]*WhitelistItem, error)
List whitelist items.
type WhitelistItem ¶
WhitelistItem WhitelistItem.
Click to show internal directories.
Click to hide internal directories.