rust-multiaddr
rust-multiaddr copied to clipboard
Should we add an empty MA to the failure test?
Seems that the spec doesn't allow an empty MA.
Human-readable multiaddr: (/<protoName string>/<value string>)+
Example: /ip4/127.0.0.1/udp/1234
Machine-readable multiaddr: (<protoCode uvarint><value []byte>)+
Same example: 0x4 0x7f 0x0 0x0 0x1 0x91 0x2 0x4 0xd2
Values are usually length-prefixed with a uvarint
Where in the provided snippet do you read that an empty address is not allowed?
Doesn't "+" mean 1 or more?
Also see https://github.com/multiformats/go-multiaddr/issues/104
Doesn't "+" mean 1 or more?
Ah yes, I didn't realize that was actually a regular expression.
We could deprecate the Multiaddr::empty function and replace it with a Multiaddr::new(Protocol) one.