Help us shape the future of Go! Take the 2026 Go Developer Survey

fingerprint

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package fingerprint matches DNS answers and HTTP responses against known block stubs and block pages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsBogon

func IsBogon(s string) bool

IsBogon reports whether ip is not a valid public unicast address (private, loopback, link-local, CGNAT, documentation, unspecified...).

Types

type DB

type DB struct {
	DNS  []DNSStub  `yaml:"dns"`
	HTTP []HTTPPage `yaml:"http"`
	// contains filtered or unexported fields
}

DB is a fingerprint database.

func Default

func Default() *DB

Default returns the embedded fingerprint database.

func Parse

func Parse(b []byte) (*DB, error)

Parse decodes a fingerprint database.

func (*DB) MatchDNS

func (db *DB) MatchDNS(addrs []string) string

MatchDNS returns the fingerprint id when any address is a known stub.

func (*DB) MatchHTTP

func (db *DB) MatchHTTP(location string, body []byte) string

MatchHTTP returns the fingerprint id when the redirect location or body matches.

type DNSStub

type DNSStub struct {
	ID  string `yaml:"id"`
	IP  string `yaml:"ip"`
	ISP string `yaml:"isp"`
}

DNSStub is a known stub address returned instead of the real one.

type HTTPPage

type HTTPPage struct {
	ID      string `yaml:"id"`
	Where   string `yaml:"where"` // location | body
	Match   string `yaml:"match"` // prefix | contains | exact
	Pattern string `yaml:"pattern"`
}

HTTPPage is a known block page indicator.

Jump to

Keyboard shortcuts

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