diff --git a/.changeset/purple-tips-care.md b/.changeset/purple-tips-care.md new file mode 100644 index 0000000..889ebe8 --- /dev/null +++ b/.changeset/purple-tips-care.md @@ -0,0 +1,5 @@ +--- +"@bunny.net/edgescript-sdk": minor +--- + +Add a toString method to TCP Listener diff --git a/libs/bunny-sdk/src/net/tcp.ts b/libs/bunny-sdk/src/net/tcp.ts index a6e6e18..7fed62a 100644 --- a/libs/bunny-sdk/src/net/tcp.ts +++ b/libs/bunny-sdk/src/net/tcp.ts @@ -20,6 +20,13 @@ export function unstable_local_addr(tcp: TcpListener): SocketAddr.SocketAddr { return tcp.addr; } +/** + * Format the associated [TcpListener] to a String + */ +export function toString(tcp: TcpListener): string { + return `${SocketAddr.ip(tcp.addr)}:${SocketAddr.port(tcp.addr)}`; +} + /** * Create a new [TcpListener]. */