• This repository has been archived on 24/Mar/2023
  • Stars
    star
    190
  • Rank 197,252 (Top 4 %)
  • Language
    Python
  • License
    MIT License
  • Created over 9 years ago
  • Updated almost 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A lightweight yet useful proxy DNS server powered by Python Twisted

SimpleDNS

https://badge.fury.io/py/simpledns.png

A lightweight yet useful proxy DNS server designed to cope with complicated Internet environment in China, inspired by ChinaDNS , dnsmasq-chinadns and fqdns, powered by Python Twisted.

Requirement

  • Python 3.4
  • Twisted
  • Tornado for using Tornado IOLoop(optional)

Install

  • Linux/Mac OS X:

    # Clone this project
    $ sudo python setup.py install
    

Usage

Run sudo simpledns on your local machine. Then set your DNS server to 127.0.0.1.

$ dig www.twitter.com +short @127.0.0.1
twitter.com.
199.59.149.230
199.59.148.10
199.59.150.7
199.59.150.39

Note that the default cache lifetime depends on the ttl of DNS answer. You may want to set a larger ttl using --min-ttl to extend the cache lifetime.

Advanced

$ simpledns -h
usage: simpledns [-h] [-b BIND_ADDR] [-p BIND_PORT]
                 [--upstream-ip UPSTREAM_IP] [--upstream-port UPSTREAM_PORT]
                 [--query-timeout QUERY_TIMEOUT] [--min-ttl MIN_TTL]
                 [--max-ttl MAX_TTL] [--cache-size CACHE_SIZE] [-t]
                 [--hosts-file HOSTS_FILE] [--dispatch-conf DISPATCH_CONF]
                 [-v {0,1,2}] [-q] [-V]

A lightweight yet useful proxy DNS server

optional arguments:
  -h, --help            show this help message and exit
  -b BIND_ADDR, --bind-addr BIND_ADDR
                        local address to listen
  -p BIND_PORT, --bind-port BIND_PORT
                        local port to listen
  --upstream-ip UPSTREAM_IP
                        upstream DNS server ip address
  --upstream-port UPSTREAM_PORT
                        upstream DNS server port
  --query-timeout QUERY_TIMEOUT
                        time before close port used for querying
  --min-ttl MIN_TTL     the minimum time a record is held in cache
  --max-ttl MAX_TTL     the maximum time a record is held in cache
  --cache-size CACHE_SIZE
                        record cache size
  -t, --tcp-server      enables TCP serving
  --hosts-file HOSTS_FILE
                        hosts file
  --dispatch-conf DISPATCH_CONF
                        URL dispatch conf file
  -v {0,1,2}, --verbosity {0,1,2}
                        output verbosity
  -q, --quiet           disable output
  -V, --version         print version number and exit

Configuration

Configuration file is at /usr/local/etc/simpledns/dispatch.conf.

Dispatch conf file uses the same rule as in Dnsmasq. 'Address' and 'Server' rules are supported.

address=/example1.com/1.1.1.1
server=/example2.com/1.1.1.2

Default dispatch conf file is from dnsmasq-china-list.

Fake ip list file is at /usr/local/ect/simpledns/iplist/txt. The source is ChinaDNS.

TODO

  • Config file support
  • EDNS support
  • Negative caching

License

MIT License

More Repositories

1

what-happens-when-zh_CN

What-happens-when 的中文翻译,原仓库 https://github.com/alex/what-happens-when
7,700
star
2

Heart-First-JavaWeb

一个走心的 Java Web 入门开发教程
Shell
857
star
3

SwiftRouter

A URL Router for iOS, written in Swift
Swift
275
star
4

pyfm

[DEPRECATED]使用Python编写的豆瓣FM(douban.fm)命令行播放器
Python
152
star
5

baidu-tieba-auto-sign

[DEPRECATED]模拟客户端进行百度贴吧批量签到的Python脚本
Python
74
star
6

learnrx-zh-cn

ReactiveX 官方互动式教程中文翻译,原仓库 https://github.com/ReactiveX/learnrx
JavaScript
54
star
7

Deck

A tiny Github client powered by React Native
JavaScript
45
star
8

Xcode-Search

A Xcode Source Editor Extension that searches external sources(Google, StackOverflow, etc)
Swift
41
star
9

MVVM-DataController-Demo

Objective-C
29
star
10

bebusy.py

Python Terminal log generator for work spoofing (inspired by https://github.com/ondrek/bebusy.js)
Python
19
star
11

Genie

The Simplest Static Blog Generator You'll Ever Seen
CSS
12
star
12

Hackintosh-MSI-GE63-Raider-RGB-8RE

12
star
13

AMA

抖音来的朋友们,这里冒个泡吧
11
star
14

Sunshine-React-Native

Sunshine app powered by React Native
JavaScript
7
star
15

Take-A-Rest

A tiny reminder that will notify you when you need a rest.
Python
5
star
16

leetcode

C++
4
star
17

Pad

A sample Markdown live editor
Swift
4
star
18

JLAlertView

An UIAlertView replacement with a modern chainable API, written in Swift 4.2
Swift
3
star
19

hitlib2

Tiny Python library servering as a set of APIs for HIT Online Library
Python
3
star
20

unpv13e

Unix Network Programming Source Code
C
2
star
21

Annie

A sample Markdown parser written in Swift
HTML
2
star
22

MyCloud

A mini personal cloud storage and sharing solution
JavaScript
2
star
23

noterm

Batchfile
2
star
24

Windows-Loading-View-iOS

A Simple View mimicking the Loading Animation You see on Windows 8 +
Objective-C
2
star
25

Honeymoon

A tiny Swift web framework, written in Swift 2.0
Swift
1
star
26

FDTemplateLayoutCell-Frame-Example

Objective-C
1
star
27

my-linux-toy

1
star
28

Md5-in-CSharp

MD5 Implementation in C#
C#
1
star
29

the-little-mongodb-book-pdf-epub

The Little Mongodb Book PDF and epub
1
star
30

DDP_Benchmark

Python
1
star
31

dg

dg -- directory generator
Python
1
star
32

Feeder

A Qt-Based Feedly RSS client using The Feedly Cloud API (developer.feedly.com)
C++
1
star
33

react-highlighter

A sample react app for online syntax highlighting
JavaScript
1
star
34

mydotfiles

Some of my config files
Vim Script
1
star