veild: github.com/jamesduncombe/veild Index | Files

package veild

import "github.com/jamesduncombe/veild"

Package veild is the main veil package for handling DNS to DNS-over-TLS connections.

Index

Package Files

blacklist.go dns_parse.go pconn.go pool.go query_cache.go resolvers.go response_cache.go veild.go

Constants

const (
    // PacketLength is the maximum allowed packet length for a DNS packet.
    PacketLength int = 512

    // HeaderLength is the length of a normal DNS request/response header (in bytes).
    HeaderLength int = 12
)

Variables

var (
    // ErrInvalidRType is returned when a mapping cannot be found between
    // the numeric representation of an RR type and it's string.
    ErrInvalidRType = errors.New("invalid rtype")
)

Errors in the DNS parse phase.

var (
    // ErrProblemParsingOffsets is returned when a TTL offset cannot be parsed.
    ErrProblemParsingOffsets = errors.New("problem parsing TTL offsets")
)

Errors in the query cache.

var ResourceTypes = map[uint16]string{
    1:   "A",
    2:   "NS",
    5:   "CNAME",
    6:   "SOA",
    12:  "PTR",
    15:  "MX",
    16:  "TXT",
    28:  "AAAA",
    33:  "SRV",
    255: "ANY",
    257: "CAA",
}

ResourceTypes maps resource record (RR) types to string representations.

func Run Uses

func Run(config *Config)

Run starts up the app.

type Blacklist Uses

type Blacklist struct {
    // contains filtered or unexported fields
}

Blacklist represents a blacklist.

func NewBlacklist Uses

func NewBlacklist(blacklistPath string) (*Blacklist, error)

NewBlacklist creates a new Blacklist from a given hosts file.

func (*Blacklist) Exists Uses

func (b *Blacklist) Exists(item string) bool

Exists returns a boolean as to whether this entry was found or not in the list.

type Config Uses

type Config struct {
    ListenAddr    string
    Caching       bool
    OutboundPort  uint
    BlacklistFile string
    ResolversFile string
}

Config represents the command line options.

type PConn Uses

type PConn struct {
    // contains filtered or unexported fields
}

PConn holds persistent connections.

func NewPConn Uses

func NewPConn(p *Pool, cache *ResponseCache, host, serverName string) (*PConn, error)

NewPConn creates a new PConn which is an actual connection to an upstream DNS server.

type Packet Uses

type Packet struct {
    // contains filtered or unexported fields
}

Packet represents the structure of a client request.

type Pool Uses

type Pool struct {
    // contains filtered or unexported fields
}

Pool represents a new connection pool.

func NewPool Uses

func NewPool() *Pool

NewPool creates a new connection pool.

func (*Pool) ConnectionManagement Uses

func (p *Pool) ConnectionManagement()

ConnectionManagement management handles reconnects.

func (*Pool) Dispatch Uses

func (p *Pool) Dispatch()

Dispatch handles dispatching requests to the underlying workers.

func (*Pool) NewWorker Uses

func (p *Pool) NewWorker(host, serverName string)

NewWorker adds a new worker to the Pool.

func (*Pool) Stats Uses

func (p *Pool) Stats()

Stats prints out connection stats every x seconds.

type Query Uses

type Query struct {
    // contains filtered or unexported fields
}

Query holds the structure for the raw response data and offsets of TTLs.

type QueryCache Uses

type QueryCache struct {
    // contains filtered or unexported fields
}

QueryCache holds the main structure of the query cache.

func NewQueryCache Uses

func NewQueryCache() *QueryCache

NewQueryCache handles QueryCache initialization.

func (*QueryCache) Get Uses

func (r *QueryCache) Get(key [sha1.Size]byte) (interface{}, bool)

Get gets an entry from the query cache.

func (*QueryCache) Put Uses

func (r *QueryCache) Put(key [sha1.Size]byte, value Query)

Put puts an entry into the query cache.

func (*QueryCache) Reaper Uses

func (r *QueryCache) Reaper()

Reaper ticks over every second and runs through the TTL decrements.

type RR Uses

type RR struct {
    // contains filtered or unexported fields
}

RR represents a domain name and resource type.

func NewRR Uses

func NewRR(data []byte) (*RR, error)

NewRR returns a new RR.

type Resolver Uses

type Resolver struct {
    Address  string
    Hostname string
    Hash     string
    Pin      string
}

Resolver implements a resolver.

type Resolvers Uses

type Resolvers struct {
    Resolvers []Resolver
}

Resolvers implements a list of resolvers.

func NewResolvers Uses

func NewResolvers(resolversPath string) (*Resolvers, error)

NewResolvers loads of a list of resolvers from a file.

type ResponseCache Uses

type ResponseCache struct {
    // contains filtered or unexported fields
}

ResponseCache represents a response cache.

func NewResponseCache Uses

func NewResponseCache() *ResponseCache

NewResponseCache handles ResponseCache initialization.

func (*ResponseCache) Get Uses

func (r *ResponseCache) Get(key uint16) (interface{}, bool)

Get gets an entry from the response cache.

func (*ResponseCache) Put Uses

func (r *ResponseCache) Put(key uint16, value Packet)

Put puts an entry into the response cache.

type Worker Uses

type Worker struct {
    // contains filtered or unexported fields
}

Worker represents a worker in the pool.

Package veild imports 17 packages (graph). Updated 2019-01-28. Refresh now. Tools for package owners.