This commit is contained in:
Nick Peng
2018-12-30 00:26:59 +08:00
parent 4766cb78b8
commit 82db995bc1
4 changed files with 13 additions and 11 deletions

View File

@@ -76,7 +76,7 @@ From the comparison, smartdns found the fastest IP address to visit www.baidu.co
2. **Return the fastest IP address**
Supports finding the fastest access IP address from the IP address list of the domain name and returning it to the client to avoid DNS pollution and improve network access speed.
3. **Support for multiple query protocols**
3. **Support for multiple query protocols**
Support UDP, TCP, TLS queries, and non-53 port queries, effectively avoiding DNS pollution.
4. **Domain IP address specification**

View File

@@ -70,7 +70,7 @@ rtt min/avg/max/mdev = 5.954/6.133/6.313/0.195 ms
## 特性
1. **多DNS上游服务器**
1. **多DNS上游服务器**
支持配置多个上游DNS服务器并同时进行查询即使其中有DNS服务器异常也不会影响查询。
2. **返回最快IP地址**

View File

@@ -9,7 +9,8 @@ SERVICE_DAEMONIZE=1
SERVICE_PID_FILE="/var/run/smartdns.pid"
BASECONFIGFILE="/etc/smartdns/smartdns.conf"
SMARTDNS_CONF_DIR="/etc/smartdns"
SMARTDNS_CONF="/var/$SMARTDNS_CONF_DIR/smartdns.conf"
SMARTDNS_VAR_CONF_DIR="/var/etc/smartdns"
SMARTDNS_CONF="$SMARTDNS_VAR_CONF_DIR/smartdns.conf"
ADDRESS_CONF="$SMARTDNS_CONF_DIR/address.conf"
BLACKLIST_IP_CONF="$SMARTDNS_CONF_DIR/blacklist-ip.conf"
CUSTOM_CONF="$SMARTDNS_CONF_DIR/custom.conf"
@@ -163,6 +164,11 @@ start_service() {
local section="$1"
args=""
mkdir -p $SMARTDNS_VAR_CONF_DIR
config_get_bool "enabled" "$section" "enabled" '0'
[ "$enabled" -gt 0 ] || return 1
config_get "server_name" "$section" "server_name" ""
if [ ! -z "$server_name" ]; then
conf_append "server-name" "$server_name"
@@ -191,8 +197,6 @@ start_service() {
SMARTDNS_PORT="$port"
mkdir -p $SMARTDNS_CONF_DIR
config_get "cache_size" "$section" "cache_size" ""
if [ ! -z "$cache_size" ]; then
conf_append "cache-size" "$cache_size"
@@ -213,12 +217,12 @@ start_service() {
conf_append "rr-ttl-max" "$rr_ttl_max"
fi
config_get "log_size" "$section" "log_size" "128K"
config_get "log_size" "$section" "log_size" "64K"
if [ ! -z "$log_size" ]; then
conf_append "log-size" "$log_size"
fi
config_get "log_num" "$section" "log_num" "3"
config_get "log_num" "$section" "log_num" "1"
if [ ! -z "$log_num" ]; then
conf_append "log-num" "$log_num"
fi
@@ -265,10 +269,8 @@ start_service() {
echo "conf-file $ADDRESS_CONF" >> $SMARTDNS_CONF_TMP
echo "conf-file $BLACKLIST_IP_CONF" >> $SMARTDNS_CONF_TMP
echo "conf-file $CUSTOM_CONF" >> $SMARTDNS_CONF_TMP
config_get_bool "enabled" "$section" "enabled" '0'
mv $SMARTDNS_CONF_TMP $SMARTDNS_CONF
[ "$enabled" -gt 0 ] || return 1
if [ "$COREDUMP" = "1" ]; then
args="$args -S"
ulimit -c unlimited

View File

@@ -930,7 +930,7 @@ static int _dns_client_process_udp(struct dns_server_info *server_info, struct e
tlog(TLOG_DEBUG, "recv udp, from %s, ttl: %d", gethost_by_addr(from_host, (struct sockaddr *)&from, from_len), ttl);
if ((ttl != server_info->ttl) && (server_info->ttl > 0) && (server_info->result_flag & DNSSERVER_FLAG_CHECK_TTL)) {
tlog(TLOG_DEBUG, "TTL mismatch, from:%d, local %d, discard result", ttl, server_info->ttl);
/* tlog(TLOG_DEBUG, "TTL mismatch, from:%d, local %d, discard result", ttl, server_info->ttl); */
return 0;
}