将以平面文件格式存储的DNS记录同步到您的DNS提供程序。

namesync的Python项目详细描述


将以平面文件格式存储的DNS记录同步到您的DNS提供程序。目前提供了CloudFlare支持。

安装PyPI Version

$ pip install namesync

快速指南

创建一个域名为的文件:

$ touch example.com

或者,如果你有现有的记录,你可以导出它们:

$ namesync --get example.com

每行输入一条记录,格式如下:

<record-type> <name> <value> <ttl:optional>

例如:

A       *       10.10.10.10         # You can even use comments
A       .       10.10.10.10         # . references the domain itself, example.com
A       test    10.10.10.11
A       example 10.10.10.12 86400
CNAME   mail    ghs.googlehosted.com
MX      .       aspmx.l.google.com

MX记录允许您指定优先级:

MX <name> <value> <priority:optional> <ttl:optional>

像这样:

MX      .       alt1.aspmx.l.google.com 20
MX      .       aspmx3.googlemail.com 30 86400

如果值包含空格,请将其引用:

TXT     .       "v=spf1 a include:amazonses.com include:_spf.google.com ~all"

然后同步您的记录:

$ namesync example.com

您将有机会在同步更改之前查看它们:

The following changes will be made:
ADD    A     *       10.10.10.10
ADD    A     example 10.10.10.12 86400
ADD    A     test    10.10.10.11
ADD    CNAME mail    ghs.googlehosted.com
ADD    MX    .       aspmx.l.google.com
UPDATE A     .       10.10.10.10
REMOVE A     old     10.10.10.13
Do you want to continue? [y/N]

用法

usage: namesync [-h] [-g] [-z ZONE] [-y] [-d DATA_DIR] [-t] RECORDS

positional arguments:
  RECORDS               file containing DNS records, one per line. The zone is
                        derived from the basename of this file. For example,
                        if "dns/example.com" is used then the zone is assumed
                        to be "example.com" unless the --zone option is used

optional arguments:
  -h, --help            show this help message and exit
  -g, --get             save existing DNS records to RECORDS
  -z ZONE, --zone ZONE  specify the zone instead of using the RECORDS filename
  -y, --yes             sync records without prompting before making changes
  -d DATA_DIR, --data-dir DATA_DIR
                        the directory where namesync.conf and other cache data
                        is stored. [default: ~/.namesync]
  -t, --dry-run         print actions and exit without making any changes

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
选项卡内的java 安卓工具栏   java接口VS API VS公共类   无法解析java。lang.ClassNotFoundException:在安卓 studio中找不到类“com.example.安卓.camera2basic.AutoFitTextureView”?   java等待线程正常完成   java在JTable中的prepareRenderer方法中编辑单元格数据是否可行?   java SessionNotCreatedException selenium webdriver   java Android Studio Gradle CreateProcess错误=2   java找不到适用于异常(int)的构造函数   javascript如何在不使用正则表达式的情况下检查输入是否为表情符号?   从JAVA运行ant时,JAVA_HOME变量不正确   long的java min值引发异常   java如何在这段代码中实现侦听器?   带有透明文本的java Android按钮   图像Java扫描仪问题(JFrame)   java模拟输入蒸汽似乎在Junit测试的第一次输入中就被吃掉了   压缩Java Deflater,现在和将来的结果相同(确定性)   java JTable getModel()。setValueAt从数组中删除第一个元素   java我有不同于编译器和计算器的价值   使用C#客户端调用基本身份验证java webservice   java相同类型的多个@Embedded字段在持久化后始终为空