Giter Site home page Giter Site logo

smartdns's Introduction

En | 中文简体

smartDNS (based on overture)


Build Status GoDoc Go Report Card

smartDNS is a smart DNS server/forwarder/dispatcher written in Go.

smartDNS based on overture.

Please note: If you are using the binary releases, please follow the instructions in the README file with corresponding git version tag. The README in master branch are subject to change and does not always reflect the correct instructions to your binary release version.

Features

  • Support DNSbunch(All DNS bundle)
  • Support DNSbundle(A group of similar DNS server) example: HK-DNS, CN-DNS, US-DNS
  • Support DNS cache update automatically(FastTable)
  • Dispatcher
    • Custom domain
    • Custom IP network

Dispatch process

Overture can force custom domain DNS queries to use selected DNS when applicable.

For custom IP network, overture will query the domain with primary DNS firstly. If the answer is empty or the IP is not matched then overture will finally use the alternative DNS servers.

Structure

Installation

You can download binary releases from the release.

Usages

Start with the default config file -> ./config.json

$ ./smartDNS

Or use your own config file:

$ ./smartDNS -c /path/to/config.json

Verbose mode:

$ ./smartDNS -v

Log to file:

$ ./smartDNS -l /path/to/overture.log

For other options, please see help:

$ ./smartDNS -h

Tips:

  • Root privilege is required if you are listening on port 53.

Configuration Syntax

Configuration file is "config.json" by default:

{
  "BindAddress": ":53",
  "DebugHTTPAddress": "127.0.0.1:5555",
  "DNSBunch": {
    "HK-DNS": [
      {
        "Name": "Microsoft-HK",
        "Address": "47.91.128.195:53",
        "Protocol": "udp",
        "SOCKS5Address": "",
        "Timeout": 6,
        "EDNSClientSubnet": {
          "Policy": "disable",
          "ExternalIP": "",
          "NoCookie": false
        }
      },
      {
        "Name": "Google-HK",
        "Address": "8.8.8.8:53",
        "Protocol": "udp",
        "SOCKS5Address": "",
        "Timeout": 3,
        "EDNSClientSubnet": {
          "Policy": "enable",
          "ExternalIP": "",
          "NoCookie": false
        }
      }
    ],
    "CN-DNS": [
      {
        "Name": "ChinaTelecom-CN",
        "Address": "114.114.114.114:53",
        "Protocol": "udp",
        "SOCKS5Address": "",
        "Timeout": 6,
        "EDNSClientSubnet": {
          "Policy": "disable",
          "ExternalIP": "",
          "NoCookie": false
        }
      },
      {
        "Name": "Baidu-CN",
        "Address": "180.76.76.76:53",
        "Protocol": "udp",
        "SOCKS5Address": "",
        "Timeout": 6,
        "EDNSClientSubnet": {
          "Policy": "disable",
          "ExternalIP": "",
          "NoCookie": false
        }
      }
    ]
  },
  "DNSFilter": {
    "HK-DNS": {
      "IPNetworkFile": "",
      "DomainFile": "configuration/hk.domain",
      "Matcher": "regex-list"
    },
    "CN-DNS": {
      "IPNetworkFile": "",
      "DomainFile": "configuration/cn.domain",
      "Matcher": "regex-list"
    }
  },
  "IPv6UseAlternativeDNS": false,
  "HostsFile": "./hosts",
  "MinimumTTL": 0,
  "DomainTTLFile": "./domain_ttl_sample",
  "CacheSize": 0,
  "RejectQType": [
    255
  ]
}```

Acknowledgements

License

This project is under the MIT license. See the LICENSE file for the full license text.

smartdns's People

Contributors

import-yuefeng avatar

Stargazers

Ronson avatar masx200 avatar  avatar  avatar Roman avatar  avatar Ali Jaberansari avatar  avatar  avatar 知命 avatar  avatar  avatar Clavin avatar  avatar  avatar Henry avatar  avatar  avatar  avatar Pan Lin avatar nonabyte avatar ted avatar Opxlis avatar Willian Z avatar Leo Stock avatar Code_PhantomPain avatar  avatar recall704 avatar  avatar Max Zhao avatar  avatar  avatar bonedaddy avatar  avatar LitingLin avatar  avatar Ivan Topor avatar Timothy avatar  avatar dh avatar  avatar Kiswono Prayogo avatar Xu avatar Park Sang kil avatar Kevin Tang avatar Soff avatar  avatar rampageX avatar jx-xysm avatar  avatar

Watchers

James Cloos avatar rampageX avatar  avatar  avatar

smartdns's Issues

Feature request: ability to set TTL for negative DNS replies (empty result or NXDOMAIN) in a separate way

Let's suppose I configured smartDNS for caching results for 7 days and a site I use to visit expires its domain registration.

/\ The negative response (NXDOMAIN) could be cached, if the site returns in 2 or 3 days, I will notice that the site is back only after 7 days as the cached negative answer would tell that.

An option to set a TTL for empty results or NXDOMAIN would be useful in this scenario.

smartDNS 无法感知 网络发生变化

smartDNS 无法感知 网络发生变化

当网络发生变化,例如从 WiFi 网络突然到无法访问网络的情况时,会因为无法请求远端DNS服务器,smartDNS 将不会停止请求远端,而将所有的DNS请求 均使用了默认 DNS,需新增处理网络变化的情况。

目标:当网络情况发生变化时,smartDNS 需要检测在新的网络情况下是否具有网络访问权限,如果没有,smartDNS 将进入轮询等待 查询网络情况,直到网络恢复,在此期间smartDNS 将不回应任何 DNS 请求。

icmp 错误

一直提示这个 Error listening for ICMP packets: socket: permission denied
但我是root

Feature request: Redis cache support

Overture already implemented: shawn1m/overture@5f9e7b1

But I think Overture is no more maintained.

If you accept my suggestion, a tip:

In go-redis packages there is an example file: https://github.com/go-redis/redis/blob/180f107add989d56d34734f1d429a83c6d4b9b91/example_test.go

The option for inserting the password and URL of Redis is: redis.ParseURL("redis://:qwerty@localhost:6379/1?dial_timeout=5s")

/\ Overture doesn't have an option for specifying a Redis password, you could implement this feature too.

smartDNS 数据持久化

目前 smartDNS 的 fastTable 所维护的 DNS Cache 无法持久化。

目标: 在下一个版本将会实现优雅处理 Ctrl+C 的退出信号,并且持久化 DNS Cache,在之后重载后正常运行。

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.