Documentation ¶
Index ¶
- func LookupASNString(asn string) ([]string, error)
- func LookupCountry(country string) ([]string, error)
- func LookupDomain(domain string) ([]string, error)
- func LookupIP(ip net.IP) ([]string, error)
- func LookupIPString(ipStr string) ([]string, error)
- func LookupIPv4(ipv4 net.IP) ([]string, error)
- func LookupIPv4String(ipv4 string) ([]string, error)
- func LookupIPv6(ipv6 net.IP) ([]string, error)
- func LookupIPv6String(ipv6 string) ([]string, error)
- func ResolveListIDs(ids []string) ([]string, error)
- type Category
- type ListIndexFile
- type Source
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LookupASNString ¶
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 ¶
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 ¶
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.
func LookupIP ¶
LookupIP returns a list of block sources that contain a reference to ip. LookupIP automatically checks the IPv4 or IPv6 lists respectively.
func LookupIPString ¶
LookupIPString is like LookupIP but accepts an IPv4 or IPv6 address in their string representations.
func LookupIPv4 ¶
LookupIPv4 is like LookupIPv4String but accepts a net.IP.
func LookupIPv4String ¶
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 ¶
LookupIPv6 is like LookupIPv6String but accepts a net.IP.
func LookupIPv6String ¶
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 ¶
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.