Skip to content

Commit b690498

Browse files
Specify /unix. Add /unix-abstract. Add /stream, /seqpacket, /dgram
Based on #174
1 parent 8f9c2ee commit b690498

File tree

3 files changed

+35
-5
lines changed

3 files changed

+35
-5
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ TODO: most of these are way underspecified
152152
- /ipcidr
153153
- /dns4, /dns6
154154
- [/dnsaddr](protocols/DNSADDR.md)
155+
- [/unix](protocols/unix.md)
156+
- [/unix-abstract](protocols/unix.md)
155157
- /tcp
156158
- /udp
157159
- /utp

protocols.csv

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ code, size, name, comment
22
4, 32, ip4,
33
6, 16, tcp,
44
273, 16, udp,
5+
403, 0, stream,
6+
404, 0, seqpacket,
7+
405, 0, dgram,
58
33, 16, dccp,
69
41, 128, ip6,
710
42, V, ip6zone, rfc4007 IPv6 zone
@@ -13,7 +16,8 @@ code, size, name, comment
1316
132, 16, sctp,
1417
301, 0, udt,
1518
302, 0, utp,
16-
400, V, unix, Percent-encoded path to a Unix domain socket
19+
400, V, unix, Percent-encoded path to a unix-domain socket
20+
401, V, unix-abstract, Percent-encoded address of a linux abstract unix-domain socket
1721
421, V, p2p, preferred over /ipfs
1822
421, V, ipfs, backwards compatibility; equivalent to /p2p
1923
444, 96, onion,

protocols/unix.md

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# `unix`
22

3-
This protocol encodes a Unix domain socket path to a resource. In the string
3+
This protocol encodes a UNIX-domain socket path to a resource. In the string
44
representation, the path is encoded in a way consistent with a single URI Path
55
segment per [RFC 3986 Section 3.3](https://datatracker.ietf.org/doc/html/rfc3986#autoid-23).
66

@@ -12,7 +12,7 @@ representation to avoid ambiguities over which characters were escaped.
1212

1313
## Examples
1414

15-
The following is a table of examples converting some common Unix paths to their
15+
The following is a table of examples converting some common UNIX paths to their
1616
Multiaddr string form.
1717

1818
| Unix Path | Multiaddr string form |
@@ -33,5 +33,29 @@ Multiaddr string form.
3333
appear anywhere, for example in the case where we route through some sort of
3434
proxy server or SSH tunnel.
3535

36-
The absence of a `/` character at the start of the decoded address indicates a
37-
relative path, otherwise the path is absolute.
36+
# `unix-abstract`
37+
38+
This protocol encodes a Linux UNIX-domain abstract socket address,
39+
which are distinguished by their first byte being 0.
40+
It is encoded the same way as `unix`;
41+
the marker byte is not part of the path.
42+
43+
## Examples
44+
45+
In the following table, the address column follows the userspace convention
46+
of 0 bytes in the address being rendered as an `@` for abstract addresses
47+
for display only.
48+
49+
| Rendered Address | multiaddr string form |
50+
| -------------------------------------------- | ------------------------------------------------------------------ |
51+
| @f87a1c847a4ecaf3/bus/systemd/bus-api-system | `/unix-abstract/f87a1c847a4ecaf3%2Fbus%2Fsystemd%2Fbus-api-system` |
52+
| @/run/fsid.sock@@@@@@@@@@@@@@@@@@@@@@@@@@... | `/unix-abstract/%2Frun%2Ffsid.sock%00%00%00%00%00%00%00%00%00...` |
53+
54+
# `stream`, `seqpacket`, `dgram`
55+
56+
These correspond to the *type* of UNIX-domain socket:
57+
`SOCK_STREAM`, `SOCK_SEQPACKET`, `SOCK_DGRAM`.
58+
59+
Previous versions of this specification did not contain these types;
60+
for compatibility, their absence should not indicate an error,
61+
if a default makes sense when decoding.

0 commit comments

Comments
 (0)