godnsbl

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

README

godnsbl

Golang DNSBL lookup library

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDNSTimeout = errors.New("godnsbl: DNS Timeout")
	ErrInvalidIP  = errors.New("godnsbl: Invalid IP Address")
)
View Source
var (
	Blacklists = []string{
		"zen.spamhaus.org",
		"bl.spamcop.net",
		"psbl.surriel.com",
		"ix.dnsbl.manitu.net",
		"dnsbl.sorbs.net",
		"blackholes.five-ten-sg.com",

		"l2.apews.org",
		"dnsbl-1.uceprotect.net",
		"dnsbl-2.uceprotect.net",
		"dnsbl-3.uceprotect.net",
		"spam.spamrats.com",
		"dnsbl.kempt.net",
		"b.barracudacentral.org",
		"dnsbl.spfbl.net",
	}
)

Blacklists is the list of blackhole lists to check against

Functions

func ReverseIP

func ReverseIP(ip net.IP) (string, error)

ReverseIP reverses the IP address octets

Types

type RBLResults

type RBLResults struct {
	// Host is the host or IP that was passed (i.e. smtp.gmail.com)
	Host  string `json:"host"`
	Err   error  `json:"err"`
	RCode int
	// Results is a slice of Results - one per Blacklist address searched
	Results []Result `json:"results"`
}

RBLResults holds the results of the lookup.

func Lookup

func Lookup(host, server string, port int) RBLResults

Lookup Queries []Blacklists against a server TODO: init the library with multiple servers

type Result

type Result struct {
	// List is the RBL that was searched
	List       string `json:"address"`
	LookupHost string `json:"lookup"`
	// Listed indicates whether or not the IP was on the RBL
	Listed bool `json:"listed"`
	// RBL lists sometimes add extra information as a TXT record
	// if any info is present, it will be stored here.
	Text string `json:"text"`
	// Error represents any error that was encountered (DNS timeout, host not
	// found, etc.) if any
	Rcode int `json:"rcode"`
	// TTL is the DNS ttl returned
	TTL uint32 `json:"ttl"`
	// ErrorType is the type of error encountered if any
	ErrorType error `json:"error_type"`
}

Result holds the individual IP lookup results for each RBL search

Jump to

Keyboard shortcuts

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