dnsproxy

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2017 License: MIT Imports: 18 Imported by: 1

README

dnsproxy

Travis status

DNS 服务器 + 代理服务器

作为 DNS 服务器使用时

  • 中国大陆的域名 通过国内 DNS 服务器查询
  • gfwlist 中的域名通过代理服务器向国外 DNS 服务器查询
  • 不在以上两者中的域名:先通过代理服务器向国外 DNS 服务器查询,如果得到中国大陆 IP 则再通过国内 DNS 服务器查询一次以试图获取更好的 IP 质量

作为代理服务器使用时

获取与安装

直接下载二进制文件

See the releases page

通过 docker 编译
$ docker build -t dnsproxy https://raw.githubusercontent.com/ARwMq9b6/dnsproxy/master/cmd/dnsproxy/Dockerfile
$ docker run -v $PWD/target:/target dnsproxy
本地编译
$ go get -d -u github.com/ARwMq9b6/dnsproxy
$ cd $GOPATH/src/github.com/ARwMq9b6/dnsproxy/cmd/dnsproxy
$ make

Documentation

Index

Constants

View Source
const (
	AddrIPv4   uint8 = gosocks5.AddrIPv4
	AddrDomain       = gosocks5.AddrDomain
	AddrIPv6         = gosocks5.AddrIPv6
)

Variables

This section is empty.

Functions

func InitGlobals

func InitGlobals(ipc ipcache, domainc domaincache,
	dm DomainMatcher, ipMatchCHN func(net.IP) bool,
	subnetLocalIP, subnetProxyIP net.IP,
	dtObedient, dtAbroad *dnsTransport)

init global vars

func MsgExchangeOverGoogleDOH

func MsgExchangeOverGoogleDOH(req *dns.Msg, rt http.RoundTripper) (resp *dns.Msg, err error)

Perform query into Google DNS over HTTPS server

func MsgExtractAnswer

func MsgExtractAnswer(msg *dns.Msg) (dns.RR, net.IP)

extract answer from dns msg FIXME: deal with name alias

func MsgNewReplyFromReq

func MsgNewReplyFromReq(req *dns.Msg, answer ...dns.RR) *dns.Msg

--- impl dns.Msg

func MsgSetECSWithAddr

func MsgSetECSWithAddr(m *dns.Msg, addr net.IP)

set edns-client-subnet ip

func NewDnsTransport

func NewDnsTransport(nameserver, net string, _proxy proxy.Dialer) *dnsTransport

func NewDomaincache

func NewDomaincache(defaultExpiration, cleanupInterval time.Duration) domaincache

--- impl domaincache

func NewIpcache

func NewIpcache(defaultExpiration, cleanupInterval time.Duration) ipcache

--- impl ipcache

func RRNewFromGoogleDohRR

func RRNewFromGoogleDohRR(grr google.DNSRR) dns.RR

Initialize a new RRGeneric from a google dns over https RR

func ServeDNS

func ServeDNS(laddr string) error

func ServeProxy

func ServeProxy(laddr string, proxy, direct *gost.ProxyChain) error

Types

type DomainMatcher

type DomainMatcher interface {
	MatchGFW(domain string) bool
	MatchObedient(domain string) bool
}

check if a domain in

  • gfw list
  • obedient list
  • neither

Directories

Path Synopsis
cmd
dns_over_https

Jump to

Keyboard shortcuts

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