Support DNS Over HTTPS
This commit is contained in:
@@ -142,13 +142,16 @@ s:option(Value, "name", translate("DNS Server Name"), translate("DNS Server Name
|
||||
|
||||
---- IP address
|
||||
o = s:option(Value, "ip", translate("ip"), translate("DNS Server ip"))
|
||||
o.datatype = "ipaddr"
|
||||
o.datatype = "or(ipaddr, string)"
|
||||
o.rmempty = false
|
||||
---- port
|
||||
o = s:option(Value, "port", translate("port"), translate("DNS Server port"))
|
||||
o.placeholder = "default"
|
||||
o.datatype = "port"
|
||||
o.rempty = true
|
||||
o:depends("type", "udp")
|
||||
o:depends("type", "tcp")
|
||||
o:depends("type", "tls")
|
||||
|
||||
---- type
|
||||
o = s:option(ListValue, "type", translate("type"), translate("DNS Server type"))
|
||||
@@ -156,6 +159,7 @@ o.placeholder = "udp"
|
||||
o:value("udp", translate("udp"))
|
||||
o:value("tcp", translate("tcp"))
|
||||
o:value("tls", translate("tls"))
|
||||
o:value("https", translate("https"))
|
||||
o.default = "udp"
|
||||
o.rempty = false
|
||||
|
||||
|
||||
@@ -18,13 +18,16 @@ s:option(Value, "name", translate("DNS Server Name"), translate("DNS Server Name
|
||||
|
||||
---- IP address
|
||||
o = s:option(Value, "ip", translate("ip"), translate("DNS Server ip"))
|
||||
o.datatype = "ipaddr"
|
||||
o.datatype = "or(host, string)"
|
||||
o.rmempty = false
|
||||
---- port
|
||||
o = s:option(Value, "port", translate("port"), translate("DNS Server port"))
|
||||
o.placeholder = "default"
|
||||
o.datatype = "port"
|
||||
o.rempty = true
|
||||
o:depends("type", "udp")
|
||||
o:depends("type", "tcp")
|
||||
o:depends("type", "tls")
|
||||
|
||||
---- type
|
||||
o = s:option(ListValue, "type", translate("type"), translate("DNS Server type"))
|
||||
@@ -32,6 +35,7 @@ o.placeholder = "udp"
|
||||
o:value("udp", translate("udp"))
|
||||
o:value("tcp", translate("tcp"))
|
||||
o:value("tls", translate("tls"))
|
||||
o:value("https", translate("https"))
|
||||
o.default = "udp"
|
||||
o.rempty = false
|
||||
|
||||
@@ -54,6 +58,7 @@ end
|
||||
o = s:option(Flag, "check_edns", translate("Anti Answer Forgery"), translate("Anti answer forgery, if DNS does not work properly after enabling, please turn off this feature"))
|
||||
o.rmempty = false
|
||||
o.default = o.disabled
|
||||
o:depends("type", "udp")
|
||||
o.cfgvalue = function(...)
|
||||
return Flag.cfgvalue(...) or "0"
|
||||
end
|
||||
@@ -61,8 +66,10 @@ end
|
||||
---- SPKI pin
|
||||
o = s:option(Value, "spki_pin", translate("TLS SPKI Pinning"), translate("Used to verify the validity of the TLS server, The value is Base64 encoded SPKI fingerprint, leaving blank to indicate that the validity of TLS is not verified."))
|
||||
o.default = ""
|
||||
o.datatype = "wpakey"
|
||||
o.datatype = "string"
|
||||
o.rempty = true
|
||||
o:depends("type", "tls")
|
||||
o:depends("type", "https")
|
||||
|
||||
---- other args
|
||||
o = s:option(Value, "addition_arg", translate("Additional Server Args"), translate("Additional Args for upstream dns servers"))
|
||||
|
||||
@@ -5,6 +5,19 @@ chmod +x /etc/init.d/smartdns
|
||||
mkdir -p /var/etc/smartdns/
|
||||
|
||||
[ "${IPKG_NO_SCRIPT}" = "1" ] && exit 0
|
||||
|
||||
if [ ! -f "/var/etc/smartdns/address.conf" ]; then
|
||||
cp /etc/smartdns/address.conf /var/etc/smartdns/address.conf
|
||||
fi
|
||||
|
||||
if [ ! -f "/var/etc/smartdns/blacklist-ip.conf" ]; then
|
||||
cp /etc/smartdns/blacklist-ip.conf /var/etc/smartdns/blacklist-ip.conf
|
||||
fi
|
||||
|
||||
if [ ! -f "/var/etc/smartdns/custom.conf" ]; then
|
||||
cp /etc/smartdns/custom.conf /var/etc/smartdns/custom.conf
|
||||
fi
|
||||
|
||||
. ${IPKG_INSTROOT}/lib/functions.sh
|
||||
default_postinst $0 $@
|
||||
ret=$?
|
||||
|
||||
@@ -155,9 +155,11 @@ load_server()
|
||||
SERVER="server-tcp"
|
||||
elif [ "$type" = "tls" ]; then
|
||||
SERVER="server-tls"
|
||||
elif [ "$type" = "https" ]; then
|
||||
SERVER="server-https"
|
||||
fi
|
||||
|
||||
if [ ! -z "`echo $ip | grep ":"`" ]; then
|
||||
if [ ! -z "`echo $ip | grep ":" | grep -v "https://"`" ]; then
|
||||
if [ -z "`echo $ip | grep "\["`" ]; then
|
||||
ip="[$ip]"
|
||||
fi
|
||||
@@ -185,6 +187,10 @@ load_server()
|
||||
DNS_ADDRESS="$ip"
|
||||
fi
|
||||
|
||||
if [ "$type" = "https" ]; then
|
||||
DNS_ADDRESS="$ip"
|
||||
fi
|
||||
|
||||
conf_append "$SERVER" "$DNS_ADDRESS $ADDITIONAL_ARGS $addition_arg"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user