Function sc_network::multiaddr::from_url

pub fn from_url(url: &str) -> Result<Multiaddr, FromUrlErr>
Expand description

Attempts to parse an URL into a multiaddress.

This function will return an error if some information in the URL cannot be retained in the generated multiaddress. This includes a username, password, path (if not supported by the multiaddr), and query string.

This function is only present if the url feature is enabled, and it is enabled by default.

The supported URL schemes are:

  • ws://
  • wss://
  • unix:/foo/bar


let addr = multiaddr::from_url("ws://").unwrap();
assert_eq!(addr, "/ip4/".parse().unwrap());