Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何获取请求中的 Client Subnet? #99

Open
killbus opened this issue Mar 17, 2024 · 1 comment
Open

如何获取请求中的 Client Subnet? #99

killbus opened this issue Mar 17, 2024 · 1 comment

Comments

@killbus
Copy link

killbus commented Mar 17, 2024

version: build-20230216_1021

不懂 rust,一边读源码一边问 chatbots,没头绪了。

以下是一些不成熟的尝试:

    let client_subnet = ClientSubnet::new(u8(15), u8(0), IpAddr::from_str("23.62.93.233")?);
    println(client_subnet.addr.to_str());
    ////query.push_opt(client_subnet.to_opt_data())?;
    //if let AllOptData::ClientSubnet(subnet) = client_subnet.to_opt_data() {
    //  dbg(subnet);
    //}
    let opt_records = query.options?;
    for opt in opt_records.into_iter() {
      dbg(opt);
      //if let AllOptData::ClientSubnet(subnet) = opt {
      //  dbg(subnet);
      //}
    }
@LEXUGE
Copy link
Collaborator

LEXUGE commented Mar 17, 2024

我最近几个月很忙,可能暂时不能给你完整的代码,我抽空会回复你。

你可以看一下 domain 这个 rust 库的相关 type (AllOptData 等) 的方法,因为在这里所有的方法几乎都是还原了这个库的。你也可以看看 runescript 的文档,我不太确定能不能做 if let 这样的模式匹配

我实现的相关的代码在 https://github.com/compassd/dcompass/tree/main/droute/src/router/script/rune_scripting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants