• Stars
    star
    547
  • Rank 81,254 (Top 2 %)
  • Language
    Rust
  • License
    GNU General Publi...
  • Created about 2 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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.

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(DNS over TLS), DoH(DNS over HTTPS) 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 -d
      • -d or --debug 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/#

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

# build
cargo build --release

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

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

Acknowledgments !!!

This software wouldn't have been possible without:

License

This software contains codes from https://github.com/bluejekyll/trust-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.

More Repositories

1

obsidian-enhancing-export

This is an enhancing export plugin base on Pandoc for Obsidian (https://obsidian.md/ ). It's allow you to export to formats like Markdown、Markdown (Hugo https://gohugo.io/ )、Html、docx、Latex etc.
TypeScript
324
star
2

obsidian-code-emitter

An obsidian plugin that allows code blocks executed interactively in sandbox like jupyter notebooks. Supported language rust、kotlin、python、Javascript、TypeScript etc.
TypeScript
243
star
3

zerotier-edge

A lightweight(less than 5 MB) ZeroTier Controller Web UI for a self-hosted ZeroTier network controller that deployed at your edge.
TypeScript
51
star
4

candle-ext

An extension library to Candle that provides PyTorch functions not currently available in Candle
Rust
35
star
5

ngx-property-grid

A small and simple property grid in angular to view/edit POJOs, excellent if you have a "settings" object you want to give the user to edit.
TypeScript
17
star
6

cargo-patch-crate

Fix broken crates instantly 🏃🏽‍♀️💨
Rust
16
star
7

QuickGraph

C#
14
star
8

enum-flags

EnumFlags is a csharp like enum flags implementation.
Rust
7
star
9

pyiter

PyIter is a Python package for iterative operations inspired by the Kotlin、CSharp(linq)、TypeSrcipt and Rust . Enables strong **typing** and type inference for iterative operations.
Python
5
star
10

v2ray-maid

Automatically select the fastest server as V2ray Outbounds and update the config file.
Rust
5
star
11

pyodide-dist

CDN: https://cdn.jsdelivr.net/gh/mokeyish/[email protected] Used by https://github.com/mokeyish/obsidian-code-emitter
JavaScript
3
star
12

Latex-Equation-Editor

A LaTex Equation Online Editor.
JavaScript
3
star
13

Gym.ts

Gym for typescript, A toolkit for developing and comparing reinforcement learning algorithms.
TypeScript
2
star
14

ext.ts

language extensions for typescript
TypeScript
1
star
15

cargo-patch-crate-example

Rust
1
star
16

ngx-template

A strengthened angular template
HTML
1
star
17

ndArray.ts

ndarray for typescript
TypeScript
1
star
18

QuickGraph.ts

TypeScript
1
star