Back to Site
Loading...
Searching...
No Matches
librats::network_utils Namespace Reference

Functions

std::string resolve_hostname (const std::string &hostname)
 Resolve hostname to IPv4 address.
 
std::string resolve_hostname_v6 (const std::string &hostname)
 Resolve hostname to IPv6 address.
 
bool is_valid_ipv4 (const std::string &ip_str)
 Check if a string is a valid IPv4 address.
 
bool is_valid_ipv6 (const std::string &ip_str)
 Check if a string is a valid IPv6 address.
 
bool is_hostname (const std::string &str)
 Check if a string is a hostname (not an IP address)
 
std::vector< std::string > get_local_interface_addresses ()
 Get all local network interface addresses (IPv4 and IPv6)
 

Function Documentation

◆ get_local_interface_addresses()

std::vector< std::string > librats::network_utils::get_local_interface_addresses ( )

Get all local network interface addresses (IPv4 and IPv6)

Returns
Vector of local IP addresses from all network interfaces

◆ is_hostname()

bool librats::network_utils::is_hostname ( const std::string &  str)

Check if a string is a hostname (not an IP address)

Parameters
strThe string to check
Returns
true if it's a hostname, false if it's an IP address

◆ is_valid_ipv4()

bool librats::network_utils::is_valid_ipv4 ( const std::string &  ip_str)

Check if a string is a valid IPv4 address.

Parameters
ip_strThe string to validate
Returns
true if valid IPv4 address, false otherwise

◆ is_valid_ipv6()

bool librats::network_utils::is_valid_ipv6 ( const std::string &  ip_str)

Check if a string is a valid IPv6 address.

Parameters
ip_strThe string to validate
Returns
true if valid IPv6 address, false otherwise

◆ resolve_hostname()

std::string librats::network_utils::resolve_hostname ( const std::string &  hostname)

Resolve hostname to IPv4 address.

Parameters
hostnameThe hostname to resolve (can be hostname or IP address)
Returns
IP address string, or empty string on error

◆ resolve_hostname_v6()

std::string librats::network_utils::resolve_hostname_v6 ( const std::string &  hostname)

Resolve hostname to IPv6 address.

Parameters
hostnameThe hostname to resolve (can be hostname or IPv6 address)
Returns
IPv6 address string, or empty string on error