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-codesubint_spawner_backend
parent
8344537aa6
commit
b4c975b48b
|
|
@ -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()
|
||||
Loading…
Reference in New Issue