Add status of process
This commit is contained in:
69
ReadMe.md
69
ReadMe.md
@@ -7,7 +7,11 @@ SmartDNS是一个运行在本地的DNS服务器,SmartDNS接受本地客户端
|
|||||||
|
|
||||||
支持树莓派,openwrt,华硕路由器等设备。
|
支持树莓派,openwrt,华硕路由器等设备。
|
||||||
|
|
||||||
|
软件效果展示
|
||||||
|
==============
|
||||||
**阿里DNS**
|
**阿里DNS**
|
||||||
|
使用阿里DNS查询百度IP,并检测结果。
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
pi@raspberrypi:~/code/smartdns_build $ nslookup www.baidu.com 223.5.5.5
|
pi@raspberrypi:~/code/smartdns_build $ nslookup www.baidu.com 223.5.5.5
|
||||||
Server: 223.5.5.5
|
Server: 223.5.5.5
|
||||||
@@ -39,7 +43,7 @@ rtt min/avg/max/mdev = 31.014/31.094/31.175/0.193 ms
|
|||||||
```
|
```
|
||||||
|
|
||||||
**smartdns**
|
**smartdns**
|
||||||
|
使用阿里SmartDNS查询百度IP,并检测结果。
|
||||||
```shell
|
```shell
|
||||||
pi@raspberrypi:~/code/smartdns_build $ nslookup www.baidu.com
|
pi@raspberrypi:~/code/smartdns_build $ nslookup www.baidu.com
|
||||||
Server: 192.168.1.1
|
Server: 192.168.1.1
|
||||||
@@ -121,16 +125,17 @@ rtt min/avg/max/mdev = 5.954/6.133/6.313/0.195 ms
|
|||||||
|openwrt LEDE|smartdns.xxxxxxxxx.arm_cortex-a7_neon-vfpv4.ipk|支持arm A7核心CPU的路由器
|
|openwrt LEDE|smartdns.xxxxxxxxx.arm_cortex-a7_neon-vfpv4.ipk|支持arm A7核心CPU的路由器
|
||||||
|openwrt LUCI|luci-app-smartdns.xxxxxxxxx.xxxx.all.ipk|openwrt管理统一界面
|
|openwrt LUCI|luci-app-smartdns.xxxxxxxxx.xxxx.all.ipk|openwrt管理统一界面
|
||||||
|
|
||||||
openwrt系统CPU架构比较多,请查看CPU架构后下载,CPU架构可在路由器管理界面找到,查看方法:
|
openwrt系统CPU架构比较多,上述表格未列出所有支持系统,请查看CPU架构后下载。
|
||||||
|
CPU架构可在路由器管理界面找到,查看方法:
|
||||||
* 登录路由器,点击`System`->`Software`,点击`Configuration` Tab页面,在opkg安装源中可找到对应软件架构,下载路径中可找到,如下,架构为ar71xx
|
* 登录路由器,点击`System`->`Software`,点击`Configuration` Tab页面,在opkg安装源中可找到对应软件架构,下载路径中可找到,如下,架构为ar71xx
|
||||||
|
|
||||||
```
|
```
|
||||||
src/gz chaos_calmer_base http://downloads.openwrt.org/chaos_calmer/15.05/ar71xx/generic/packages/base
|
src/gz chaos_calmer_base http://downloads.openwrt.org/chaos_calmer/15.05/ar71xx/generic/packages/base
|
||||||
```
|
```
|
||||||
|
|
||||||
[此处下载](https://github.com/pymumu/smartdns/releases)
|
请在Release页面下载:[此处下载](https://github.com/pymumu/smartdns/releases)
|
||||||
|
|
||||||
标准Linux系统安装(树莓派)
|
标准Linux系统安装(树莓派, X86_64系统)
|
||||||
--------------
|
--------------
|
||||||
1. 安装
|
1. 安装
|
||||||
下载配套安装包`smartdns.xxxxxxxx.armhf.deb`,并上传到Linux系统中。 执行如下命令安装
|
下载配套安装包`smartdns.xxxxxxxx.armhf.deb`,并上传到Linux系统中。 执行如下命令安装
|
||||||
@@ -164,17 +169,16 @@ systemctl start smartdns
|
|||||||
II. 华为等路由器可能不支持配置DNS为本地IP,请修改PC端,手机端DNS服务器为树莓派IP。
|
II. 华为等路由器可能不支持配置DNS为本地IP,请修改PC端,手机端DNS服务器为树莓派IP。
|
||||||
|
|
||||||
5. 检测服务是否配置成功。
|
5. 检测服务是否配置成功。
|
||||||
使用nslookup查询域名,看命令结果中的`服务器`项目是否显示为`Linux主机名`,如raspberry则表示生效
|
使用`nslookup -querytype=ptr 127.0.0.1`查询域名
|
||||||
|
看命令结果中的`name`项目是否显示为`smartdns`或`主机名`,如`smartdns`则表示生效
|
||||||
|
|
||||||
```
|
```
|
||||||
C:\Users\meikechong>nslookup www.baidu.com
|
pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr 127.0.0.1
|
||||||
服务器: raspberry
|
Server: 192.168.1.1
|
||||||
Address: 192.168.1.1
|
Address: 192.168.1.1#53
|
||||||
|
|
||||||
非权威应答:
|
Non-authoritative answer:
|
||||||
名称: www.a.shifen.com
|
1.0.0.127.in-addr.arpa name = smartdns.
|
||||||
Address: 14.215.177.39
|
|
||||||
Aliases: www.baidu.com
|
|
||||||
```
|
```
|
||||||
|
|
||||||
openwrt/LEDE
|
openwrt/LEDE
|
||||||
@@ -195,18 +199,17 @@ opkg install luci-app-smartdns.xxxxxxxx.xxxx.all.ipk
|
|||||||
3. 启动服务
|
3. 启动服务
|
||||||
勾选配置页面中的`Enable(启用)`来启动SmartDNS
|
勾选配置页面中的`Enable(启用)`来启动SmartDNS
|
||||||
|
|
||||||
4. 检测服务是否配置成功。
|
4. 检测服务是否配置成功
|
||||||
使用nslookup查询域名,看命令结果中的`服务器`项目是否显示为`Linux主机名`,如`smartdns`则表示生效
|
使用`nslookup -querytype=ptr 127.0.0.1`查询域名
|
||||||
|
看命令结果中的`name`项目是否显示为`smartdns`或`主机名`,如`smartdns`则表示生效
|
||||||
|
|
||||||
```
|
```
|
||||||
C:\Users\meikechong>nslookup www.baidu.com
|
pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr 127.0.0.1
|
||||||
服务器: smartdns
|
Server: 192.168.1.1
|
||||||
Address: 192.168.1.1
|
Address: 192.168.1.1#53
|
||||||
|
|
||||||
非权威应答:
|
Non-authoritative answer:
|
||||||
名称: www.a.shifen.com
|
1.0.0.127.in-addr.arpa name = smartdns.
|
||||||
Address: 14.215.177.39
|
|
||||||
Aliases: www.baidu.com
|
|
||||||
```
|
```
|
||||||
|
|
||||||
5. 注意:
|
5. 注意:
|
||||||
@@ -235,17 +238,16 @@ ipkg install smartdns.xxxxxxx.mipsbig.ipk
|
|||||||
```
|
```
|
||||||
|
|
||||||
4. 重启路由器生效服务
|
4. 重启路由器生效服务
|
||||||
待路由器启动后,使用nslookup查询域名,看命令结果中的`服务器`项目是否显示为`smartdns`,如显示smartdns则表示生效
|
待路由器启动后,使用`nslookup -querytype=ptr 127.0.0.1`查询域名
|
||||||
|
看命令结果中的`name`项目是否显示为`smartdns`或`主机名`,如`smartdns`则表示生效
|
||||||
|
|
||||||
```
|
```
|
||||||
C:\Users\meikechong>nslookup www.baidu.com
|
pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr 127.0.0.1
|
||||||
服务器: smartdns
|
Server: 192.168.1.1
|
||||||
Address: 192.168.1.1
|
Address: 192.168.1.1#53
|
||||||
|
|
||||||
非权威应答:
|
Non-authoritative answer:
|
||||||
名称: www.a.shifen.com
|
1.0.0.127.in-addr.arpa name = smartdns.
|
||||||
Address: 14.215.177.39
|
|
||||||
Aliases: www.baidu.com
|
|
||||||
```
|
```
|
||||||
|
|
||||||
5. 额外说明
|
5. 额外说明
|
||||||
@@ -311,6 +313,15 @@ vi /opt/etc/smartdns/smartdns.conf
|
|||||||
* Wechat 微信
|
* Wechat 微信
|
||||||

|

|
||||||
|
|
||||||
|
声明
|
||||||
|
==============
|
||||||
|
* `SmartDNS`著作权归属Nick Peng (pymumu at gmail.com)。
|
||||||
|
* `SmartDNS`为免费软件,用户可以非商业性地复制和使用`SmartDNS`。
|
||||||
|
* 禁止将 `SmartDNS` 用于商业用途。
|
||||||
|
* 使用本软件的风险由用户自行承担,在适用法律允许的最大范围内,对因使用本产品所产生的损害及风险,包括但不限于直接或间接的个人损害、商业赢利的丧失、贸易中断、商业信息的丢失或任何其它经济损失,不承担任何责任。
|
||||||
|
* 本软件不会未经用户同意收集任何用户信息。
|
||||||
|
|
||||||
|
|
||||||
说明
|
说明
|
||||||
==============
|
==============
|
||||||
目前代码未开源,后续根据情况开源。
|
目前代码未开源,后续根据情况开源。
|
||||||
|
|||||||
@@ -7,7 +7,11 @@ SmartDNS是一个运行在本地的DNS服务器,SmartDNS接受本地客户端
|
|||||||
|
|
||||||
支持树莓派,openwrt,华硕路由器等设备。
|
支持树莓派,openwrt,华硕路由器等设备。
|
||||||
|
|
||||||
|
软件效果展示
|
||||||
|
==============
|
||||||
**阿里DNS**
|
**阿里DNS**
|
||||||
|
使用阿里DNS查询百度IP,并检测结果。
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
pi@raspberrypi:~/code/smartdns_build $ nslookup www.baidu.com 223.5.5.5
|
pi@raspberrypi:~/code/smartdns_build $ nslookup www.baidu.com 223.5.5.5
|
||||||
Server: 223.5.5.5
|
Server: 223.5.5.5
|
||||||
@@ -39,7 +43,7 @@ rtt min/avg/max/mdev = 31.014/31.094/31.175/0.193 ms
|
|||||||
```
|
```
|
||||||
|
|
||||||
**smartdns**
|
**smartdns**
|
||||||
|
使用阿里SmartDNS查询百度IP,并检测结果。
|
||||||
```shell
|
```shell
|
||||||
pi@raspberrypi:~/code/smartdns_build $ nslookup www.baidu.com
|
pi@raspberrypi:~/code/smartdns_build $ nslookup www.baidu.com
|
||||||
Server: 192.168.1.1
|
Server: 192.168.1.1
|
||||||
@@ -121,32 +125,41 @@ rtt min/avg/max/mdev = 5.954/6.133/6.313/0.195 ms
|
|||||||
|openwrt LEDE|smartdns.xxxxxxxxx.arm_cortex-a7_neon-vfpv4.ipk|支持arm A7核心CPU的路由器
|
|openwrt LEDE|smartdns.xxxxxxxxx.arm_cortex-a7_neon-vfpv4.ipk|支持arm A7核心CPU的路由器
|
||||||
|openwrt LUCI|luci-app-smartdns.xxxxxxxxx.xxxx.all.ipk|openwrt管理统一界面
|
|openwrt LUCI|luci-app-smartdns.xxxxxxxxx.xxxx.all.ipk|openwrt管理统一界面
|
||||||
|
|
||||||
openwrt系统CPU架构比较多,请查看CPU架构后下载,CPU架构可在路由器管理界面找到,查看方法:
|
openwrt系统CPU架构比较多,上述表格未列出所有支持系统,请查看CPU架构后下载。
|
||||||
|
CPU架构可在路由器管理界面找到,查看方法:
|
||||||
* 登录路由器,点击`System`->`Software`,点击`Configuration` Tab页面,在opkg安装源中可找到对应软件架构,下载路径中可找到,如下,架构为ar71xx
|
* 登录路由器,点击`System`->`Software`,点击`Configuration` Tab页面,在opkg安装源中可找到对应软件架构,下载路径中可找到,如下,架构为ar71xx
|
||||||
|
|
||||||
```
|
```
|
||||||
src/gz chaos_calmer_base http://downloads.openwrt.org/chaos_calmer/15.05/ar71xx/generic/packages/base
|
src/gz chaos_calmer_base http://downloads.openwrt.org/chaos_calmer/15.05/ar71xx/generic/packages/base
|
||||||
```
|
```
|
||||||
|
|
||||||
[此处下载](https://github.com/pymumu/smartdns/releases)
|
请在Release页面下载:[此处下载](https://github.com/pymumu/smartdns/releases)
|
||||||
|
|
||||||
标准Linux系统安装(树莓派)
|
标准Linux系统安装(树莓派, X86_64系统)
|
||||||
--------------
|
--------------
|
||||||
1. 安装
|
1. 安装
|
||||||
下载配套安装包`smartdns.xxxxxxxx.armhf.deb`,并上传到Linux系统中。 执行如下命令安装
|
下载配套安装包`smartdns.xxxxxxxx.armhf.deb`,并上传到Linux系统中。 执行如下命令安装
|
||||||
|
|
||||||
```
|
```
|
||||||
dpkg -i smartdns.xxxxxxxx.armhf.deb
|
dpkg -i smartdns.xxxxxxxx.armhf.deb
|
||||||
```
|
```
|
||||||
|
|
||||||
2. 修改配置
|
2. 修改配置
|
||||||
安装完成后,可配置smartdns的上游服务器信息。具体配置参数参考`配置参数`说明。
|
安装完成后,可配置smartdns的上游服务器信息。具体配置参数参考`配置参数`说明。
|
||||||
一般情况下,只需要增加`server [IP]:port`, `server-tcp [IP]:port`配置项
|
一般情况下,只需要增加`server [IP]:port`, `server-tcp [IP]:port`配置项
|
||||||
|
尽可能配置多个上游DNS服务器,包括国内外的服务器。
|
||||||
|
|
||||||
```
|
```
|
||||||
vi /etc/smartdns/smartdns.conf
|
vi /etc/smartdns/smartdns.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
3. 启动服务
|
3. 启动服务
|
||||||
|
|
||||||
```
|
```
|
||||||
systemctl enable smartdns
|
systemctl enable smartdns
|
||||||
systemctl start smartdns
|
systemctl start smartdns
|
||||||
```
|
```
|
||||||
|
|
||||||
4. 将DNS请求转发的SmartDNS解析。
|
4. 将DNS请求转发的SmartDNS解析。
|
||||||
修改本地路由器的DNS服务器,将DNS服务器配置为SmartDNS。
|
修改本地路由器的DNS服务器,将DNS服务器配置为SmartDNS。
|
||||||
* 登录到本地网络的路由器中,配置树莓派分配静态IP地址。
|
* 登录到本地网络的路由器中,配置树莓派分配静态IP地址。
|
||||||
@@ -156,17 +169,16 @@ systemctl start smartdns
|
|||||||
II. 华为等路由器可能不支持配置DNS为本地IP,请修改PC端,手机端DNS服务器为树莓派IP。
|
II. 华为等路由器可能不支持配置DNS为本地IP,请修改PC端,手机端DNS服务器为树莓派IP。
|
||||||
|
|
||||||
5. 检测服务是否配置成功。
|
5. 检测服务是否配置成功。
|
||||||
使用nslookup查询域名,看命令结果中的`服务器`项目是否显示为`Linux主机名`,如raspberry则表示生效
|
使用`nslookup -querytype=ptr 127.0.0.1`查询域名
|
||||||
|
看命令结果中的`name`项目是否显示为`smartdns`或`主机名`,如`smartdns`则表示生效
|
||||||
|
|
||||||
```
|
```
|
||||||
C:\Users\meikechong>nslookup www.baidu.com
|
pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr 127.0.0.1
|
||||||
服务器: raspberry
|
Server: 192.168.1.1
|
||||||
Address: 192.168.1.1
|
Address: 192.168.1.1#53
|
||||||
|
|
||||||
非权威应答:
|
Non-authoritative answer:
|
||||||
名称: www.a.shifen.com
|
1.0.0.127.in-addr.arpa name = smartdns.
|
||||||
Address: 14.215.177.39
|
|
||||||
Aliases: www.baidu.com
|
|
||||||
```
|
```
|
||||||
|
|
||||||
openwrt/LEDE
|
openwrt/LEDE
|
||||||
@@ -187,17 +199,17 @@ opkg install luci-app-smartdns.xxxxxxxx.xxxx.all.ipk
|
|||||||
3. 启动服务
|
3. 启动服务
|
||||||
勾选配置页面中的`Enable(启用)`来启动SmartDNS
|
勾选配置页面中的`Enable(启用)`来启动SmartDNS
|
||||||
|
|
||||||
4. 检测服务是否配置成功。
|
4. 检测服务是否配置成功
|
||||||
使用nslookup查询域名,看命令结果中的`服务器`项目是否显示为`Linux主机名`,如`smartdns`则表示生效
|
使用`nslookup -querytype=ptr 127.0.0.1`查询域名
|
||||||
```
|
看命令结果中的`name`项目是否显示为`smartdns`或`主机名`,如`smartdns`则表示生效
|
||||||
C:\Users\meikechong>nslookup www.baidu.com
|
|
||||||
服务器: smartdns
|
|
||||||
Address: 192.168.1.1
|
|
||||||
|
|
||||||
非权威应答:
|
```
|
||||||
名称: www.a.shifen.com
|
pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr 127.0.0.1
|
||||||
Address: 14.215.177.39
|
Server: 192.168.1.1
|
||||||
Aliases: www.baidu.com
|
Address: 192.168.1.1#53
|
||||||
|
|
||||||
|
Non-authoritative answer:
|
||||||
|
1.0.0.127.in-addr.arpa name = smartdns.
|
||||||
```
|
```
|
||||||
|
|
||||||
5. 注意:
|
5. 注意:
|
||||||
@@ -220,22 +232,22 @@ SSH登录用户名密码与管理界面相同。
|
|||||||
|
|
||||||
3. 安装SmartDNS
|
3. 安装SmartDNS
|
||||||
将软件使用winscp上传到路由器的`/tmp/mnt/sda1`目录。(或网上邻居复制到sda1共享目录)
|
将软件使用winscp上传到路由器的`/tmp/mnt/sda1`目录。(或网上邻居复制到sda1共享目录)
|
||||||
|
|
||||||
```
|
```
|
||||||
ipkg install smartdns.xxxxxxx.mipsbig.ipk
|
ipkg install smartdns.xxxxxxx.mipsbig.ipk
|
||||||
```
|
```
|
||||||
|
|
||||||
4. 重启路由器生效服务
|
4. 重启路由器生效服务
|
||||||
待路由器启动后,使用nslookup查询域名,看命令结果中的`服务器`项目是否显示为`smartdns`,如显示smartdns则表示生效
|
待路由器启动后,使用`nslookup -querytype=ptr 127.0.0.1`查询域名
|
||||||
|
看命令结果中的`name`项目是否显示为`smartdns`或`主机名`,如`smartdns`则表示生效
|
||||||
|
|
||||||
```
|
```
|
||||||
C:\Users\meikechong>nslookup www.baidu.com
|
pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr 127.0.0.1
|
||||||
服务器: smartdns
|
Server: 192.168.1.1
|
||||||
Address: 192.168.1.1
|
Address: 192.168.1.1#53
|
||||||
|
|
||||||
非权威应答:
|
Non-authoritative answer:
|
||||||
名称: www.a.shifen.com
|
1.0.0.127.in-addr.arpa name = smartdns.
|
||||||
Address: 14.215.177.39
|
|
||||||
Aliases: www.baidu.com
|
|
||||||
```
|
```
|
||||||
|
|
||||||
5. 额外说明
|
5. 额外说明
|
||||||
@@ -301,6 +313,15 @@ vi /opt/etc/smartdns/smartdns.conf
|
|||||||
* Wechat 微信
|
* Wechat 微信
|
||||||

|

|
||||||
|
|
||||||
|
声明
|
||||||
|
==============
|
||||||
|
* `SmartDNS`著作权归属Nick Peng (pymumu at gmail.com)。
|
||||||
|
* `SmartDNS`为免费软件,用户可以非商业性地复制和使用`SmartDNS`。
|
||||||
|
* 禁止将 `SmartDNS` 用于商业用途。
|
||||||
|
* 使用本软件的风险由用户自行承担,在适用法律允许的最大范围内,对因使用本产品所产生的损害及风险,包括但不限于直接或间接的个人损害、商业赢利的丧失、贸易中断、商业信息的丢失或任何其它经济损失,不承担任何责任。
|
||||||
|
* 本软件不会未经用户同意收集任何用户信息。
|
||||||
|
|
||||||
|
|
||||||
说明
|
说明
|
||||||
==============
|
==============
|
||||||
目前代码未开源,后续根据情况开源。
|
目前代码未开源,后续根据情况开源。
|
||||||
|
|||||||
@@ -8,7 +8,18 @@ function index()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local page
|
local page
|
||||||
|
|
||||||
page = entry({"admin", "services", "smartdns"}, cbi("smartdns"), _("SmartDNS"), 60)
|
page = entry({"admin", "services", "smartdns"}, cbi("smartdns"), _("SmartDNS"), 60)
|
||||||
page.dependent = true
|
page.dependent = true
|
||||||
|
page = entry({"admin", "services", "smartdns", "status"}, call("act_status"))
|
||||||
|
page.leaf = true
|
||||||
|
end
|
||||||
|
|
||||||
|
local function is_running()
|
||||||
|
return luci.sys.call("pidof smartdns >/dev/null") == 0
|
||||||
|
end
|
||||||
|
function act_status()
|
||||||
|
local e={}
|
||||||
|
e.running = is_running()
|
||||||
|
luci.http.prepare_content("application/json")
|
||||||
|
luci.http.write_json(e)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -4,6 +4,15 @@ msgstr "Content-Type: text/plain; charset=UTF-8\n"
|
|||||||
msgid "SmartDNS"
|
msgid "SmartDNS"
|
||||||
msgstr "SmartDNS"
|
msgstr "SmartDNS"
|
||||||
|
|
||||||
|
msgid "SmartDNS is a local high-performance DNS server"
|
||||||
|
msgstr "SmartDNS是一个本地高性能DNS服务器"
|
||||||
|
|
||||||
|
msgid "SmartDNS Server"
|
||||||
|
msgstr "SmartDNS 服务器"
|
||||||
|
|
||||||
|
msgid "SmartDNS is a local high-performance DNS server, supports finding fastest IP, supports ad filtering, and supports avoiding DNS poisoning."
|
||||||
|
msgstr "SmartDNS是一个本地高性能DNS服务器,支持避免域名污染,支持返回最快IP,支持广告过滤。"
|
||||||
|
|
||||||
msgid "Server Name"
|
msgid "Server Name"
|
||||||
msgstr "服务器名称"
|
msgstr "服务器名称"
|
||||||
|
|
||||||
@@ -22,8 +31,8 @@ msgstr "SmartDNS本地服务端口"
|
|||||||
msgid "Redirect"
|
msgid "Redirect"
|
||||||
msgstr "重定向"
|
msgstr "重定向"
|
||||||
|
|
||||||
msgid "Redirect standard dns query from 53 to smartdns"
|
msgid "Redirect standard dns query from 53 to smartdns, as default DNS server"
|
||||||
msgstr "将53端口的DNS请求重定向到SmartDNS"
|
msgstr "将53端口的DNS请求重定向到SmartDNS, 替换默认DNS服务"
|
||||||
|
|
||||||
msgid "Cache Size"
|
msgid "Cache Size"
|
||||||
msgstr "缓存大小"
|
msgstr "缓存大小"
|
||||||
|
|||||||
@@ -1,16 +1,15 @@
|
|||||||
-- Copyright 2018 Nick Peng (pymumu@gmail.com)
|
-- Copyright 2018 Nick Peng (pymumu@gmail.com)
|
||||||
|
|
||||||
require("nixio.fs")
|
require ("nixio.fs")
|
||||||
require("luci.http")
|
require ("luci.http")
|
||||||
|
require ("luci.dispatcher")
|
||||||
|
require ("nixio.fs")
|
||||||
|
|
||||||
m = Map("smartdns", translate("SmartDNS"),
|
m = Map("smartdns")
|
||||||
translate("SmartDNS is a local dns server to find fastest ip."))
|
m.title = translate("SmartDNS Server")
|
||||||
|
m.description = translate("SmartDNS is a local high-performance DNS server, supports finding fastest IP, supports ad filtering, and supports avoiding DNS poisoning.")
|
||||||
|
|
||||||
if luci.sys.call("pidof smartdns >/dev/null") == 0 then
|
m:section(SimpleSection).template = "smartdns/smartdns_status"
|
||||||
m = Map("smartdns", translate("SmartDNS"), "%s - %s" %{translate("SmartDNS"), translate("RUNNING")})
|
|
||||||
else
|
|
||||||
m = Map("smartdns", translate("SmartDNS"), "%s - %s" %{translate("SmartDNS"), translate("NOT RUNNING")})
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Basic
|
-- Basic
|
||||||
s = m:section(TypedSection, "smartdns", translate("Settings"), translate("General Settings"))
|
s = m:section(TypedSection, "smartdns", translate("Settings"), translate("General Settings"))
|
||||||
@@ -18,6 +17,7 @@ s.anonymous = true
|
|||||||
|
|
||||||
---- Eanble
|
---- Eanble
|
||||||
o = s:option(Flag, "enabled", translate("Enable"), translate("Enable or disable smartdns server"))
|
o = s:option(Flag, "enabled", translate("Enable"), translate("Enable or disable smartdns server"))
|
||||||
|
o.default = o.disabled
|
||||||
o.rempty = false
|
o.rempty = false
|
||||||
|
|
||||||
---- server name
|
---- server name
|
||||||
@@ -33,10 +33,12 @@ o.default = 5353
|
|||||||
o.datatype = "port"
|
o.datatype = "port"
|
||||||
o.rempty = false
|
o.rempty = false
|
||||||
|
|
||||||
o = s:option(Flag, "redirect", translate("Redirect"), translate("Redirect standard dns query from 53 to smartdns"))
|
o = s:option(Flag, "redirect", translate("Redirect"), translate("Redirect standard dns query from 53 to smartdns, as default DNS server"))
|
||||||
o.default = true
|
o.rmempty = false
|
||||||
o.placeholder = "1"
|
o.default = o.enabled
|
||||||
o.rempty = false
|
o.cfgvalue = function(...)
|
||||||
|
return Flag.cfgvalue(...) or "1"
|
||||||
|
end
|
||||||
|
|
||||||
---- cache-size
|
---- cache-size
|
||||||
o = s:option(Value, "cache_size", translate("Cache Size"), translate("DNS domain result cache size"))
|
o = s:option(Value, "cache_size", translate("Cache Size"), translate("DNS domain result cache size"))
|
||||||
|
|||||||
22
package/luci/files/luci/view/smartdns/smartdns_status.htm
Normal file
22
package/luci/files/luci/view/smartdns/smartdns_status.htm
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<script type="text/javascript">//<![CDATA[
|
||||||
|
XHR.poll(3, '<%=luci.dispatcher.build_url("admin", "services", "smartdns", "status")%>', null,
|
||||||
|
function(x, data) {
|
||||||
|
var tb = document.getElementById('smartdns_status');
|
||||||
|
if (data && tb) {
|
||||||
|
if (data.running) {
|
||||||
|
var links = '<b><font color=green>SmartDNS - <%:RUNNING%></font></b></em>';
|
||||||
|
tb.innerHTML = links;
|
||||||
|
} else {
|
||||||
|
tb.innerHTML = '<b><font color=red>SmartDNS - <%:NOT RUNNING%></font></b>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
//]]>
|
||||||
|
</script>
|
||||||
|
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
|
||||||
|
<fieldset class="cbi-section">
|
||||||
|
<p id="smartdns_status">
|
||||||
|
<em><%:Collecting data...%></em>
|
||||||
|
</p>
|
||||||
|
</fieldset>
|
||||||
@@ -1,2 +1,3 @@
|
|||||||
config 'smartdns'
|
config 'smartdns'
|
||||||
option 'enabled' '0'
|
option 'enabled' '0'
|
||||||
|
|
||||||
@@ -2,10 +2,10 @@
|
|||||||
BIN=smartdns
|
BIN=smartdns
|
||||||
OBJS_LIB=lib/rbtree.o lib/art.o lib/bitops.o
|
OBJS_LIB=lib/rbtree.o lib/art.o lib/bitops.o
|
||||||
OBJS=smartdns.o fast_ping.o dns_client.o dns_server.o dns.o util.o tlog.o conf.o dns_cache.o $(OBJS_LIB)
|
OBJS=smartdns.o fast_ping.o dns_client.o dns_server.o dns.o util.o tlog.o conf.o dns_cache.o $(OBJS_LIB)
|
||||||
CFLAGS=-g -O0 -Wall -Wstrict-prototypes -fno-omit-frame-pointer -Wstrict-aliasing
|
CFLAGS=-O2 -Wall -Wstrict-prototypes -fno-omit-frame-pointer -Wstrict-aliasing
|
||||||
CFLAGS +=-Iinclude
|
CFLAGS +=-Iinclude
|
||||||
CFLAGS += -DBASE_FILE_NAME=\"$(notdir $<)\"
|
CFLAGS += -DBASE_FILE_NAME=\"$(notdir $<)\"
|
||||||
CXXFLAGS=-g -O0 -Wall -std=c++11
|
CXXFLAGS=-O2 -Wall -std=c++11
|
||||||
CXXFLAGS +=-Iinclude
|
CXXFLAGS +=-Iinclude
|
||||||
LDFLAGS += -lpthread
|
LDFLAGS += -lpthread
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ int config_bind(char *value)
|
|||||||
|
|
||||||
int config_server_name(char *value)
|
int config_server_name(char *value)
|
||||||
{
|
{
|
||||||
strncpy(dns_conf_server_name, value, DNS_MAX_CNAME_LEN);
|
strncpy(dns_conf_server_name, value, DNS_MAX_CONF_CNAME_LEN);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user