pub struct DnsInfo {
pub a_records: Vec<String>,
pub cname: Option<String>,
pub ttl: u32,
}Expand description
DNS information about the server.
Contains resolved A records, optional CNAME, and TTL information. This information is retrieved during DNS resolution and cached for 5 minutes.
§Example
use rust_mc_status::{McClient, ServerEdition};
let client = McClient::new();
let status = client.ping("mc.hypixel.net", ServerEdition::Java).await?;
if let Some(dns) = status.dns {
println!("A records: {:?}", dns.a_records);
if let Some(cname) = dns.cname {
println!("CNAME: {}", cname);
}
println!("TTL: {} seconds", dns.ttl);
}Fields§
§a_records: Vec<String>A record IP addresses.
This is a list of IPv4 and IPv6 addresses that the hostname resolves to. Typically contains one or more IP addresses.
Example: vec!["172.65.197.160".to_string()]
cname: Option<String>Optional CNAME record.
If the hostname is a CNAME (canonical name), this field contains the canonical hostname. Most servers don’t use CNAME records.
Example: Some("canonical.example.com".to_string())
ttl: u32Time-to-live in seconds.
This is the DNS cache TTL used by the library. DNS records are cached for this duration to improve performance.
Default: 300 (5 minutes)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for DnsInfo
impl<'de> Deserialize<'de> for DnsInfo
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for DnsInfo
impl RefUnwindSafe for DnsInfo
impl Send for DnsInfo
impl Sync for DnsInfo
impl Unpin for DnsInfo
impl UnwindSafe for DnsInfo
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more