Giter Site home page Giter Site logo

dnswitcher's Introduction

DNSwitcher

监控同一域名下多台主机的网络情况,并调用 dnspod-api 自动切换 DNS 解析到网络较好的主机

Install

git clone https://github.com/jinxingxing/DNSwitcher
cd DNSwitcher/
git submodule init && git submodule update
cd dnspod-python && python setup.py install && cd ..
python setup.py install

Config

示例配置见:dnswitcher-example.json

{
  "email": "[email protected]",  # dnspod 用户名
  "password": "your_password",        # dnspod 密码
  "debug": true,  # 开启调试模式 (打印调试日志)
  "sleep": 30,    # 监控的间隔时间(分钟)
  "history": "dnswitcher-history.json",  # 记录历史数据的文件名
  "domains": [
    {
      "domain": "example.com",  # 监控的域名
      "hosts": [  # 域名对应的主机列表
        "s1.example.com",   # 配置的是域名,使用 CNAME 记录解析
        "127.0.0.1"         # 配置的是IP,使用 A 记录解析
      ]
    },
    {
      "domain": "example2.com", # 另一个监控的域名
      "hosts": [
        "s1.example2.com",
        "127.0.0.1"
      ]
    }
  ]
}

Usage

  1. cp dnswitcher-example.json /etc/dnswitcher.json
  2. 编辑 /etc/dnswitcher.json 配置好 emailpassworddomains
  3. 启动:dnswitcher /etc/dnswitcher.json

TODO

dnswitcher's People

Contributors

jxinging avatar

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.