September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
16
Task/DNS-query/Rust/dns-query.rust
Normal file
16
Task/DNS-query/Rust/dns-query.rust
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
use std::net::ToSocketAddrs;
|
||||
|
||||
fn main() {
|
||||
let host = "www.kame.net";
|
||||
// Ideally, we would want to use std::net::lookup_host to resolve the host ips,
|
||||
// but at time of writing this, it is still unstable. Fortunately, we can
|
||||
// still resolve using the ToSocketAddrs trait, but we need to add a port,
|
||||
// so we use the dummy port 0.
|
||||
let host_port = (host, 0);
|
||||
let ip_iter = host_port.to_socket_addrs().unwrap();
|
||||
|
||||
|
||||
for ip_port in ip_iter {
|
||||
println!("{}", ip_port.ip());
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue