apiban

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2023 License: GPL-2.0 Imports: 7 Imported by: 0

README

APIBAN-tools

apiban-tools is brought to you by apiban.org and is an open source set of tools to help automate apiban based actions, such as check, get, etc.

For more information, please visit apiban.org.

APIBAN is made possible by the generosity of our sponsors.

Getting Help

Help is provided by LOD (https://www.lod.com) and an APIBAN room (#apiban:matrix.lod.com) is available on the LOD Matrix server. The software is provided under the GPLv2 license.

Warranty

ABIBAN data is provided in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBadRequest = errors.New("bad request")

ErrBadRequest indicates a 400 response was received;

NOTE: this is used by the server to indicate both that an IP address is not blocked (when calling Check) and that the list is complete (when calling Banned)

View Source
var (
	// RootURL is the base URI of the APIBAN.org API server
	RootURL = "https://apiban.org/api/"
)

Functions

func Check

func Check(key string, ip string, set string) (bool, error)

Check queries APIBAN.org to see if the provided IP address is blocked.

Types

type ApiGetCheck

type ApiGetCheck struct {
	SetType string `json:"set"`
	IP      string `json:"ipaddress"`
}

type ApiGetJson

type ApiGetJson struct {
	SetType string `json:"set"`
	ID      string `json:"id"`
}

type Entry

type Entry struct {

	// ID is the timestamp of the next Entry
	ID string `json:"ID"`

	// IPs is the list of blocked IP addresses in this entry
	IPs []string `json:"ipaddress"`
}

Entry describes a set of blocked IP addresses from APIBAN.org

func Banned

func Banned(key string, startFrom string, set string) (*Entry, error)

Banned returns a set of banned addresses, optionally limited to the specified startFrom ID. If no startFrom is supplied, the entire current list will be pulled.

Jump to

Keyboard shortcuts

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