filterlists

package
v1.6.5 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: AGPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetUnbreakFilterListIDs added in v0.9.5

func GetUnbreakFilterListIDs() []string

GetUnbreakFilterListIDs returns the resolved list of all unbreak filter lists.

func LookupASNString

func LookupASNString(asn string) ([]string, error)

LookupASNString returns a list of sources that mark the ASN as blocked. If ASN is not stored in the cache database a nil slice is returned.

func LookupCountry

func LookupCountry(country string) ([]string, error)

LookupCountry returns a list of sources that mark the country as blocked. If country is not stored in the cache database a nil slice is returned.

func LookupDomain

func LookupDomain(domain string) ([]string, error)

LookupDomain returns a list of sources that mark the domain as blocked. If domain is not stored in the cache database a nil slice is returned. The caller is responsible for making sure that the given domain is valid and canonical.

func LookupIP

func LookupIP(ip net.IP) ([]string, error)

LookupIP returns a list of block sources that contain a reference to ip. LookupIP automatically checks the IPv4 or IPv6 lists respectively.

func LookupIPString

func LookupIPString(ipStr string) ([]string, error)

LookupIPString is like LookupIP but accepts an IPv4 or IPv6 address in their string representations.

func LookupIPv4

func LookupIPv4(ipv4 net.IP) ([]string, error)

LookupIPv4 is like LookupIPv4String but accepts a net.IP.

func LookupIPv4String

func LookupIPv4String(ipv4 string) ([]string, error)

LookupIPv4String returns a list of block sources that contain a reference to ip. If the IP is not stored in the cache database a nil slice is returned.

func LookupIPv6

func LookupIPv6(ipv6 net.IP) ([]string, error)

LookupIPv6 is like LookupIPv6String but accepts a net.IP.

func LookupIPv6String

func LookupIPv6String(ipv6 string) ([]string, error)

LookupIPv6String returns a list of block sources that contain a reference to ip. If the IP is not stored in the cache database a nil slice is returned.

func ResolveListIDs

func ResolveListIDs(ids []string) ([]string, error)

ResolveListIDs resolves a slice of source or category IDs into a slice of distinct source IDs.

Types

type Category

type Category struct {
	// ID is a unique ID for the category. For sub-categories
	// this ID must be used in the Parent field of any directly
	// nesteded categories.
	ID string `json:"id"`

	// Parent may hold the ID of another category. If set, this
	// category is made a sub-category of it's parent.
	Parent string `json:"parent,omitempty"`

	// Name is a human readable name for the category and can
	// be used in user interfaces.
	Name string `json:"name"`

	// Description is a human readable description that may be
	// displayed in user interfaces.
	Description string `json:"description,omitempty"`
}

Category is used to group different list sources by the type of entity they are blocking. Categories may be nested using the Parent field.

type ListIndexFile

type ListIndexFile struct {
	record.Base
	sync.RWMutex

	Version       string     `json:"version"`
	SchemaVersion string     `json:"schemaVersion"`
	Categories    []Category `json:"categories"`
	Sources       []Source   `json:"sources"`
}

ListIndexFile describes the structure of the released list index file.

type Source

type Source struct {
	// ID is a unique ID for the source. Entities always reference the
	// sources they have been observed in using this ID. Refer to the
	// Entry struct for more information.
	ID string `json:"id"`

	// Name is a human readable name for the source and can be used
	// in user interfaces.
	Name string `json:"name"`

	// Description may hold a human readable description for the source.
	// It may be used in user interfaces.
	Description string `json:"description"`

	// Type describes the type of entities the source provides. Refer
	// to the Type definition for more information and well-known types.
	Type string `json:"type"`

	// URL points to the filterlists file.
	URL string `json:"url"`

	// Category holds the unique ID of a category the source belongs to. Since
	// categories can be nested the source is automatically part of all categories
	// in the hierarchy. Refer to the Category struct for more information.
	Category string `json:"category"`

	// Website may holds the URL of the source maintainers website.
	Website string `json:"website,omitempty"`

	// License holds the license that is used for the source.
	License string `json:"license"`

	// Contribute may hold an opaque string that informs a user on how to
	// contribute to the source. This may be a URL or mail address.
	Contribute string `json:"contribute"`
}

Source defines an external filterlists source.

Jump to

Keyboard shortcuts

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