DNSBinarySearch

package
v0.0.0-...-ef1c39f Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2019 License: MIT Imports: 7 Imported by: 2

Documentation

Index

Constants

View Source
const MAXLINESIZE = 500

we expect every line to be less than 500 bytes (DNS only allows 255)

View Source
const WALKBYTES = 10000

scan backwards 10 kilobytes at a time looking for the edge of our matched string

Variables

View Source
var DefaultLimits = Limits{
	MaxScan:        100,
	MaxOutputLines: 100000,
}

Functions

func DNSBinarySearch

func DNSBinarySearch(filePath string, searchStr string, limit Limits) (ret []string, err error)

pass a file path and search string to search for matches expects the file to sorted, with domain names at the start of the file, in reverse order example: "moc.elpmaxe.www,1.1.1.1" returns a list of matches example ["1.1.1.1,www.example.com"]

Types

type Limits

type Limits struct {
	// the maximum distance to scan backwards (x 10kB)
	MaxScan int
	// the maximum number of lines of output
	MaxOutputLines int
}

we use 2 limits to limit runtime & output size of these library

Jump to

Keyboard shortcuts

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