Add `multiaddr` usage snippet for IP4 and UDS

(this commit msg was generated in some part by [`claude-code`][claude-code-gh])
[claude-code-gh]: https://github.com/anthropics/claude-code
subint_spawner_backend
Gud Boi 2026-03-25 18:56:56 -04:00
parent 8344537aa6
commit b4c975b48b
1 changed files with 11 additions and 0 deletions

View File

@ -0,0 +1,11 @@
from multiaddr import Multiaddr
# construct from a string
m1 = Multiaddr("/ip4/127.0.0.1/udp/1234")
m2 = Multiaddr("/unix/run/user/1000/sway-ipc.1000.1557.sock")
for key in m1.protocols():
key
uds_sock_path = Path(m2.values()[0])
uds_sock_path
uds_sock_path.is_file()
uds_sock_path.is_socket()