pub struct WhoIs { /* private fields */ }Expand description
The WhoIs structure stores the list of WHOIS servers in-memory.
Implementations§
Source§impl WhoIs
impl WhoIs
Sourcepub fn from_host<T: AsRef<str>>(host: T) -> Result<WhoIs, WhoIsError>
pub fn from_host<T: AsRef<str>>(host: T) -> Result<WhoIs, WhoIsError>
Create a WhoIs instance which doesn’t have a WHOIS server list. You should provide the host that is used for query ip. You may want to use the host "whois.arin.net".
Sourcepub fn from_path<P: AsRef<Path>>(path: P) -> Result<WhoIs, WhoIsError>
pub fn from_path<P: AsRef<Path>>(path: P) -> Result<WhoIs, WhoIsError>
Read the list of WHOIS servers (JSON data) from a file to create a WhoIs instance.
Sourcepub async fn from_path_async<P: AsRef<Path>>(
path: P,
) -> Result<WhoIs, WhoIsError>
pub async fn from_path_async<P: AsRef<Path>>( path: P, ) -> Result<WhoIs, WhoIsError>
Read the list of WHOIS servers (JSON data) from a file to create a WhoIs instance. For serde_json doesn’t support async functions, consider just using the from_path function.
Sourcepub fn from_string<S: AsRef<str>>(string: S) -> Result<WhoIs, WhoIsError>
pub fn from_string<S: AsRef<str>>(string: S) -> Result<WhoIs, WhoIsError>
Read the list of WHOIS servers (JSON data) from a string to create a WhoIs instance.
Source§impl WhoIs
impl WhoIs
Sourcepub fn can_find_server_for_tld<T: AsRef<str>, D: AsRef<str>>(
&mut self,
tld: T,
dns_server: D,
) -> Result<bool, WhoIsError>
pub fn can_find_server_for_tld<T: AsRef<str>, D: AsRef<str>>( &mut self, tld: T, dns_server: D, ) -> Result<bool, WhoIsError>
Try to find a WHOIS server for a TLD by querying the _nicname._tcp.<tld> SRV records through the given DNS server, caching any server that is found for later lookups. Returns whether a server is available for the TLD (already known or newly discovered).
Sourcepub fn get_server_by_tld(&self, tld: &str) -> Option<&WhoIsServerValue>
pub fn get_server_by_tld(&self, tld: &str) -> Option<&WhoIsServerValue>
Try to find a WHOIS server for a TLD from the in-memory server list, walking up the labels of the given TLD/domain (e.g. a.b.example -> b.example -> example -> "") until a match is found. Returns the matched server, if any.
Sourcepub fn lookup_raw(
&self,
options: WhoIsLookupOptions,
) -> Result<Vec<u8>, WhoIsError>
pub fn lookup_raw( &self, options: WhoIsLookupOptions, ) -> Result<Vec<u8>, WhoIsError>
Lookup a domain or an IP, returning the raw bytes of the final WHOIS response without decoding.
Sourcepub fn lookup(&self, options: WhoIsLookupOptions) -> Result<String, WhoIsError>
pub fn lookup(&self, options: WhoIsLookupOptions) -> Result<String, WhoIsError>
Lookup a domain or an IP.
Source§impl WhoIs
impl WhoIs
Sourcepub async fn lookup_raw_async(
&self,
options: WhoIsLookupOptions,
) -> Result<Vec<u8>, WhoIsError>
pub async fn lookup_raw_async( &self, options: WhoIsLookupOptions, ) -> Result<Vec<u8>, WhoIsError>
Lookup a domain or an IP, returning the raw bytes of the final WHOIS response without decoding.
Sourcepub async fn lookup_async(
&self,
options: WhoIsLookupOptions,
) -> Result<String, WhoIsError>
pub async fn lookup_async( &self, options: WhoIsLookupOptions, ) -> Result<String, WhoIsError>
Lookup a domain or an IP.