#rdap #whois #client #parser #testing #async #rdap-client

test_friendly_rdap_client

rdap_client crate 的分支,增加了额外的测试管道

1 个不稳定版本

0.1.0 2023年2月14日

#2358解析器实现

BSD-2-Clause

80KB
2K SLoC

test_friendly_rdap_client

为 Rust 提供异步和快速的 RDAP 客户端和解析器。

重要提示

这实际上是原始 rdap_client 的一个版本,增加了一些额外的功能,使其更容易在集成测试中连接 rdap_client

我最初尝试尽可能保持代码与上游代码接近,但不幸的是,crates.io 要么不喜欢 Cargo.toml 的设置方式,要么(更可能是)我在做一些愚蠢的事情。

用法

将其添加到您的 Cargo.toml

[dependencies]
test_friendly_rdap_client = "0.1"
tokio = "0.2"

然后您可以像这样使用它

use test_friendly_rdap_client::Client;

#[tokio::main]
async fn main() {
    let client = Client::new();
    let domain_to_check = "nic.cz";
    // Fetch boostrap from IANA.
    let bootstrap = client.fetch_bootstrap().await.unwrap();
    // Find what RDAP server to use for given domain.
    if let Some(servers) = bootstrap.dns.find(&domain_to_check) {
        let response = client.query_domain(&servers[0], domain_to_check).await.unwrap();
        println!("{}", response.handle);
    }
}

支持的标准

支持扩展

非标准响应

并非所有 RDAP 服务器都遵循 RFC 7483,因此解析器可能无法正确解析那些响应。如果发生这种情况,请随时为 rdap_client 无法解析的 URI 提交问题。

有用的文章

依赖项

~5–17MB
~263K SLoC