Function reth_cli_util::parsers::parse_socket_address

source ยท
pub fn parse_socket_address(
    value: &str,
) -> Result<SocketAddr, SocketAddressParsingError>
Expand description

Parse a SocketAddr from a str.

The following formats are checked:

  • If the value can be parsed as a u16 or starts with : it is considered a port, and the hostname is set to localhost.
  • If the value contains : it is assumed to be the format <host>:<port>
  • Otherwise it is assumed to be a hostname

An error is returned if the value is empty.