[spec] ☿️ — a symbolic protocol

Petite Abeille <petite.abeille (a) gmail.com>

??://??

The multiaddr bellow is the default location of a Mercury (??) service:

/dns4/??.xyz/tcp/1961

A multiaddr describes how to connect to a ?? service ? for example, ? 
using DNS, ? resolve hostname ??.xyz, and ? connect over tcp ? to  port 1961.

To find a ?? multiaddr, query the host ?? DNS TXT record:

# dig +short TXT ??._tcp.??.xyz.
multiaddr=/dns/??.xyz/tcp/1958/tls/sni/??.xyz

By default, a ?? service runs over TCP, at port 1961 ?

A ??:// request is one-line ?4,096 bytes long at most, UTF-8 encoded? 
containing a fully qualified, normalized Internationalized Resource Identifier (IRI):

??://??.xyz/

An IRI is an UTF-8 version of an Uniform Resource Identifier (URI). 
An URI can be either an Uniform Resource Locator (URL), or Uniform Resource Name (URN).

An example of a ?? request, followed by a text/?? response:

# echo -e '??://??.xyz/\r\n' | nc 127.0.0.1 1961
? text/??;charset=utf-8;
Hello ??!

? ??://??.xyz/license CC0-1.0 
<end of connection> 

A successful ?? response is a one-line with status ??optionally followed 
by a content type, plus associated attributes, such as encoding:  

? text/??;charset=utf-8;

The content type is optional ? defaulting to text/??, UTF-8 encoded.

The content itself follow the  ? status line ? terminated by the service 
dropping the network connection.

There are 3 status codes:

? [20] SUCCESS ? one-line, with optional content type, plus attributes, 
4,096 bytes long at most, UTF-8 encoded
? text/??;charset=utf-8;

? [30] REDIRECT ? one-line IRI, fully qualified, and normalized, 4,096 
bytes long at most, UTF-8 encoded
? ??://??.xyz/

? [40] ERROR ? one-line, 4,096 bytes long at most, UTF-8 encoded, with 
optional description 
? ??

A text/?? consists of two line types: text, and link. 

A link is denoted as one-line, starting with the infinity symbol (?), 
followed by a space, followed by a fully qualified, and normalized, IRI ? 
optionally followed by a space and description:

? ??://??.xyz/license CC0-1.0

All other lines are regular text lines.

A ?? URL may anchor a text/?? line number:

??://??.xyz/license#42

A ?? service may optionally respond to the urn:??:capa directive ? listing 
additional capabilities, specific to the service, as text/?? links:

# echo -e 'urn:??:capa' | nc 127.0.0.1 1961
? text/??;charset=utf-8;
? urn:??:capa
? urn:??:capa:connection:keep-alive
? urn:??:capa:transfer-encoding:chunked
? urn:??:capa:turn
<end of connection> 

Capabilities are optional, and not part of the ?? protocol. They are 
documented separately.

# while true; do { echo -e '?\r\n? urn:??:capa'; } | nc -l 127.0.0.1 1958; done
# echo -e 'urn:??:capa\r\n' | nc 127.0.0.1 1958
?
? urn:??:capa
<end of connection> 

That's all folks.

?0?

? NASA's Project Mercury was the first human spaceflight program of the 
United States, running from 1958 through 1963. The first crewed flight 
took place in 1961. Therefore the port number.

Link to individual message.

---

Previous Thread: [spec] Certificate trust

Next Thread: [ANN] HtmGem, Php program to view Gemini through HTTP