gorbl

package module
v0.0.0-...-39bf590 Latest Latest
Warning

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

Go to latest
Published: May 15, 2015 License: MIT Imports: 3 Imported by: 4

README

gorbl

Real-time Blackhole List (RBL) lookups for Golang.

GoDoc Build Status

Author

James Polera james@uncryptic.com

Dependencies

No external dependencies. Uses Go's standard packages

Example

package main

import (
	"encoding/json"
	"fmt"

	"github.com/polera/gorbl"
)

func main() {

	r := gorbl.Lookup("b.barracudacentral.org", "smtp.gmail.com")
	json_res, _ := json.Marshal(r)
	fmt.Printf("%v\n", string(json_res))

	/*
		{
		    "host": "smtp.gmail.com",
		    "list": "b.barracudacentral.org",
		    "results": [
		        {
		            "address": "173.194.206.109",
		            "error": true,
		            "error_type": {
		                "Err": "no such host",
		                "IsTimeout": false,
		                "Name": "109.206.194.173.b.barracudacentral.org",
		                "Server": ""
		            },
		            "listed": false,
		            "text": ""
		        },
		        {
		            "address": "173.194.206.108",
		            "error": true,
		            "error_type": {
		                "Err": "no such host",
		                "IsTimeout": false,
		                "Name": "108.206.194.173.b.barracudacentral.org",
		                "Server": ""
		            },
		            "listed": false,
		            "text": ""
		        }
		    ]
			}
	*/

}

Documentation

Overview

Package gorbl lets you perform RBL (Real-time Blackhole List - https://en.wikipedia.org/wiki/DNSBL) lookups using Golang

This package takes inspiration from a similar module that I wrote in Python (https://github.com/polera/rblwatch).

gorbl takes a simpler approach: Basic lookup capability is provided by the lib. Unlike in rblwatch, concurrent lookups and the lists to search are left to those using the lib.

JSON annotations on the types are provided as a convenience.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Reverse

func Reverse(ip net.IP) string

Reverse the octets of a given IPv4 address 64.233.171.108 becomes 108.171.233.64

Types

type RBLResults

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

RBLResults holds the results of the lookup.

func Lookup

func Lookup(rblList string, targetHost string) (r RBLResults)

Lookup performs the search and returns the RBLResults

type Result

type Result struct {
	// Address is the IP address that was searched
	Address string `json:"address"`
	// 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
	Error bool `json:"error"`
	// 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