Add ReadMe.md

This commit is contained in:
Nick Peng
2018-07-22 19:16:24 +08:00
parent a1a509f52c
commit a707bf22fd
7 changed files with 330 additions and 62 deletions

View File

@@ -13,59 +13,40 @@ else
end
-- Basic
s = m:section(TypedSection, "smartdns", translate("SmartDNS Server"))
s = m:section(TypedSection, "smartdns", translate("Settings"), translate("General Settings"))
s.anonymous = true
s:tab("settings", translate("Settings"))
s:tab("help", translate("Technical Support"))
---- Eanble
o = s:taboption("settings", Flag, "enabled", translate("Enable"), translate("Enable or disable smartdns server"))
o = s:option(Flag, "enabled", translate("Enable"), translate("Enable or disable smartdns server"))
o.rempty = false
---- Port
o = s:taboption("settings", Value, "port", translate("Local Port"), translate("Smartdns local server port"))
o = s:option(Value, "port", translate("Local Port"), translate("Smartdns local server port"))
o.placeholder = 5353
o.default = 5353
o.datatype = "port"
o.rempty = false
o = s:taboption("settings", 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"))
o.default = true
o.rempty = false
---- cache-size
o = s:taboption("settings", 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"))
o.rempty = true
---- rr-ttl
o = s:taboption("settings", Value, "rr_ttl", translate("Domain TTL"), translate("TTL for all domain result."))
o = s:option(Value, "rr_ttl", translate("Domain TTL"), translate("TTL for all domain result."))
o.rempty = true
---- rr-ttl-min
o = s:taboption("settings", Value, "rr_ttl_min", translate("Domain TTL Min"), translate("Minimum TTL for all domain result."))
o = s:option(Value, "rr_ttl_min", translate("Domain TTL Min"), translate("Minimum TTL for all domain result."))
o.rempty = true
---- rr-ttl-max
o = s:taboption("settings", Value, "rr_ttl_min", translate("Domain TTL Max"), translate("Maximum TTL for all domain result."))
o = s:option(Value, "rr_ttl_min", translate("Domain TTL Max"), translate("Maximum TTL for all domain result."))
o.rempty = true
o = s:taboption("help", Button, "web")
o.title = translate("SmartDNS official website")
o.inputtitle = translate("open website")
o.inputstyle = "apply"
o.write = function()
luci.http.redirect("https://pymumu.github.io/")
end
o = s:taboption("help", Button, "Donate")
o.title = translate("Donate to smartdns")
o.inputtitle = translate("Donate")
o.inputstyle = "apply"
o.write = function()
luci.http.redirect("https://pymumu.github.io/smartdns")
end
-- Upstream servers
s = m:section(TypedSection, "server", translate("Upstream Servers"), translate("Upstream Servers, support UDP, TCP protocol"))
s.anonymous = true
@@ -116,5 +97,26 @@ function addr.write(self, section, value)
nixio.fs.writefile("/etc/smartdns/address.conf", value)
end
-- Doman addresss
s = m:section(TypedSection, "smartdns", translate("Technical Support"),
translate("Technical Support"))
s.anonymous = true
o = s:option(Button, "web")
o.title = translate("SmartDNS official website")
o.inputtitle = translate("open website")
o.inputstyle = "apply"
o.write = function()
luci.http.redirect("https://pymumu.github.io/smartdns")
end
o = s:option(Button, "Donate")
o.title = translate("Donate to smartdns")
o.inputtitle = translate("Donate")
o.inputstyle = "apply"
o.write = function()
luci.http.redirect("https://pymumu.github.io/smartdns/#donate")
end
return m

View File

@@ -0,0 +1,3 @@
# Add domains which you want to force to an IP address here.
# The example below send any host in example.com to a local webserver.
#address /example.com/127.0.0.1

View File

@@ -1,5 +1,5 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2008-2011 OpenWrt.org
# Copyright (C) 2018 Nick Peng (pymumu@gmail.com)
START=50
SERVICE_USE_PID=1
@@ -97,7 +97,7 @@ start_service() {
config_foreach load_server "server"
echo "# address" >> $SMARTDNS_CONF_TMP
grep "^ *address" $ADDRESS_CONF >> $SMARTDNS_CONF_TMP
grep "^ *address " $ADDRESS_CONF >> $SMARTDNS_CONF_TMP
config_get_bool "enabled" "$section" "enabled" '0'
mv $SMARTDNS_CONF_TMP $SMARTDNS_CONF

View File

@@ -33,6 +33,7 @@ build()
cp $SMARTDNS_BIN $ROOT/opt/usr/sbin
sed -i "s/^\(bind .*\):53/\1:535/g" $ROOT/opt/etc/smartdns/smartdns.conf
sed -i "s/# *server-name smartdns/server-name smartdns/g" $ROOT/opt/etc/smartdns/smartdns.conf
sed -i "s/^Architecture.*/Architecture: $ARCH/g" $ROOT/control/control
sed -i "s/Version:.*/Version: $VER/" $ROOT/control/control