Add `uds` to `._multiaddr`, tweak typing

CONT_log_sys_testing
Gud Boi 2026-02-04 09:10:21 -05:00
parent bd4743e176
commit 8548eee0fd
1 changed files with 13 additions and 5 deletions

View File

@ -38,6 +38,7 @@ prots: bidict[int, str] = {
'tcp': 4,
'udp': 4,
'uds': 4,
# TODO: support the next-gen shite Bo
# 'quic': 4,
@ -51,6 +52,7 @@ prot_params: dict[str, tuple[str]] = {
'tcp': ('port',),
'udp': ('port',),
'uds': ('path',),
# 'quic': ('port',),
# 'ssh': ('port',),
@ -98,7 +100,10 @@ def iter_prot_layers(
def parse_maddr(
multiaddr: str,
) -> dict[str, str | int | dict]:
) -> dict[
str,
str|int|dict,
]:
'''
Parse a libp2p style "multiaddress" into its distinct protocol
segments where each segment is of the form:
@ -129,7 +134,10 @@ def parse_maddr(
) in iter_prot_layers(multiaddr):
layer: int = prots[prot_key] # OSI layer used for sorting
ep: dict[str, int | str] = {'layer': layer}
ep: dict[str, int|str] = {
'layer': layer,
'proto': prot_key,
}
layers[prot_key] = ep
# TODO; validation and resolving of names: