Add `uds` to `._multiaddr`, tweak typing
parent
d704f99223
commit
fcc253f6ce
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in New Issue