Binary packed network addresses
- Dominant language
- No language data
- Stars
- 328
- Forks
- 12
- PR merge metrics
- No merged PRs in 30d
Description
Consider url network addresses like:
```
tcp4://127.0.0.1:1234
udp4://10.20.30.40:5060
ws://1.2.3.4:5678
tcp6://[1fff:0:a88:85a3::ac1f]:8001
```
How best to binary pack them? Is there a standard for this? These should be storable in 7 bytes for IPv4 (not 20), and 19 bytes for ipv6 (not 35).
If not, perhaps:
```
<1 byte proto><4 or 16 byte ip><2 byte port>
```
Or, if we want encapsulation generality:
```
(<1 byte proto>)+
<1 byte ipv4 code><4 byte ipv4 addr><1 byte udp code><2 byte udp port>
<1 byte ipv6 code><16 byte ipv6 addr><1 byte tcp code><2 byte tcp port>
```
Which is nice, because it stacks well.
Back-translating with a better hierarchical approach (let's not get too crazy now...) gives us:
```
(//)+
/ip4//udp/
/ip6//tcp/
```
Rather than:
```
udp4://:
tcp6://[]:
```
Contributor guide
No contributing guide indexed for this repository
Research direction
No files, tests, or implementation entry points are identified. Start by comparing the example network addresses with the proposed fixed-width and hierarchical encodings, then check whether an existing standard is intended. Done would require an agreed binary representation and a defined back-translation format.
Written by the indexing model from the issue text.
Assessment
- Domain
- networking
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100