Function sc_network::config::parse_str_addr[][src]

pub fn parse_str_addr(addr_str: &str) -> Result<(PeerId, Multiaddr), ParseErr>

Parses a string address and splits it into Multiaddress and PeerId, if valid.

Example

let (peer_id, addr) = parse_str_addr(
	"/ip4/198.51.100.19/tcp/30333/p2p/QmSk5HQbn6LhUwDiNMseVUjuRYhEtYj4aUZ6WfWoGURpdV"
).unwrap();
assert_eq!(peer_id, "QmSk5HQbn6LhUwDiNMseVUjuRYhEtYj4aUZ6WfWoGURpdV".parse::<PeerId>().unwrap());
assert_eq!(addr, "/ip4/198.51.100.19/tcp/30333".parse::<Multiaddr>().unwrap());