data

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 17, 2021 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockMessage

type BlockMessage struct {
	Stats                 //`json:"stats"`
	Reason    string      `json:"reason"`
	City      *geoip.City `json:"city"`
	BlockedAt time.Time   `json:"blocked_at"`
}

type Blocker

type Blocker interface {
	BlockASN(msg BlockMessage) error
	BlockIP(msg IPBlockMessage) error
	BlockNetwork(msg NetworkBlockMessage) error
	BlockedNetworks() []NetworkBlockMessage
	BlockedASNs() []BlockMessage
	BlockedIPs() []IPBlockMessage
	IPNamespace(ip []byte) []byte
	ASNNamespace(asn int) []byte
	CIDRNamespace(cidr string) []byte
	IsBlocked(ip net.IP, asn *asndb.ASN) bool
	IsBlockedByASN(asn *asndb.ASN) (blocked bool, reason string)
	CheckBlocked()
}

type IPBlockMessage

type IPBlockMessage struct {
	BlockMessage        //`json:"blockmessage"`
	IP           net.IP `json:"ip"`
	Hostname     string `json:"hostname"`
}

type IPStats

type IPStats struct {
	Stats
	IP           net.IP `json:"ip"`
	WithHostname int    `json:"with_hostname"`
}

type NetworkBlockMessage

type NetworkBlockMessage struct {
	BlockMessage            //`json:"blockmessage"`
	Network      *net.IPNet `json:"network"`
}

type NetworkStats

type NetworkStats struct {
	Stats
	Network      net.IPNet `json:"network"`
	NetworkSize  uint64    `json:"network_size"`
	NetworkRatio float64   `json:"network_ratio"`
}

type Request

type Request struct {
	URL       string     `json:"url"`
	Host      string     `json:"host"`
	UserAgent string     `json:"useragent"`
	Source    string     `json:"source"`
	Method    string     `json:"method"`
	Seq       int        `json:"seq"`
	Timestamp int64      `json:"timestamp"`
	Time      time.Time  `json:"time"`
	ASN       *asndb.ASN `json:"asn"`
	IsApp     bool       `json:"is_app"`
}

Request represents an HTTP request

type Stats

type Stats struct {
	Total int        `json:"total"`
	App   int        `json:"app"`
	Other int        `json:"other"`
	Ratio float64    `json:"ratio"`
	IPs   int        `json:"ips"`
	ASN   *asndb.ASN `json:"asn"`
}

Stats contains aggregated statistics about a single IP

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL