icloud 0.1.0

基于当前公网IP位置,返回就近的 Apple iCloud 存储服务器地址(域名与解析IP)。
Documentation
  • Coverage
  • 11.11%
    2 out of 18 items documented0 out of 5 items with examples
  • Size
  • Source code size: 49.06 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 768.09 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 42s Average build duration of successful builds.
  • all releases: 42s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • luzhihaoTestingLab

icloud

基于当前公网 IP 所在地,返回就近的 Apple iCloud 存储服务器地址(域名与解析 IP)。

  • 返回内容包含:address(如 https://content.icloud.com)、resolved_ip(DNS 解析得到的就近 CDN IP)、ipcountry_coderegioncitynote(说明/免责声明)。
  • 结果为近似参考:苹果的资源调度与 CDN 解析是动态的,实际数据托管与访问路径可能不同。

安装

cargo add icloud

或在 Cargo.toml 添加:

[dependencies]
icloud = "0.1"

使用示例

use icloud::{storage_address, storage_address_offline};

fn main() {
    let addr = storage_address();
    println!(
        "iCloud地址: {address}, 解析IP: {resolved:?}, IP: {ip:?}, 国家: {cc:?}, 省份: {region:?}, 城市: {city:?}\n备注: {note:?}",
        address = addr.address,
        resolved = addr.resolved_ip,
        ip = addr.ip,
        cc = addr.country_code,
        region = addr.region,
        city = addr.city,
        note = addr.note,
    );

    // 离线回退
    let offline = storage_address_offline();
    println!("离线回退地址: {}", offline.address);
}

工作原理

  • 调用 ipinfo.io 获取当前公网 IP 的地理信息(城市/区域/国家)。
  • 选取 iCloud 内容域名 content.icloud.com 作为存储服务入口(常用于照片/文件内容分发)。
  • 通过系统 DNS 解析该域名,取首个解析 IP 作为“就近节点”的近似结果。

限制与免责声明

  • 苹果的 iCloud 数据调度与 CDN 解析是动态的,返回的解析 IP 仅为近似参考。
  • 中国大陆(CN)用户的 iCloud 数据由云上贵州(GCBD)托管;域名解析与实际存储位置由苹果与 CDN 动态决定。
  • 如果无法联网或解析失败,可使用 storage_address_offline() 返回固定入口域名。

许可证

MIT © 2025 useful-cargo-packages