ip_score

package module
v0.0.0-...-366ac3d Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IpScore

type IpScore struct {
	// Api Url is the API key from AbuseIPDB.
	ApiUrl string `json:"api_url,omitempty"`
	// WhitelistedIPs is a regex of whitelisted IPs. (optional)
	WhitelistedIPs string `json:"whitelisted_ips,omitempty"`

	Logger *zap.Logger
}

ListenCaddy is a Caddy http.handlers module that listens for requests to specific URIs/paths and reports IPs that hit these URIs to AbuseIPDB.

func (IpScore) CaddyModule

func (IpScore) CaddyModule() caddy.ModuleInfo

func (*IpScore) Provision

func (l *IpScore) Provision(ctx caddy.Context) error

func (IpScore) ServeHTTP

func (l IpScore) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error

func (*IpScore) UnmarshalCaddyfile

func (l *IpScore) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile implements caddyfile.Unmarshaler.

func (*IpScore) Validate

func (l *IpScore) Validate() error

type Response

type Response struct {
	Ip        string `json:"ip,omitempty"`
	IpVersion int    `json:"ipVersion,omitempty"`
	Country   string `json:"country,omitempty"`
	Score     int    `json:"score,omitempty"`
	IsVPN     bool   `json:"isVpn,omitempty"`
	Time      int    `json:"time,omitempty"`
	TimeStr   string `json:"timeStr,omitempty"`
	IsSafe    bool   `json:"isSafe,omitempty"`
}

Jump to

Keyboard shortcuts

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