abuse

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var KnownProviderNames = map[string]struct{}{
	"ipapi.is":       {},
	"iplogs":         {},
	"blackbox":       {},
	"ip-api.com":     {},
	"rustyip":        {},
	"ippriv":         {},
	"iplookup.it":    {},
	"google-dns":     {},
	"cloudflare-dns": {},
}

Functions

func PurityFromSignals

func PurityFromSignals(r *ProviderResult) string

Types

type Provider

type Provider interface {
	Name() string
	Check(ctx context.Context, ip string) (*ProviderResult, error)
	RateLimit() RateLimit
}

type ProviderError

type ProviderError struct {
	Name   string
	Err    error
	Status int
}

func (*ProviderError) Error

func (e *ProviderError) Error() string

func (*ProviderError) Unwrap

func (e *ProviderError) Unwrap() error

type ProviderResult

type ProviderResult struct {
	Provider     string                 `json:"provider,omitempty"`
	Score        int                    `json:"score"`
	Confidence   float64                `json:"confidence"`
	Categories   []string               `json:"categories,omitempty"`
	IsDatacenter bool                   `json:"is_datacenter"`
	IsVPN        bool                   `json:"is_vpn"`
	IsProxy      bool                   `json:"is_proxy"`
	IsTor        bool                   `json:"is_tor"`
	Purity       string                 `json:"purity,omitempty"`
	Country      string                 `json:"country,omitempty"`
	CountryCode  string                 `json:"country_code,omitempty"`
	Raw          map[string]interface{} `json:"raw,omitempty"`
}

func Merge

func Merge(results []ProviderResult) ProviderResult

func NormalizeResult

func NormalizeResult(provider string, r *ProviderResult) *ProviderResult

type RateLimit

type RateLimit struct {
	RequestsPerMinute int
	Burst             int
}

type Reporter

type Reporter struct{}

Reporter provides a backward-compatible zero-network abuse lookup.

func NewReporter

func NewReporter() *Reporter

func (*Reporter) Check

func (r *Reporter) Check(ip string) (*Result, error)

func (*Reporter) CheckContext

func (r *Reporter) CheckContext(ctx context.Context, ip string) (*ProviderResult, error)

type Result

type Result struct {
	Score      int      `json:"score"`
	Reports    int      `json:"reports"`
	Categories []string `json:"categories,omitempty"`
	LastReport string   `json:"last_report,omitempty"`
	Confidence float64  `json:"confidence"`
}

Result contains legacy aggregate abuse reputation data.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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