GithubHelp home page GithubHelp logo

mokeyish / smartdns-rs Goto Github PK

View Code? Open in Web Editor NEW
461.0 11.0 32.0 699 KB

A cross platform local DNS server (Dnsmasq like) written in rust to obtain the fastest website IP for the best Internet experience, supports DoT, DoQ, DoH, DoH3.

License: GNU General Public License v3.0

Rust 90.99% Shell 8.48% Makefile 0.27% Dockerfile 0.20% Just 0.06%
dns dns-over-https dns-over-tls dnsmasq doh dot smartdns smartdns-rs windows dns-server

smartdns-rs's Introduction

SmartDNS-rs

Test GitHub release (latest by date including pre-releases) OS

DocsDiscord

English | 中文

SmartDNS-rs 🐋 is a local DNS server imspired by C SmartDNS to accepts DNS query requests from local clients, obtains DNS query results from multiple upstream DNS servers, and returns the fastest access results to clients. Avoiding DNS pollution and improving network access speed, supports high-performance ad filtering.

Features

  • Multiple upstream DNS servers

    Supports configuring multiple upstream DNS servers and query at the same time.the query will not be affected, Even if there is a DNS server exception.

  • 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.

  • Support for multiple query protocols

    Supports UDP, TCP, DoT, DoQ, DoH, DoH3 queries and service, and non-53 port queries, effectively avoiding DNS pollution and protect privacy, and support query DNS over socks5, http proxy.

  • Domain IP address specification

    Supports configuring IP address of specific domain to achieve the effect of advertising filtering, and avoid malicious websites.

  • DNS domain forwarding

    Supports DNS forwarding, ipset and nftables. Support setting the domain result to ipset and nftset set when speed check fails.

  • Windows / MacOS / Linux multi-platform support

    Supports installing as a service and running it at startup.

  • Support IPV4, IPV6 dual stack

    Supports IPV4, IPV6 network, support query A, AAAA record, dual-stack IP selection, and filter IPV6 AAAA record.

  • DNS64

    Supports DNS64 translation.

  • High performance, low resource consumption

    Tokio-based multi-threaded asynchronous I/O model; caches query results; supports most-used domain name expired prefetching, query '0' milliseconds, without eliminating the impact of DoH and DoT encryption.

Note: The C version of smartdns is very functional, but because it only supports Linux, while MacOS and Windows can only be supported through Docker or WSL. Therefore, I want to develop a rust version of SmartDNS that supports compiling to Windows, MacOS, Linux and Android Termux environment to run, and is compatible with its configuration.


It is still under development, please do not use it in production environment, welcome to try and provide feedback.

Please refer to TODO for the function coverage

Installing

  • MacOS

    If you have installed brew, you can directly use the following command to install.

    brew update
    brew install smartdns

    Note: Listening on port 53 requires root permission, so sudo is required.

    The command sudo smartdns service start for brew installed smartdns is the same as sudo brew services start smartdns.

    If you don't have brew installed, just download the compiled program compression package and install it as below.

  • Windows / Linux

    Go to here to download the package and decompress it.

    1. Get help

      ./smartdns help
    2. Run as foreground, easy to check the running status

      ./smartdns run -c ./smartdns.conf -v
      • -v is enabled to print debug logs.
    3. Run as background service, run automatically at startup

      Get help of service management commands.

      ./smartdns service help

      Note: Installed as a system service, administrator / root permissions are required.

      Service management is compatible with all systems, call sc on Windows; call launchctl or brew on MacOS; call Systemd or OpenRc on Linux.

Configuration

The following is the simplest example configuration

# Listen on local port 53
bind 127.0.0.1:53  

# Configure bootstrap-dns, if not configured, call the system_conf, 
# it is recommended to configure, so that it will be encrypted.
server https://1.1.1.1/dns-query  -bootstrap-dns -exclude-default-group
server https://8.8.8.8/dns-query  -bootstrap-dns -exclude-default-group

# Configure default upstream server
server https://cloudflare-dns/dns-query
server https://dns.quad9.net/dns-query
server https://dns.google/dns-query

# Configure the Office(Home) upstream server
server 192.168.1.1 -exclude-default-group -group office

# Domain names ending with ofc are forwarded to the office group for resolution
nameserver /ofc/office

# Set static IP for domain name
address /test.example.com/1.2.3.5

# Block Domains (Ad Blocking)
address /ads.example.com/#

# The following features are not yet supported in the [C SmartDNS](https://github.com/pymumu/smartdns) and are only applicable to SmartDNS-rs.
# Configure DoH3
server-h3 1.1.1.1

# Configure DoQ
server-quic unfiltered.adguard-dns.com

For more advanced configurations, please refer to here , and refer to TODO for the function coverage.

Building

Assuming you have installed Rust, then you can open the terminal and execute these commands:

git clone https://github.com/mokeyish/smartdns-rs.git
cd smartdns-rs

# install https://github.com/casey/just
cargo install just

# build
just build

# print help
./target/release/smartdns --help

# run
sudo ./target/release/smartdns run -c ./etc/smartdns/smartdns.conf

For cross-compilation, it is recommended to use cross (requires Docker).

Acknowledgments !!!

This software wouldn't have been possible without:

License

This software contains codes from https://github.com/hickory-dns/hickory-dns, which is licensed under either of

And other codes is licensed under

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the GPL-3.0 license, shall be licensed as above, without any additional terms or conditions.

smartdns-rs's People

Contributors

bytemain avatar dependabot[bot] avatar giveup avatar mokeyish avatar pikuzheng avatar pinghigh avatar pymumu avatar samtv12345 avatar zxlhhyccc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

smartdns-rs's Issues

无法监听[::1]:53以外的地址

windows系统,在最新版本的smartdns中,如果我在smartdns.conf中将监听地址设置为[::]:53或[::1]:53,则当我设置本地dns为[::1]:53的时候,smartdns可以生效并正常运行(使用nslookup命令可以看到);
但如果我在smartdns.conf中将监听地址设置为[::2]:53或其他地址,并将本地dns也设置为该地址,使用nslookup命令无法看到smartdns,并且此时电脑无法正常上网。
此外,在设置为[::]:53时也有一定概率在运行一段时间后无法上网。

windows 下运行一段时间后会停止解析,导致无法上网

平台:Windows11
问题:在最新的0.5.0版本中,运行一段时间后停止解析的问题依然存在,或者说从0.3.2版本开始就一直没有解决,而0.3.1版本中没有该问题。
不管是以服务方式还是命令行方式运行,几分钟后用nslookup命令查看,均不会显示smartdns,同时网络也无法正常访问。
重启服务后会短暂恢复,但几分钟后会再次停止。

windows版本配置键domain-rules的-no-cache 无效

我在windows10运行 smartdns-x86_64-pc-windows-msvc 版本,提示 domain-rules的-no-cache 属性无效。
那请问我怎么样让某些特定的域名不缓存,比如DDNS? (Linux正常)
运行结果:
1
配置:
2

33

性能恶劣?

使用dnspref测试,脚本参考 pymumu/smartdns#1337 (comment)

受cpu性能限制,c++查询效率大约每秒2万次(目标5万次),cpu使用率90%以上 pymumu/smartdns#1337 (comment)

rust版采用相同配置,查询效率大约每秒2百次,cpu使用率约20%。

localhost:~/test# sh ./runquerypref.sh
DNS Performance Testing Tool
Version 2.11.1

[Status] Command line: dnsperf -p 53 -s 172.19.0.4 -d ./data/querytest_400W.txt
[Status] Sending queries (to 172.19.0.4:53)
[Status] Started at: Wed Mar 22 14:51:15 2023
[Status] Stopping after 1 run through file
^C[Status] Testing complete (interruption)

Statistics:

  Queries sent:         677060
  Queries completed:    676960 (99.99%)
  Queries lost:         0 (0.00%)
  Queries interrupted:  100 (0.01%)

  Response codes:       NOERROR 676960 (100.00%)
  Average packet size:  request 31, response 63
  Run time (s):         2886.670816
  Queries per second:   234.512365

  Average Latency (s):  0.426340 (min 0.058085, max 3.345481)
  Latency StdDev (s):   0.368039

image

·测试结果符合预期吗?
·如何提高运行效率(比如更换编译器、静态链接、增加内存)?

domain-set 似乎没有正常工作

aaa.com
abab.com
domain-set -name block -file E:/apps/smartdns/block.txt
address /domain-set:block/#

这样写入后似乎没有生效(如果没写错的话
表现为配置为 # 的域名还可以正常解析
而把文件格式化成

address /aaa.com/#

再通过 conf-file 方式引入是可以的(表现为解析出SOA

Version:
https://github.com/mokeyish/smartdns-rs/releases/tag/0.1.6

OS:
Edition Windows 11 Pro
Version 22H2
Installed on ‎24/‎11/‎2022
OS build 22621.1105
Experience Windows Feature Experience Pack 1000.22638.1000.0

Device:
Processor AMD Ryzen 7 5800X 8-Core Processor 3.80 GHz
Installed RAM 32.0 GB
System type 64-bit operating system, x64-based processor
Pen and touch No pen or touch input is available for this display

nslookup命令是否已经不能检测samrtdnsn的运行情况?

目前我在使用smartdns时,无论监听127.0.0.1:53还是::1:53,使用nslookup -querytype=ptr smartdns得到的结果都是“DNS request timed out. timeout was 2 seconds.”,但是在debug模式下都显示得到了正确的解析结果,使用wireshark抓包也可以看到返回了不同来源的dns解析结果。就算我将server减少到只有一个223.5.5.5,nslookup依然会报超时,但是dns解析是正常的。

server tls or https to nextdns..

I cannot seem to get tls or https working to nextdns.

egrep -v \#\|^\$ local.conf
bind :5311
bind-tcp :5311
ca-file /etc/ssl/certs/ca-bundle.trust.crt
ca-path /etc/ssl/certs
cache-size 16384
cache-persist no
speed-check-mode none
rr-ttl 300
rr-ttl-min 60
rr-ttl-max 9600
log-level debug
server 45.90.28.0 -bootstrap-dns -exclude-default-group
server-tls 45.90.28.0 -host-name: dns.nextdns.io -tls-host-verify: dns.nextdns.io
server-tls 45.90.30.0 -host-name: dns.nextdns.io -tls-host-verify: dns.nextdns.io
1679311995:INFO: Smart-DNS 🐋 0.4.1 starting
1679311995:INFO: whoami 👉 alma-vltr
1679311995:INFO: upstream server: udp://45.90.28.0 [Group: bootstrap-dns]
1679311995:INFO: upstream server: udp://dns.nextdns.io [Group: default]
1679311995:INFO: upstream server: udp://dns.nextdns.io [Group: default]
1679311995:WARN:smartdns::dns_client:101: bootstrap-dns must use ip addess, Domain("45.90.28.0")
1679311995:WARN:smartdns::dns_client:120: not bootstrap-dns found, use system_conf instead.
1679311995:DEBUG:smartdns::dns_client:179: create name server [Group: bootstrap-dns], servers 1
1679311995:DEBUG:smartdns::dns_client:179: create name server [Group: Default], servers 1
1679311995:DEBUG:smartdns:271: binding UDP to 0.0.0.0:5311
1679311995:INFO: listening for UDP on 0.0.0.0:5311
1679311995:DEBUG:smartdns:293: binding TCP to 0.0.0.0:5311
1679311995:INFO: listening for TCP on 0.0.0.0:5311
1679311995:INFO:
1679311995:INFO:      _____                      _       _____  _   _  _____
1679311995:INFO:     / ____|                    | |     |  __ \| \ | |/ ____|
1679311995:INFO:    | (___  _ __ ___   __ _ _ __| |_    | |  | |  \| | (___
1679311995:INFO:     \___ \| '_ ` _ \ / _` | '__| __|   | |  | | . ` |\___ \
1679311995:INFO:     ____) | | | | | | (_| | |  | |_    | |__| | |\  |____) |
1679311995:INFO:    |_____/|_| |_| |_|\__,_|_|   \__|   |_____/|_| \_|_____/
1679311995:INFO:
1679311995:INFO: awaiting connections...
1679311995:INFO: server starting up
1679312007:DEBUG:smartdns::dns_server:131: query received: 53443 name: www.amazon.com. type: A class: IN A client: 127.0.0.1:25165
1679312007:DEBUG:smartdns::dns_client:373: initialize name server [Group: Default]
1679312007:DEBUG:smartdns::dns_client::bootstrap:1170: lookup nameserver dns.nextdns.io A, [45.11.106.155, 188.172.219.167]
1679312007:DEBUG:smartdns::dns_mw_ns:99: query name: www.amazon.com. type: A via [Group: default]
1679312012:DEBUG:smartdns::dns_server:269: error resolving: Forward resolution error: request timed out
 drill dns.nextdns.io -p 5311 @127.0.0.1
;; ->>HEADER<<- opcode: QUERY, rcode: NOERROR, id: 4811
;; flags: qr rd ra ; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;; dns.nextdns.io.      IN      A

;; ANSWER SECTION:
dns.nextdns.io. 1388    IN      CNAME   steering.nextdns.io.
steering.nextdns.io.    1388    IN      A       45.11.106.155
steering.nextdns.io.    1388    IN      A       188.172.219.167

;; AUTHORITY SECTION:

;; ADDITIONAL SECTION:

;; Query time: 1 msec
;; SERVER: 127.0.0.1
;; WHEN: Mon Mar 20 07:39:21 2023
;; MSG SIZE  rcvd: 97
1679312398:DEBUG:smartdns::dns_server:131: query received: 25431 name: www.google.com. type: A class: IN A client: 127.0.0.1:17855
1679312398:DEBUG:smartdns::dns_mw_ns:99: query name: www.google.com. type: A via [Group: default]
1679312403:DEBUG:smartdns::dns_server:269: error resolving: Forward resolution error: request timed out
1679312403:DEBUG:smartdns::dns_server:131: query received: 25431 name: www.google.com. type: A class: IN A client: 127.0.0.1:37703
1679312403:DEBUG:smartdns::dns_mw_ns:99: query name: www.google.com. type: A via [Group: default]
1679312408:DEBUG:smartdns::dns_server:269: error resolving: Forward resolution error: request timed out
1679312408:DEBUG:smartdns::dns_server:131: query received: 25431 name: www.google.com. type: A class: IN A client: 127.0.0.1:3838
1679312408:DEBUG:smartdns::dns_mw_ns:99: query name: www.google.com. type: A via [Group: default]
1679312413:DEBUG:smartdns::dns_server:269: error resolving: Forward resolution error: request timed out

Using same config with latest smartdns seems to work:

./smartdns-x86_64 -c local.conf -x

[2023-03-20 07:44:12,909][NOTICE][       smartdns.c:397 ] smartdns starting...(Copyright (C) Nick Peng <[email protected]>, build: Mar  4 2023 11:26:35)
[2023-03-20 07:44:12,914][ INFO][     dns_server.c:4612] ICMP ping is disabled, no ipv6 icmp check feature
[2023-03-20 07:44:12,914][ INFO][     dns_server.c:6311] IPV6 is not ready, disable IPV6 features
[2023-03-20 07:44:12,914][ INFO][     dns_client.c:1127] add server 45.90.28.0:53, type: udp
[2023-03-20 07:44:12,982][ INFO][     dns_client.c:1127] add server 45.90.28.0:853, type: tls
[2023-03-20 07:44:12,982][ INFO][     dns_client.c:1127] add server 45.90.30.0:853, type: tls
[2023-03-20 07:44:26,251][DEBUG][     dns_server.c:5119] recv query packet from 127.0.0.1, len = 32, type = 0
[2023-03-20 07:44:26,251][DEBUG][     dns_server.c:5131] request qdcount = 1, ancount = 0, nscount = 0, nrcount = 0, len = 32, id = 46172, tc = 0, rd = 1, ra = 0, rcode = 0
[2023-03-20 07:44:26,251][ INFO][     dns_server.c:5154] query server www.google.com from 127.0.0.1, qtype: 1
[2023-03-20 07:44:26,251][DEBUG][     dns_client.c:554 ] send query to group default
[2023-03-20 07:44:26,251][DEBUG][     dns_client.c:3293] send query to server 45.90.30.0
[2023-03-20 07:44:26,252][DEBUG][     dns_client.c:2056] tls server 45.90.30.0 connecting.
[2023-03-20 07:44:26,252][DEBUG][     dns_client.c:3293] send query to server 45.90.28.0
[2023-03-20 07:44:26,253][DEBUG][     dns_client.c:2056] tls server 45.90.28.0 connecting.
[2023-03-20 07:44:26,253][ INFO][     dns_client.c:3595] send request www.google.com, qtype 1, id 40969
[2023-03-20 07:44:26,263][DEBUG][     dns_client.c:2900] tls server 45.90.28.0 connected.
[2023-03-20 07:44:26,263][DEBUG][     dns_client.c:2905] new session
[2023-03-20 07:44:26,263][DEBUG][     dns_client.c:2775] peer CN: dns.nextdns.io
[2023-03-20 07:44:26,263][DEBUG][     dns_client.c:2826] cert SPKI pin(sha256): E8:29:ED:C5:2A:D9:A1:C7:C8:FB:AE:47:22:5B:26:64:4E:46:1B:9D:EE:98:01:70:AD:24:E4:5C:AF:05:F2:85
[2023-03-20 07:44:26,269][DEBUG][     dns_client.c:2900] tls server 45.90.30.0 connected.
[2023-03-20 07:44:26,269][DEBUG][     dns_client.c:2905] new session
[2023-03-20 07:44:26,270][DEBUG][     dns_client.c:2775] peer CN: dns.nextdns.io
[2023-03-20 07:44:26,270][DEBUG][     dns_client.c:2826] cert SPKI pin(sha256): E8:29:ED:C5:2A:D9:A1:C7:C8:FB:AE:47:22:5B:26:64:4E:46:1B:9D:EE:98:01:70:AD:24:E4:5C:AF:05:F2:85
[2023-03-20 07:44:26,270][DEBUG][     dns_client.c:2523] recv tcp packet from 45.90.28.0, len = 470
[2023-03-20 07:44:26,270][DEBUG][            dns.c:1881] opt type 12
[2023-03-20 07:44:26,270][DEBUG][     dns_client.c:1644] qdcount = 1, ancount = 1, nscount = 0, nrcount = 0, len = 468, id = 40969, tc = 0, rd = 1, ra = 1, rcode = 0, payloadsize = 1232
[2023-03-20 07:44:26,270][DEBUG][     dns_client.c:1655] domain: www.google.com qtype: 1  qclass: 1
[2023-03-20 07:44:26,270][DEBUG][     dns_server.c:3302] query result from server 45.90.28.0: 853, type: 2
[2023-03-20 07:44:26,270][DEBUG][     dns_server.c:2657] domain: www.google.com TTL: 104 IP: 142.251.35.164
[2023-03-20 07:44:26,270][ INFO][     dns_server.c:1928] result: www.google.com, qtype: 1, rtt: -0.1 ms, 142.251.35.164
[2023-03-20 07:44:26,270][DEBUG][     dns_server.c:1682] reply www.google.com qtype: 1, rcode: 0, reply: 1
[2023-03-20 07:44:26,270][DEBUG][     dns_server.c:846 ] result: www.google.com, rtt: -0.1 ms, 142.251.35.164
[2023-03-20 07:44:26,271][DEBUG][     dns_server.c:1142] cache www.google.com qtype: 1 ttl: 300
[2023-03-20 07:44:26,278][DEBUG][     dns_client.c:2523] recv tcp packet from 45.90.30.0, len = 470
[2023-03-20 07:44:26,278][DEBUG][            dns.c:1881] opt type 12
[2023-03-20 07:44:26,278][DEBUG][     dns_client.c:1644] qdcount = 1, ancount = 1, nscount = 0, nrcount = 0, len = 468, id = 40969, tc = 0, rd = 1, ra = 1, rcode = 0, payloadsize = 1232
[2023-03-20 07:44:26,278][DEBUG][     dns_client.c:1655] domain: www.google.com qtype: 1  qclass: 1
[2023-03-20 07:44:26,278][DEBUG][     dns_server.c:3302] query result from server 45.90.30.0: 853, type: 2
[2023-03-20 07:44:26,278][DEBUG][     dns_server.c:2657] domain: www.google.com TTL: 95 IP: 142.251.35.164
[2023-03-20 07:44:26,278][DEBUG][     dns_client.c:1429] result: www.google.com, qtype: 1, has-result: 1, id 40969

Do you think tls/https still a work in progress?

Thank you in advance.

Alma linux (glibc), latest stable smartdns-rs (musl) not sure if that is the 'problem'

[I] root@alma-vltr /e/smartdns (master) [2]# /usr/sbin/smartdns --help
A cross platform local DNS server written in rust to obtain the fastest website IP for the best Internet experience, support DoT, DoH.


Usage: smartdns <COMMAND>

Commands:
  run      Run the Smart-DNS server
  service  Manage the Smart-DNS service (install, uninstall, start, stop, restart)
  help     Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version
[I] root@alma-vltr /e/smartdns (master)# /usr/sbin/smartdns --version
smartdns 0.4.1

macOS 无法监听v6地址

macOS 13 x64环境下。

bind [::1]:53
bind [::]:53
bind localhost:53

配置文件似乎只要监听了v6地址,就会如下报错。
麻烦检查下监听v6地址相关。谢谢。

sudo /usr/local/bin/smartdns run -c /usr/local/etc/smartdns/smartdns.conf
1677077038:INFO: Smart-DNS 🐋 0.1.9 starting
1677077038:INFO: loading configuration from: "/usr/local/etc/smartdns/smartdns.conf"
thread 'main' panicked at 'localhost:53addr expect [::]:53 or 0.0.0.0:53', src/dns_conf.rs:437:14
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

MacOS bind address already in use.

image

bind监听端口:
bind :8051@en0

使用bind :8051时,可以正常使用本机回环地址查询dns;
选定网口en0时,无法在本机上使用本机回环地址、局域网地址进行查询,局域网其他设备也无法进行dns查询,无log输出。

监听[::1]:53地址出错

系统:windows11专业版
在最新的0.6.2版本中,电脑有IPV6地址的情况下无法监听[::1]地址,nslookup命令显示超时,log中无报错记录;而相同配置文件,改为监听IPV4地址127.0.0.1:53时一切正常。
在ubuntu系统下试验,c语言版smartdns可以正常监听IPV6或是IPV4,所以应该不是我网络的问题。

为何运行cargo build --release编译失败?

lin@lin-virtual-machine:~/图片/smartdns-rs$ cargo build --release
   Compiling smartdns v0.1.0 (/home/lin/图片/smartdns-rs)
warning: to use a constant of type `Ipv4Addr` in a pattern, `Ipv4Addr` must be annotated with `#[derive(PartialEq, Eq)]`
  --> src/preset_ns.rs:40:13
   |
40 |             CLOUDFLARE_IPS => "cloudflare-dns.com",
   |             ^^^^^^^^^^^^^^
   |
   = note: `#[warn(indirect_structural_match)]` on by default
   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
   = note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/62411>

thread 'rustc' panicked at 'called `Result::unwrap()` on an `Err` value: FallbackToConstRef(())', compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs:164:83
stack backtrace:
   0:     0x7f3b6213f4fd - std::backtrace_rs::backtrace::libunwind::trace::h701a19af54e96518
                               at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f3b6213f4fd - std::backtrace_rs::backtrace::trace_unsynchronized::h72ee8a54c0971fed
                               at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f3b6213f4fd - std::sys_common::backtrace::_print_fmt::h107ba6740bde4568
                               at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f3b6213f4fd - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h6ef53fbc8fdae4ac
                               at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f3b6219935c - core::fmt::write::h65db65649c4a3094
                               at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/fmt/mod.rs:1194:17
   5:     0x7f3b62130a51 - std::io::Write::write_fmt::h2a783718d67af8f3
                               at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/std/src/io/mod.rs:1655:15
   6:     0x7f3b621425e5 - std::sys_common::backtrace::_print::he0510d2c6a87b26b
                               at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f3b621425e5 - std::sys_common::backtrace::print::hd2a99ac691f33dce
                               at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f3b621425e5 - std::panicking::default_hook::{{closure}}::hf449f9dd4998781a
                               at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/std/src/panicking.rs:295:22
   9:     0x7f3b62142299 - std::panicking::default_hook::he8f54f41bcecb62f
                               at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/std/src/panicking.rs:314:9
  10:     0x7f3b628c45a1 - rustc_driver[567d1d5f3a7c5811]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f3b4f9959a9 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hb2816a6f3592cb95
  12:     0x7f3b4f9aea64 - proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::enter::{{closure}}::{{closure}}::hadaaaee027d39c16
  13:     0x7f3b4f9bbd46 - std::panicking::update_hook::{{closure}}::h1a114f1cdbaa3a08
  14:     0x7f3b62142d30 - std::panicking::rust_panic_with_hook::h3c6fb7c0bbe9c7a1
                               at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/std/src/panicking.rs:702:17
  15:     0x7f3b62142b67 - std::panicking::begin_panic_handler::{{closure}}::h1fbef4cbf40a70cf
                               at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/std/src/panicking.rs:588:13
  16:     0x7f3b6213f9b4 - std::sys_common::backtrace::__rust_end_short_backtrace::h8fee2597b379cc21
                               at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/std/src/sys_common/backtrace.rs:138:18
  17:     0x7f3b62142899 - rust_begin_unwind
                               at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/std/src/panicking.rs:584:5
  18:     0x7f3b621069e3 - core::panicking::panic_fmt::h4c16adcdb276f16f
                               at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/panicking.rs:143:14
  19:     0x7f3b62106ad3 - core::result::unwrap_failed::h4642b44f48942d78
                               at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/result.rs:1785:5
  20:     0x7f3b63f5bd57 - <rustc_infer[3691bb34c1717fd7]::infer::InferCtxtBuilder>::enter::<rustc_middle[80ce3c200b65c1bf]::thir::Pat, <rustc_mir_build[24c68b2faf4d7adc]::thir::pattern::PatCtxt>::const_to_pat::{closure#0}>
  21:     0x7f3b64b26510 - <rustc_mir_build[24c68b2faf4d7adc]::thir::pattern::PatCtxt>::const_to_pat
  22:     0x7f3b63f304fe - <rustc_mir_build[24c68b2faf4d7adc]::thir::pattern::PatCtxt>::lower_path
  23:     0x7f3b63f2cd6c - <rustc_mir_build[24c68b2faf4d7adc]::thir::pattern::PatCtxt>::lower_pattern
  24:     0x7f3b63f67eb6 - <core[48d2d63575a1b4fb]::iter::adapters::map::Map<core[48d2d63575a1b4fb]::slice::iter::Iter<rustc_hir[8ae6c0dca9300fdf]::hir::Arm>, <rustc_mir_build[24c68b2faf4d7adc]::thir::pattern::check_match::MatchVisitor>::check_match::{closure#0}> as core[48d2d63575a1b4fb]::iter::traits::iterator::Iterator>::fold::<(), core[48d2d63575a1b4fb]::iter::traits::iterator::Iterator::for_each::call<rustc_mir_build[24c68b2faf4d7adc]::thir::pattern::usefulness::MatchArm, <alloc[43519ed41124516]::vec::Vec<rustc_mir_build[24c68b2faf4d7adc]::thir::pattern::usefulness::MatchArm> as alloc[43519ed41124516]::vec::spec_extend::SpecExtend<rustc_mir_build[24c68b2faf4d7adc]::thir::pattern::usefulness::MatchArm, core[48d2d63575a1b4fb]::iter::adapters::map::Map<core[48d2d63575a1b4fb]::slice::iter::Iter<rustc_hir[8ae6c0dca9300fdf]::hir::Arm>, <rustc_mir_build[24c68b2faf4d7adc]::thir::pattern::check_match::MatchVisitor>::check_match::{closure#0}>>>::spec_extend::{closure#0}>::{closure#0}>
  25:     0x7f3b64b34a71 - <alloc[43519ed41124516]::vec::Vec<rustc_mir_build[24c68b2faf4d7adc]::thir::pattern::usefulness::MatchArm> as alloc[43519ed41124516]::vec::spec_from_iter::SpecFromIter<rustc_mir_build[24c68b2faf4d7adc]::thir::pattern::usefulness::MatchArm, core[48d2d63575a1b4fb]::iter::adapters::map::Map<core[48d2d63575a1b4fb]::slice::iter::Iter<rustc_hir[8ae6c0dca9300fdf]::hir::Arm>, <rustc_mir_build[24c68b2faf4d7adc]::thir::pattern::check_match::MatchVisitor>::check_match::{closure#0}>>>::from_iter
  26:     0x7f3b63f5423f - <rustc_mir_build[24c68b2faf4d7adc]::thir::pattern::check_match::MatchVisitor as rustc_hir[8ae6c0dca9300fdf]::intravisit::Visitor>::visit_expr
  27:     0x7f3b63f53ecf - <rustc_mir_build[24c68b2faf4d7adc]::thir::pattern::check_match::MatchVisitor as rustc_hir[8ae6c0dca9300fdf]::intravisit::Visitor>::visit_expr
  28:     0x7f3b63f53ee9 - <rustc_mir_build[24c68b2faf4d7adc]::thir::pattern::check_match::MatchVisitor as rustc_hir[8ae6c0dca9300fdf]::intravisit::Visitor>::visit_expr
  29:     0x7f3b63f53883 - rustc_mir_build[24c68b2faf4d7adc]::thir::pattern::check_match::check_match
  30:     0x7f3b641cce0e - rustc_query_system[a211d6db6b7bb5c6]::query::plumbing::try_execute_query::<rustc_query_impl[41c9f61e780c6183]::plumbing::QueryCtxt, rustc_query_system[a211d6db6b7bb5c6]::query::caches::DefaultCache<rustc_span[590a2279fe342e71]::def_id::DefId, ()>>
  31:     0x7f3b64292ed0 - <rustc_query_impl[41c9f61e780c6183]::Queries as rustc_middle[80ce3c200b65c1bf]::ty::query::QueryEngine>::check_match
  32:     0x7f3b63ad7b94 - <rustc_session[1bd44c9aeaf68c2e]::session::Session>::time::<(), rustc_interface[f5b05d2a4419ce67]::passes::analysis::{closure#1}::{closure#0}::{closure#0}>
  33:     0x7f3b64787954 - <rustc_session[1bd44c9aeaf68c2e]::session::Session>::time::<(), rustc_interface[f5b05d2a4419ce67]::passes::analysis::{closure#1}>
  34:     0x7f3b6477adce - rustc_interface[f5b05d2a4419ce67]::passes::analysis
  35:     0x7f3b64c4d9be - rustc_query_system[a211d6db6b7bb5c6]::query::plumbing::try_execute_query::<rustc_query_impl[41c9f61e780c6183]::plumbing::QueryCtxt, rustc_query_system[a211d6db6b7bb5c6]::query::caches::DefaultCache<(), core[48d2d63575a1b4fb]::result::Result<(), rustc_errors[8f15b138673742da]::ErrorGuaranteed>>>
  36:     0x7f3b64c90c7e - rustc_query_system[a211d6db6b7bb5c6]::query::plumbing::get_query::<rustc_query_impl[41c9f61e780c6183]::queries::analysis, rustc_query_impl[41c9f61e780c6183]::plumbing::QueryCtxt>
  37:     0x7f3b64754054 - <rustc_interface[f5b05d2a4419ce67]::passes::QueryContext>::enter::<rustc_driver[567d1d5f3a7c5811]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[48d2d63575a1b4fb]::result::Result<(), rustc_errors[8f15b138673742da]::ErrorGuaranteed>>
  38:     0x7f3b6473fd88 - <rustc_interface[f5b05d2a4419ce67]::interface::Compiler>::enter::<rustc_driver[567d1d5f3a7c5811]::run_compiler::{closure#1}::{closure#2}, core[48d2d63575a1b4fb]::result::Result<core[48d2d63575a1b4fb]::option::Option<rustc_interface[f5b05d2a4419ce67]::queries::Linker>, rustc_errors[8f15b138673742da]::ErrorGuaranteed>>
  39:     0x7f3b6475389f - rustc_span[590a2279fe342e71]::with_source_map::<core[48d2d63575a1b4fb]::result::Result<(), rustc_errors[8f15b138673742da]::ErrorGuaranteed>, rustc_interface[f5b05d2a4419ce67]::interface::create_compiler_and_run<core[48d2d63575a1b4fb]::result::Result<(), rustc_errors[8f15b138673742da]::ErrorGuaranteed>, rustc_driver[567d1d5f3a7c5811]::run_compiler::{closure#1}>::{closure#1}>
  40:     0x7f3b647409b7 - <scoped_tls[6c583823b66fe937]::ScopedKey<rustc_span[590a2279fe342e71]::SessionGlobals>>::set::<rustc_interface[f5b05d2a4419ce67]::interface::run_compiler<core[48d2d63575a1b4fb]::result::Result<(), rustc_errors[8f15b138673742da]::ErrorGuaranteed>, rustc_driver[567d1d5f3a7c5811]::run_compiler::{closure#1}>::{closure#0}, core[48d2d63575a1b4fb]::result::Result<(), rustc_errors[8f15b138673742da]::ErrorGuaranteed>>
  41:     0x7f3b64767e3f - std[f62804d94bf33ed9]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[f5b05d2a4419ce67]::util::run_in_thread_pool_with_globals<rustc_interface[f5b05d2a4419ce67]::interface::run_compiler<core[48d2d63575a1b4fb]::result::Result<(), rustc_errors[8f15b138673742da]::ErrorGuaranteed>, rustc_driver[567d1d5f3a7c5811]::run_compiler::{closure#1}>::{closure#0}, core[48d2d63575a1b4fb]::result::Result<(), rustc_errors[8f15b138673742da]::ErrorGuaranteed>>::{closure#0}, core[48d2d63575a1b4fb]::result::Result<(), rustc_errors[8f15b138673742da]::ErrorGuaranteed>>
  42:     0x7f3b64753359 - <<std[f62804d94bf33ed9]::thread::Builder>::spawn_unchecked_<rustc_interface[f5b05d2a4419ce67]::util::run_in_thread_pool_with_globals<rustc_interface[f5b05d2a4419ce67]::interface::run_compiler<core[48d2d63575a1b4fb]::result::Result<(), rustc_errors[8f15b138673742da]::ErrorGuaranteed>, rustc_driver[567d1d5f3a7c5811]::run_compiler::{closure#1}>::{closure#0}, core[48d2d63575a1b4fb]::result::Result<(), rustc_errors[8f15b138673742da]::ErrorGuaranteed>>::{closure#0}, core[48d2d63575a1b4fb]::result::Result<(), rustc_errors[8f15b138673742da]::ErrorGuaranteed>>::{closure#1} as core[48d2d63575a1b4fb]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  43:     0x7f3b6214cf23 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h5f2cc5c325bd6f26
                               at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/alloc/src/boxed.rs:1861:9
  44:     0x7f3b6214cf23 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h1873871631f0e48e
                               at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/alloc/src/boxed.rs:1861:9
  45:     0x7f3b6214cf23 - std::sys::unix::thread::Thread::new::thread_start::he96d38568e3469f7
                               at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/std/src/sys/unix/thread.rs:108:17
  46:     0x7f3b61c866db - start_thread
                               at /build/glibc-CVJwZb/glibc-2.27/nptl/pthread_create.c:463
  47:     0x7f3b617a761f - clone
                               at /build/glibc-CVJwZb/glibc-2.27/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95
  48:                0x0 - <unknown>

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.61.0-nightly (76d770ac2 2022-04-02) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type bin -C opt-level=3 -C embed-bitcode=no

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [check_match] match-checking `preset_ns::<impl at src/preset_ns.rs:37:1: 47:2>::get_host_name`
#1 [analysis] running analysis passes on this crate
end of query stack
warning: `smartdns` (bin "smartdns") generated 1 warning
error: could not compile `smartdns`; 1 warning emitted

thread 'main' panicked at 'No configuation file found.

默认配置,系统是windows
2023-07-17 16:07:32.864:INFO: Smart-DNS 🐋 0.6.2 starting
thread 'main' panicked at 'No configuation file found.', src\dns_conf.rs:84:18
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

2023-07-17 16:07:43.832:INFO: Smart-DNS 🐋 0.6.2 starting
thread 'main' panicked at 'No configuation file found.', src\dns_conf.rs:84:18
stack backtrace:
note: Some details are omitted, run with RUST_BACKTRACE=full for a verbose backtrace.

2023-07-17 16:07:49.752:INFO: Smart-DNS 🐋 0.6.2 starting
thread 'main' panicked at 'No configuation file found.', src\dns_conf.rs:84:18
stack backtrace:
0: 0x7ff7bc8198da -
1: 0x7ff7bc5641eb -
2: 0x7ff7bc7fc64a -
3: 0x7ff7bc81bd8b -
4: 0x7ff7bc81b982 -
5: 0x7ff7bc81c8d2 -
6: 0x7ff7bc81c326 -
7: 0x7ff7bc81c279 -
8: 0x7ff7bc81c264 -
9: 0x7ff7bc8f7765 -
10: 0x7ff7bc8f7ba2 -
11: 0x7ff7bc7eb6b0 -
12: 0x7ff7bc7fb30d -
13: 0x7ff7bc728a22 -
14: 0x7ff7bc5153de -
15: 0x7ff7bc7fa6c4 -
16: 0x7ff7bc8f640c -
17: 0x7ffd28317ac4 - BaseThreadInitThunk
18: 0x7ffd29aba351 - RtlUserThreadStart

max-reply-ip-num 配置大于1的值时,进程崩溃

max-reply-ip-num 1 时:

# nslookup www.baidu.com
服务器:  UnKnown
Address:  xxxxxxxxx

非权威应答:
名称:    www.a.shifen.com
Address:  110.242.68.4

max-reply-ip-num 2 时:

# nslookup www.baidu.com
服务器:  UnKnown
Address:  xxxxxxxxx

DNS request timed out.
    timeout was 2 seconds.
*** 没有 www.baidu.com 可以使用的 internal type for both IPv4 and IPv6 Addresses (A+AAAA)记录

问题可能

let records = &lookup.records()[0..max_reply_ip_num as usize];

thread 'smartdns-runtime' panicked at 'range end index 2 out of range for slice of length 1', src/dns_mw_addr.rs:49:36
stack backtrace:
   0:     0x7ff4ff64a758 - <unknown>
   1:     0x7ff4ff4266de - <unknown>
   2:     0x7ff4ff61f0a4 - <unknown>
   3:     0x7ff4ff64be5f - <unknown>
   4:     0x7ff4ff64ba5f - <unknown>
   5:     0x7ff4ff64cafc - <unknown>
   6:     0x7ff4ff64c5b4 - <unknown>
   7:     0x7ff4ff64c51c - <unknown>
   8:     0x7ff4ff64c4f1 - <unknown>
   9:     0x7ff4ff3dd8d2 - <unknown>
  10:     0x7ff4ff425c41 - <unknown>
  11:     0x7ff4ff3dd976 - <unknown>
  12:     0x7ff4ff618117 - <unknown>
  13:     0x7ff4ff5609aa - <unknown>
  14:     0x7ff4ff54d6be - <unknown>
  15:     0x7ff4ff5609aa - <unknown>
  16:     0x7ff4ff57ce14 - <unknown>
  17:     0x7ff4ff5609aa - <unknown>
  18:     0x7ff4ff58cdd1 - <unknown>
  19:     0x7ff4ff5609aa - <unknown>
  20:     0x7ff4ff5a9b92 - <unknown>
  21:     0x7ff4ff5ad6fd - <unknown>
  22:     0x7ff4ff5f3cb1 - <unknown>
  23:     0x7ff4ff601966 - <unknown>
  24:     0x7ff4ff3ee867 - <unknown>
  25:     0x7ff4ff675951 - <unknown>
  26:     0x7ff4ff66b8c3 - <unknown>
  27:     0x7ff4ff66f309 - <unknown>
  28:     0x7ff4ff670678 - <unknown>
  29:     0x7ff4ff667830 - <unknown>
  30:     0x7ff4ff64e7e5 - <unknown>

编译报错 error[E0592]: duplicate definitions with name `is_soa`

另外 release中没有 x86_64 linux gun
https://github.com/mokeyish/smartdns-rs/releases

   Compiling pnet_macros v0.31.0
error[E0592]: duplicate definitions with name `is_soa`
   --> /opt/rust/git/checkouts/trust-dns-97a7602ad159d348/41b6e33/crates/proto/src/rr/record_data.rs:59:17
    |
59  | #[derive(Debug, EnumAsInner, PartialEq, Clone, Eq)]
    |                 ^^^^^^^^^^^ duplicate definitions for `is_soa`
...
752 |     pub fn is_soa(&self) -> bool {
    |     ---------------------------- other definition for `is_soa`
    |
    = note: this error originates in the derive macro `EnumAsInner` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0592`.
error: could not compile `trust-dns-proto` (lib) due to previous error
warning: build failed, waiting for other jobs to finish...

smartdns 0.6.2 failed to build against rust 1.71.0

While upgrading rust to 1.71.0, we found some build failure as shown below:

error[E0277]: the trait bound `connection_provider::TokioRuntimeProvider: ConnectionProvider` is not satisfied in `dns_client::NameServer`
    --> src/dns_client.rs:1100:10
     |
1100 |     impl BootstrapResolver<NameServerGroup> {
     |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `dns_client::NameServer`, the trait `ConnectionProvider` is not implemented for `connection_provider::TokioRuntimeProvider`
     |
     = help: the trait `ConnectionProvider` is implemented for `GenericConnector<P>`

full build log, https://github.com/Homebrew/homebrew-core/actions/runs/5594719599/job/15158499681?pr=136514

默认地址[::]无法监听,导致示例配置文件失效

若配置文件中监听地址设为[::],命令行运行会报错,必须改为[::1]才能监听。这也导致example文件夹中提供的配置文件示例无法直接拿来使用,希望能够更新配置文件的示例。
还有,localhost什么时候改成只监听127.0.0.1的?一开始没反应过来,拿命令行运行一次才知道现在localhost不会同时监听[::1]了,还是以前同时监听用着方便一些。

domain-set 不工作?

最新代码自编译。配置文件主要如下:

dualstack-ip-selection no
cname /services.googleapis.cn/services.googleapis.com
domain-set -name google -file /etc/smartdns/google.txt
domain-rules /domain-set:google/ -speed-check-mode none -nameserver outbound -address #6

其中 /etc/smartdns/google.txt 文件:

googleapis.cn
googleapis.com
google.com
.......

测试

# nslookup www.google.com
服务器:  UnKnown
Address:  xxxxxxx

非权威应答:
名称:    www.google.com
Addresses:  2404:6800:4004:80f::2004                <------------------ ipv6结果预期没有(-address #6)
          142.251.222.4

# nslookup services.googleapis.cn. 
服务器:  UnKnown
Address:  xxxxxxxx

名称:    services.googleapis.com
Addresses:  2404:6800:4004:822::200a                 <------------------ ipv4结果没有了
          2404:6800:4004:812::200a
          2404:6800:4004:81d::200a
          2404:6800:4004:821::200a

请问一下这样是生效了没

我前台了命令.\smartdns.exe run -c .\smartdns.conf -d后正常启动了,使用nslookup命令提示

服务器:  UnKnown
Address:  192.168.3.1

非权威应答:
名称:    baidu.com
Addresses:  39.156.66.10
          110.242.68.66

image
以下是我的配置文件

#绑定端口
bind [::]:6353

#指定缓存大小
cache-size 32768

#开启预取
prefetch-domain yes

#开启过期缓存
serve-expired yes

#禁用ipv6
force-AAAA-SOA yes

#禁用 SOA 65
force-qtype-SOA 65

#设置日志文件
log-level debug
log-file smartdns.log
log-size 64k
log-num 1

#指定上游服务器解析DOH,搭配下面的nameserver避免各方打架,不参与默认解析
server 8.8.8.8 -group google -exclude-default-group
server 8.8.4.4 -group google -exclude-default-group
server 1.1.1.1 -group cloudflare -exclude-default-group
server 1.0.0.1 -group cloudflare -exclude-default-group
server 9.9.9.9 -group quad9 -exclude-default-group
server 208.67.222.222 -group opendns -exclude-default-group
server 223.6.6.6 -group alidns -exclude-default-group
server 223.5.5.5 -group alidns -exclude-default-group
server 119.29.29.29 -group dnspod -exclude-default-group
server 119.28.28.28 -group dnspod -exclude-default-group
server 101.101.101.101 -group twnic -exclude-default-group

#CN组服务器,用于解析**域名列表,不参与默认解析,防止泄露
server-https https://dns.alidns.com/dns-query -group cn -exclude-default-group
server-https https://doh.pub/dns-query -group cn -exclude-default-group
server 114.114.114.114 -group cn -exclude-default-group
server 1.2.4.8 -group cn -exclude-default-group

#默认组
server-https https://dns.google/dns-query
server-https https://dns.quad9.net/dns-query
server-https https://doh.opendns.com/dns-query
server-https https://cloudflare-dns.com/dns-query
server-https https://dns.twnic.tw/dns-query

#指定上游解析DOH服务器
nameserver /alidns.com/alidns
nameserver /doh.pub/dnspod
nameserver /dns.google/google
nameserver /quad9.net/quad9
nameserver /opendns.com/opendns
nameserver /cloudflare-dns.com/cloudflare
nameserver /twnic.tw/twnic

Log message at the beginning: _client::bootstrap:1055

2023-05-31 19:11:02.599:WARN:smartdns::dns_client::bootstrap:1055: read system conf failed, Error parsing resolv.conf: Malformed label: :q

I used the following configuration.

smartdns (2).txt

I did some tests and tried to breach through. Almost all urls where blocked correctly. So well done.

I also noticed that some urls can leak through. E.g. the url in line 2569 can somehow redirect to country.domain

最新commit运行1天后出现问题!

问题:
1、会导致原来的www.youtube.com自动变成youtube.com,无法打开油管;
2、在github通过wget下载raw文件时,点击某个文件的raw无法登陆打开网页,导致无法wget方式下载,报错提示为tls问题;
3、无法svn export方式下载仓库文件夹,提示语第2点一样。

添加dns后出现错误

在配置文件添加多个dns sever后,出现错误提示:
1676815550:WARN:smartdns::trust_dns:33: nameserver 101.101.101.101:53 skipped. Timeout
1676815583:ERROR:smartdns::dns_server:212: error sending response: unknown

解析不稳定?

win11专业版,从0.6.2升级到0.6.4之后,conf没有任何更改,加了-d后也没有报错,但电脑开始频繁断网,隔一段时间任务栏右下角就会显示网络连接断开,且nslookup命令一直显示超时。

Adblock

Hello I have read the configuration and I can use a file as adblock domain list. But in anywhere in the config I can't understand how to use a whitelist set. So that adblock blocks the ads but the whitelists domains are not blocked and let through.

Can you please tell the config lines for adding whitelists?

init脚本还是存在一点问题,原版代码与这几行代码不同!

原版代码与这几行代码不同!如果是原版代码,会导致无法运行,但这里的几行判断代码会导致此项目不能使用转发规则文件,怀疑还是源码存在问题!
项目里的init脚本代码:
https://github.com/mokeyish/smartdns-rs/blob/main/contrib/openwrt/conf/smartdns.init#L299-L303
原版的init脚本代码:
https://github.com/pymumu/smartdns/blob/master/package/openwrt/files/etc/init.d/smartdns#L299-L300

运行一段时间后程序会停止解析

我在最新的0.2.2版本里遇到了一个奇怪的bug:
不管是以服务运行还是命令行运行,初次运行之后在nslookup命令中均无法看到smartdns,命令行运行则会报错unkown response,但是关闭命令行重开一次,或者重启服务后,一切恢复正常,nslookkup命令可以检测到smartdns,使用也没有问题,可以正常解析,但是运行一段时间后又无法解析。
更新:目前最新的0.4.1和0.3.2版本中出现了同样的情况,0.3.1和0.3.0无此问题。

win11的系统dns设置要怎么设置呀?

image
这里的dns设置应该怎么设置?然后配置文件的bind应该怎么写比较好?

我在win11的系统设置里,ipv4的dns设置的127.0.0.1,然后配置文件bind的[::]:53,浏览器无法解析dns

windows 下 service如何调用配置文件0.0

windows 下 service如何调用配置文件0.0

smartdns service install 之后 如何调用配置文件 谢大佬

官方看不懂--
sc [] config [] [type= {own | share | kernel | filesys | rec | adapt | interact type= {own | share}}] [start= {boot | system | auto | demand | disabled | delayed-auto}] [error= {normal | severe | critical | ignore}] [binpath= ] [group= ] [tag= {yes | no}] [depend= ] [obj= { | }] [displayname= ] [password= ]

想问下是否支持 ECS

没看到说明里有说是否支持,trust-dns 好像也不支持。所以有个疑问,最近在找 AdGuardHome 服务器上的替代品

Android下smartdns监听53端口会出现Segmentation fault及一些怪异行为

我是在termux环境下进行的使用,并已执行了tsu命令,只要尝试监听53端口,smartdns就会要求读取/etc/resolv.conf文件(但是我填了上游dns服务器,没有必要读取才对),在执行了termux-chroot命令后,无法读取的提示消失了,但是直接就Segmentation fault了;我也尝试过通过setcap给予绑定低位端口的权限,但是smartdns仍报告权限不够。
但是只要不试图监听53端口,就没有任何问题

重开贴:大佬,最新commit的端口绑定又失效了!!!

commit:da2926214d3b0340fe8996dd65d3f7b570d4d1ae
1、无论是luci配置还是自定义配置(哪怕是其中一个也不行,原来的其中一个绑定可以运行),加入端口和设备绑定后不能运行,去掉端口和设备绑定却正常运行!!!
2、上游国外DOH服务器可以正常解析。。。。
3、自定义配置中测速无效。。。。
4、最新commit编译时文件是317,而原来的是318(见原来的图):
image

运行一段时间后停止解析

在log文件中发现报错:
2023-05-21 10:45:43.528:DEBUG:smartdns::dns_server:288: error resolving: Forward resolution error: proto error: io error: 远程主机强迫关闭了一个现有的连接。 (os error 10054)
2023-05-21 10:46:27.883:DEBUG:smartdns::dns_server:288: error resolving: Forward resolution error: proto error: io error: 套接字操作尝试一个无法连接的主机。 (os error 10065)
然后电脑无法上网,重启服务后短暂恢复正常。

ipv6 soa 返回空白记录

C:\Users\Administrator>nslookup www.baidu.com smartdns-rs
服务器:  UnKnown
Address:  11.20.3.171

非权威应答:                       <---------------------------rs版出现两行”非权威应答“
非权威应答:
名称:    www.a.shifen.com
Address:  110.242.68.4


C:\Users\Administrator>nslookup www.baidu.com smartdns
服务器:  openwrt.lan
Address:  11.20.3.104

非权威应答:                      <---------------------------c版正常
名称:    www.a.shifen.com
Addresses:  110.242.68.4
          110.242.68.3
Aliases:  www.baidu.com
1681048699:INFO:
1681048699:INFO:      _____                      _       _____  _   _  _____
1681048699:INFO:     / ____|                    | |     |  __ \| \ | |/ ____|
1681048699:INFO:    | (___  _ __ ___   __ _ _ __| |_    | |  | |  \| | (___
1681048699:INFO:     \___ \| '_ ` _ \ / _` | '__| __|   | |  | | . ` |\___ \
1681048699:INFO:     ____) | | | | | | (_| | |  | |_    | |__| | |\  |____) |
1681048699:INFO:    |_____/|_| |_| |_|\__,_|_|   \__|   |_____/|_| \_|_____/
1681048699:INFO:
1681048699:INFO: awaiting connections...
1681048699:INFO: server starting up
1681048700:DEBUG:smartdns::dns_server:146: query received: 1 name: 171.3.20.11.in-addr.arpa. type: PTR class: IN PTR client: [::ffff:11.20.3.12]:64544
1681048700:DEBUG:smartdns::dns_client:291: initialize name server [Group: Default]
1681048700:DEBUG:smartdns::dns_mw_ns:104: query name: 171.3.20.11.in-addr.arpa. type: PTR via [Group: default]
1681048700:DEBUG:smartdns::dns_server:146: query received: 2 name: www.baidu.com.lan. type: A class: IN A client: [::ffff:11.20.3.12]:64545
1681048700:DEBUG:smartdns::dns_mw_ns:104: query name: www.baidu.com.lan. type: A via [Group: default]
1681048700:DEBUG:smartdns::dns_server:146: query received: 3 name: www.baidu.com.lan. type: AAAA class: IN AAAA client: [::ffff:11.20.3.12]:64546
1681048700:DEBUG:smartdns::dns_mw_ns:104: query name: www.baidu.com.lan. type: AAAA via [Group: default]
1681048700:DEBUG:smartdns::dns_server:146: query received: 4 name: www.baidu.com. type: A class: IN A client: [::ffff:11.20.3.12]:64547
1681048700:DEBUG:smartdns::dns_client:291: initialize name server [Group: mainland]
1681048700:DEBUG:smartdns::dns_mw_ns:104: query name: www.baidu.com. type: A via [Group: mainland]
1681048701:DEBUG:smartdns::dns_mw_ns:291: The fastest ip of www.baidu.com. is 110.242.68.4
1681048701:DEBUG:smartdns::dns_mw_ns:291: The fastest ip of www.baidu.com. is 110.242.68.4
1681048701:DEBUG:smartdns::dns_mw_ns:291: The fastest ip of www.baidu.com. is 110.242.68.4
1681048701:DEBUG:smartdns::dns_mw_ns:291: The fastest ip of www.baidu.com. is 110.242.68.4
1681048701:DEBUG:smartdns::dns_server:146: query received: 5 name: www.baidu.com. type: AAAA class: IN AAAA client: [::ffff:11.20.3.12]:64548
1681048701:DEBUG:smartdns::dns_mw_ns:104: query name: www.baidu.com. type: AAAA via [Group: mainland]
1681048701:DEBUG:smartdns::dns_server:288: error resolving: Forward resolution error: no record found for Query { name: Name("www.baidu.com."), query_type: AAAA, query_class: IN }

CNAME记录总是不从cache返回

域名查询,querytime总是较长:

$ dig www.baidu.com

; <<>> DiG 9.10.6 <<>> www.baidu.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 18276
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;www.baidu.com.			IN	A

;; ANSWER SECTION:
www.baidu.com.		1110	IN	CNAME	www.a.shifen.com.
www.a.shifen.com.	600	IN	A	220.181.38.149
www.a.shifen.com.	600	IN	A	220.181.38.150

;; Query time: 23 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Fri Jul 14 10:31:48 CST 2023
;; MSG SIZE  rcvd: 101

smartdns日志:

2023-07-14 10:31:48.895:DEBUG:smartdns::dns_server:146: query received: 18276 name: www.baidu.com. type: A class: IN A client: 127.0.0.1:50713
2023-07-14 10:31:48.895:DEBUG:smartdns::dns_mw_ns:104: query name: www.baidu.com. type: A via [Group: domestic]

smartdns显示没走caching,而是从上游查询记录。

Looking for a good starting configuration

Hi,

I'm looking for a good starting configuration I can use to configure this dns server. I'd like to have 1.1.1.1, 8.8.8.8 and 9.9.9.9 as upstream servers

This is my configuration:

bind-tcp [::]:53
bind [::]:53
cache-persist yes
prefetch-domain yes
serve-expired yes
rr-ttl 32
rr-ttl-min 16
rr-ttl-max 64
log-level info
server 1.1.1.1

Unfortunately nothing happens when I point my iPhone to the ip address of the Pi4.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.