Categorygithub.com/asphaltt/dnsproxy-go
modulepackage
0.0.0-20181028064240-4c302a933bd0
Repository: https://github.com/asphaltt/dnsproxy-go.git
Documentation: pkg.go.dev

# README

A simple library for DNS proxy

This is a completed DNS proxy.

Usage

Like example as cmd/dnsproxy

go get github.com/Asphaltt/dnsproxy-go

and use the library in your project.

	cfg := &dnsproxy.Config{
		Addr:          ":53",
		UpServers:     []string{"8.8.8.8"},
		WithCache:     true,
		CacheFile:     "cache.json",
		WorkerPoolMin: 100,
		WorkerPoolMax: 1000,
	}

	if err := dnsproxy.Start(cfg); err != nil {
		return
	}
	defer dnsproxy.Close()

Or you can compile cmd/dnsproxy to run as a dns proxy server.

License

MIT License

# Packages

No description provided by the author

# Functions

Close closes the running dnsproxy.
FindCname gets the final cname in the msg.
FindExtras gets a string array from msg's extra rr.
FindNS gets a string array from msg's ns rr, which has no answer.
FindNSExtras gets a copied message from msg, the copy's answer is msg's extra.
GotAnswer gets whether do get the answer, whose RRtype is same as Qtype or the NS RR is a SOA.
IsEmptyResponse gets whether the msg is an empty response which has no answer, no ns and no extra.
IsSuccessfulResponse gets whether the msg is a successful response.
NewQuery creates a new dns query messge.
NewRecord creates a new record from msg.
NewResponse creates a new dns response message with the gived rcode.
NewTrie creates a new trie.
Start starts to run dnsproxy-server.

# Variables

predefined errors.
predefined errors.
predefined errors.
predefined errors.
predefined errors.
predefined errors.

# Structs

Config is the config about the dnsproxy.
Record is a cached record, Expired is the expire timestamp, Msg is the dns message.
Trie is a standard trie tree for dns.