mirror of
https://github.com/LowderPlay/cheburcheck.git
synced 2026-10-12 09:08:18 +03:00
* feat!: svelte rewrite * feat: remove mock * fix: formatting and optimisation * feat: db optimizations * feat: dockerfile and version * ci: change dockerfile syntax * fix: remove domain trie
22 lines
485 B
Rust
22 lines
485 B
Rust
use reqwest::dns::{Addrs, Name, Resolve, Resolving};
|
|
use std::net::{IpAddr, SocketAddr};
|
|
|
|
pub struct Resolver {
|
|
ip: SocketAddr,
|
|
}
|
|
|
|
impl Resolver {
|
|
pub fn new(ip: IpAddr) -> Resolver {
|
|
Resolver {
|
|
ip: SocketAddr::from(SocketAddr::new(ip, 0)),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl Resolve for Resolver {
|
|
fn resolve(&self, _: Name) -> Resolving {
|
|
let ip = self.ip.clone();
|
|
Box::pin(async move { Ok(Addrs::from(Box::new(vec![ip].into_iter()))) })
|
|
}
|
|
}
|