this project is a tiny dns server implementation by python, it is very easy to use
Project description
tinydns
基于gevent异步IO框架实现的轻量DNS服务器,易于配置和启动,可安装于Python2或Python3环境, 可用于爬虫等业务中。
1.如何安装
使用pip 安装
pip install tinydns
2.配置及使用示例
创建配置文件
vim /etc/tinydns.conf
在文件中输入如下内容:
[tinydns]
*.baidu.com = 192.168.1.1,192.168.1.2,192.168.1.3
www.baidu.com = 192.168.1.4,192.168.1.5
image.baidu.com = 192.168.1.1
上面的配置文件所代表的意思是:
- 所有符合*.baidu.com的域名(除了www.baidu.com image.baidu.com)均随机解析到192.168.1.1 192.168.1.2 192.168.1.3中的随意一个
- 所有符合www.baidu.com的域名 随机解析到 192.168.1.4 192.168.1.5中的随机一个
- 所有符合image.baidu.com的域名 解析到 192.168.1.1
- 除了以上之外的域名则直接从本机网络设置中获取到对应的DNS记录返回给客户端
启动服务
tinydns -c /etc/tinydns.conf
备注:
如在服务运行中 修改了配置文件 无需重启,服务会自动加载新的配置文件内容。
3.联系我们
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
tinydns-0.2.6.tar.gz
(6.3 kB
view details)
File details
Details for the file tinydns-0.2.6.tar.gz
.
File metadata
- Download URL: tinydns-0.2.6.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e01e7b78e2b8824fb4318a7dfcc1781aafcea51202695276a59ae08b210a2ba |
|
MD5 | 997edee388f0d4a171b54815249c07ed |
|
BLAKE2b-256 | efeb85251b747137e5f107f2a73bc8c5da7b114976c12e4588c33f90346c6002 |