Multiaddr grammar

In simple case Multiaddr looks similar to /ip4/127.0.0.1/tcp/80. It is easily parseable - /{key}/{value/{key}/{value}.

But I found this example:

/ip4/1.2.3.4/tcp/443/tls/sni/example.com/http/example.com/index.html

It makes Mulriaddr needing some sort of formal grammar specification (BNF?). Is there one? If no, do you think Multiaddr should support this?

Yes, we definitely should, but a BNF is not going to be enough, as the kinds of addresses the http protocol requires include slashes in their string representation, which creates ambiguity when parsing multiaddrs. Some background here:

2 Likes