Electroneum
Namespaces | Classes | Enumerations | Functions
net Namespace Reference

Namespaces

 anonymous_namespace{i2p_address.cpp}
 
 anonymous_namespace{tor_address.cpp}
 
 socks
 
 zmq
 

Classes

class  i2p_address
 b32 i2p address; internal format not condensed/decoded. More...
 
class  tor_address
 Tor onion address; internal format not condensed/decoded. More...
 

Enumerations

enum class  error : int {
  expected_tld = 1 , invalid_host , invalid_i2p_address , invalid_port ,
  invalid_tor_address , unsupported_address
}
 General net errors. More...
 

Functions

std::error_category const & error_category () noexcept
 
std::error_code make_error_code (error value) noexcept
 
bool operator== (const i2p_address &lhs, const i2p_address &rhs) noexcept
 
bool operator!= (const i2p_address &lhs, const i2p_address &rhs) noexcept
 
bool operator< (const i2p_address &lhs, const i2p_address &rhs) noexcept
 
expect< epee::net_utils::network_address > get_network_address (const boost::string_ref address, const std::uint16_t default_port)
 
bool operator== (const tor_address &lhs, const tor_address &rhs) noexcept
 
bool operator!= (const tor_address &lhs, const tor_address &rhs) noexcept
 
bool operator< (const tor_address &lhs, const tor_address &rhs) noexcept
 

Enumeration Type Documentation

◆ error

enum net::error : int
strong

General net errors.

Enumerator
expected_tld 

Expected a tld.

invalid_host 

Hostname is not valid.

invalid_i2p_address 
invalid_port 

Outside of 0-65535 range.

invalid_tor_address 

Invalid base32 or length.

unsupported_address 

Type not supported by get_network_address

Function Documentation

◆ error_category()

std::error_category const & net::error_category ( )
noexcept
Returns
std::error_category for net namespace.

◆ get_network_address()

expect< epee::net_utils::network_address > net::get_network_address ( boost::string_ref  address,
std::uint16_t  default_port 
)

Identifies onion, i2p and IPv4 addresses and returns them as a generic network_address. If the type is unsupported, it might be a hostname, and error() == net::error::kUnsupportedAddress is returned.

Parameters
addressAn onion address, i2p address, ipv4 address or hostname. Hostname will return an error.
default_portIf address does not specify a port, this value will be used.
Returns
A tor or IPv4 address, else error.

◆ make_error_code()

std::error_code net::make_error_code ( error  value)
inlinenoexcept
Returns
net::error as a std::error_code value.

◆ operator!=() [1/2]

bool net::operator!= ( const i2p_address lhs,
const i2p_address rhs 
)
inlinenoexcept

◆ operator!=() [2/2]

bool net::operator!= ( const tor_address lhs,
const tor_address rhs 
)
inlinenoexcept

◆ operator<() [1/2]

bool net::operator< ( const i2p_address lhs,
const i2p_address rhs 
)
inlinenoexcept

◆ operator<() [2/2]

bool net::operator< ( const tor_address lhs,
const tor_address rhs 
)
inlinenoexcept

◆ operator==() [1/2]

bool net::operator== ( const i2p_address lhs,
const i2p_address rhs 
)
inlinenoexcept

◆ operator==() [2/2]

bool net::operator== ( const tor_address lhs,
const tor_address rhs 
)
inlinenoexcept