Skip to main content

Aliyun DDNS (阿里云动态域名解析)

基于 Python 的阿里云动态域名解析工具,支持同时更新 IPv4 (A 记录) 和 IPv6 (AAAA 记录)。代码规范、符合现代 CLI 标准,支持系统级服务的直接部署。

功能特点

  • 🚀 全面支持: 提供对 IPv4 和 IPv6 动态解析的支持。
  • 🔄 高可用机制: 内置数十个外部 IP 获取服务接口,拥有完善的后备重试机制。
  • 🛡️ 详细日志: 包含规范的错误输出与执行日志。
  • 📦 开箱即用: 支持参数传递、加载独立的 JSON 配置文件,完全符合工业 CLI 工具标准。

安装说明

建议使用 uv 或者是 pipx 将其作为全局命令安装在系统中。在代码根目录下执行:

# 使用 uv (推荐)
uv tool install aliddns-updater

# 使用 pipx
pipx install aliddns-updater

更新到最新版本

当工具发布了新版本(例如 0.1.2)时,已经安装的用户无需重新配置,只需执行升级命令即可无缝更新:

# 如果你是通过 uv 安装的
uv tool upgrade aliddns-updater

# 如果你是通过 pipx 安装的
pipx upgrade aliddns-updater

安装完成后,系统便拥有了 aliddns-updater 这一全局命令。

配置与运行

工具会优先尝试从默认的配置文件读取参数,支持的配置文件路径为:~/.config/aliddns/config.json。 你可以随时创建该文件并填入凭据(无需写死在代码里!):

{
    "access_key_id": "你的AccessKey_ID",
    "access_secret": "你的AccessKey_Secret",
    "domain": "example.com",
    "ipv4_prefix": "ipv4",
    "ipv6_prefix": "ipv6"
}

配置字段详细说明:

  • access_key_id: 你的阿里云 AccessKey ID。
  • access_secret: 你的阿里云 AccessKey Secret。
  • domain: 需要管理解析的主域名 (例如 example.com)。
  • ipv4_prefix: IPv4 的子域名解析前缀 (例如 @ 代表主域名本身,或 ipv4)。
  • ipv6_prefix: IPv6 的子域名解析前缀 (例如 ipv6)。

命令行动态传参

除了配置文件,你也可以通过传参动态覆盖或者指定配置:

aliddns-updater --access-key-id LTAIxx --access-secret yyy --domain test.com --ipv4-prefix www --disable-ipv6

运行 aliddns-updater --help 可查看全部参数说明。

自动化运行 (Crontab 示例)

部署完毕后,你可以将它加入系统定时任务。 运行 crontab -e 并添加以下规则(每 10 分钟执行一次):

*/10 * * * * ~/.local/bin/aliddns-updater >> /tmp/aliddns-updater.log 2>&1

(注意:~/.local/bin/ 是 uv tool install 或 pipx 默认的系统沙盒安装目录。如果你是通过源码直接运行,请将上述路径替换为 cd /你的/项目/绝对路径 && uv run aliddns.py 或使用 which aliddns-updater 确认工具安装的具体绝对路径。)

Metadata

Release files for aliddns-updater 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aliddns-updater 0.1.3
File Size Uploaded Provenance Actions
aliddns_updater-0.1.3.tar.gz 12.9 kB Without provenance Details for aliddns_updater-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aliddns-updater 0.1.3
File Interpreter ABI Platform Actions
aliddns_updater-0.1.3-py3-none-any.whl Python 3 none any Details for aliddns_updater-0.1.3-py3-none-any.whl

Total release size: 29.8 kB

Release files / aliddns_updater-0.1.3.tar.gz

Download URL aliddns_updater-0.1.3.tar.gz
Size 12.9 kB
Tags Source
SHA-256 checksum
How to use checksums
11c2aa980dc4b2d4d03f47b09da15397660457aea5bad38efc2b1203cee5ca7a
BLAKE2b-256 checksum
How to use checksums
191f4f6c0ddae0571d908b17a8002ecd25390830dbb08e922f73756063b9aa32
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22.2","id":"zara","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / aliddns_updater-0.1.3-py3-none-any.whl

Download URL aliddns_updater-0.1.3-py3-none-any.whl
Size 16.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
940da1c4ccd7b32ba2b52ca45008350aac45cb33bddc3c901ed3d21803ccef93
BLAKE2b-256 checksum
How to use checksums
400255e786888ce6548341a9cd3ba2dcb2745dc3a8391a175b84237787ecfc2f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22.2","id":"zara","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for aliddns-updater 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page