add mkdocs doc
parent
89e7b6fe89
commit
cc36d8a8af
@ -0,0 +1,82 @@
|
|||||||
|
command line options
|
||||||
|
=====================
|
||||||
|
|
||||||
|
###bind###
|
||||||
|
|
||||||
|
special the addres the dns server listen to
|
||||||
|
|
||||||
|
example:
|
||||||
|
`-bind 0.0.0.0:53`,
|
||||||
|
`-bind :53`,
|
||||||
|
`-bind 127.0.0.1:53`
|
||||||
|
|
||||||
|
###server###
|
||||||
|
|
||||||
|
special a filter file and the upstream dns server to use
|
||||||
|
format
|
||||||
|
|
||||||
|
**file_name**,**proto**:**addr**:**port**
|
||||||
|
|
||||||
|
**file_name** is the file name contains the domain list
|
||||||
|
|
||||||
|
**proto** is the upstream dns server protocol, `tcp` or `udp`
|
||||||
|
|
||||||
|
**addr** is the ip address of upstream dns server
|
||||||
|
|
||||||
|
**port** is the upstream dns server port
|
||||||
|
|
||||||
|
this options can special multipe times
|
||||||
|
|
||||||
|
example:
|
||||||
|
|
||||||
|
`-server domain1.json:udp:8.8.8.8:53`,
|
||||||
|
|
||||||
|
`-server domain1.json:tcp:4.2.2.2:53`,
|
||||||
|
|
||||||
|
`-server domin2.json:udp:49.32.34.44:5353`
|
||||||
|
|
||||||
|
see [example filter file](ex_config.md#filter-file)
|
||||||
|
|
||||||
|
###upstream###
|
||||||
|
|
||||||
|
special the default upstream dns server
|
||||||
|
|
||||||
|
format
|
||||||
|
|
||||||
|
**proto**:**addr**:**port**
|
||||||
|
|
||||||
|
**proto** is the upstream dns server protocol, `tcp` or `udp`
|
||||||
|
|
||||||
|
**addr** is the ip address of upstream dns server
|
||||||
|
|
||||||
|
**port** is the upstream dns server port
|
||||||
|
|
||||||
|
example:
|
||||||
|
|
||||||
|
`-upstream udp:10.10.1.1:53`
|
||||||
|
|
||||||
|
###logfile###
|
||||||
|
|
||||||
|
special the file name the log save to
|
||||||
|
|
||||||
|
example:
|
||||||
|
|
||||||
|
`-logfile /var/log/gdns.log`
|
||||||
|
|
||||||
|
###debug###
|
||||||
|
|
||||||
|
output the debug log or not, default false
|
||||||
|
|
||||||
|
this options is only used for debugging
|
||||||
|
|
||||||
|
###blacklist###
|
||||||
|
|
||||||
|
special the blacklist file
|
||||||
|
|
||||||
|
if the reply dns message contains the ip in the blacklist, the message will be dropped
|
||||||
|
|
||||||
|
example:
|
||||||
|
|
||||||
|
`-blacklist fakeip.json`
|
||||||
|
|
||||||
|
see [example black list](ex_config.md#blacklist-file)
|
@ -0,0 +1,61 @@
|
|||||||
|
Configure example
|
||||||
|
=============
|
||||||
|
|
||||||
|
Configure file
|
||||||
|
======
|
||||||
|
Use `gdns -h > config.ini` generate a example configure file
|
||||||
|
|
||||||
|
a configure file like this:
|
||||||
|
|
||||||
|
```conf
|
||||||
|
bind = :53 # the address bind to
|
||||||
|
blacklist = # the blacklist file
|
||||||
|
configUpdateInterval = 0 # Update interval for re-reading config file set via -config flag. Zero disables config file re-reading.
|
||||||
|
debug = false # output debug log, default false
|
||||||
|
logfile = error.log # the logfile, default stdout
|
||||||
|
server = filter1.txt,udp:8.8.8.8:53 # special the filter and the upstream server to use when match
|
||||||
|
# format:
|
||||||
|
# FILTER_FILE_NAME,PROTOCOL:SERVER_NAME:PORT
|
||||||
|
# example:
|
||||||
|
# filter1.json,udp:8.8.8.8:53
|
||||||
|
# means the domains in the filter1.json will use the google dns server by udp
|
||||||
|
# you can specail multiple filter and upstream server
|
||||||
|
#
|
||||||
|
upstream = udp:114.114.114.114:53 # the default upstream server to use
|
||||||
|
```
|
||||||
|
comamnd
|
||||||
|
`gdns -config dns.ini`
|
||||||
|
use the dns.ini as a configure file
|
||||||
|
|
||||||
|
Filter file
|
||||||
|
===========
|
||||||
|
The filter file is a domains name list
|
||||||
|
|
||||||
|
command line
|
||||||
|
`--server domain1.json,udp:8.8.8.8:53`
|
||||||
|
means the domain name listed in domoin1.json will use 8.8.8.8 as the upstream server through udp
|
||||||
|
|
||||||
|
a filter file like this
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"twitter.com":1,
|
||||||
|
"facebook.com":1,
|
||||||
|
"google.com":1
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
you can special multiple filter file and upstream dns server
|
||||||
|
|
||||||
|
Blacklist file
|
||||||
|
=============
|
||||||
|
The blacklist file contains the ip that the message will be dropped when the ip dispeared in the upstream server reply
|
||||||
|
|
||||||
|
the blacklist file like this
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"113.123.21.43":1,
|
||||||
|
"31.53.23.12":1
|
||||||
|
}
|
||||||
|
```
|
@ -0,0 +1,54 @@
|
|||||||
|
# gdns
|
||||||
|
a dns proxy server write by go
|
||||||
|
|
||||||
|
gdns much like dnsmasq or chinadns, but it can run on windows.
|
||||||
|
|
||||||
|
Features
|
||||||
|
========
|
||||||
|
|
||||||
|
support different domains use different upstream dns servers
|
||||||
|
|
||||||
|
support contact to the upstream dns server by tcp or udp
|
||||||
|
|
||||||
|
support blacklist list to block the fake ip
|
||||||
|
|
||||||
|
Install
|
||||||
|
=======
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# get the depended library
|
||||||
|
go get github.com/miekg/dns
|
||||||
|
go get github.com/vharitonsky/iniflags
|
||||||
|
|
||||||
|
git clone https://github.com/fangdingjun/gdns
|
||||||
|
cd gdns
|
||||||
|
go build
|
||||||
|
|
||||||
|
# generate a sample config file
|
||||||
|
./gdns -dumpflags > dns.ini
|
||||||
|
|
||||||
|
# edit the dns.ini and run, need root privileges to bind on port 53
|
||||||
|
sudo ./gdns -config dns.ini
|
||||||
|
|
||||||
|
# test it
|
||||||
|
dig @localhost twitter.com
|
||||||
|
```
|
||||||
|
|
||||||
|
Arguments
|
||||||
|
===========
|
||||||
|
|
||||||
|
use `gdns -h` to show the command line arguments.
|
||||||
|
|
||||||
|
all arguments can specialed in config file or in command line.
|
||||||
|
|
||||||
|
there is a sample file in the `config_sample/` directory.
|
||||||
|
|
||||||
|
Third-part library
|
||||||
|
==================
|
||||||
|
use
|
||||||
|
[dns](https://github.com/miekg/dns)
|
||||||
|
library to parse the dns message
|
||||||
|
|
||||||
|
use
|
||||||
|
[iniflags](https://github.com/vharitonsky/iniflags)
|
||||||
|
library to process the command line arguments and the config file
|
@ -0,0 +1,8 @@
|
|||||||
|
site_name: gdns
|
||||||
|
docs_dir: docs
|
||||||
|
pages:
|
||||||
|
- Usage: 'index.md'
|
||||||
|
- Command line options: 'command_line.md'
|
||||||
|
- Config example: 'ex_config.md'
|
||||||
|
|
||||||
|
theme: readthedocs
|
Loading…
Reference in New Issue