abuseip

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AbuseIPDBAPIURL is the base URL of the AbuseIPDB API
	AbuseIPDBAPIURL = "https://api.abuseipdb.com/api/v2/check"
)

Variables

View Source
var (
	// ErrEmptyAPIKey is returned when the API key is empty
	ErrEmptyAPIKey = errors.New("abuseipdb: API key is empty")
	// ErrInvalidResponse is returned when the API response is invalid
	ErrInvalidResponse = errors.New("abuseipdb: invalid API response")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client manages requests to the AbuseIPDB API

func NewClient

func NewClient(apiKey string) (*Client, error)

NewClient creates a new AbuseIPDB client

func (*Client) Check

func (c *Client) Check(ip string) (domain.IPScore, string, error)

Check verifies the reputation score of an IP address

type Response

type Response struct {
	Data struct {
		AbuseConfidenceScore int    `json:"abuseConfidenceScore"`
		CountryCode          string `json:"countryCode"`
		IsWhitelisted        bool   `json:"isWhitelisted"`
		TotalReports         int    `json:"totalReports"`
	} `json:"data"`
}

Response represents the AbuseIPDB API response

Jump to

Keyboard shortcuts

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