From 88318ed0997f79edc01f1fc25c61737ff55ce733 Mon Sep 17 00:00:00 2001 From: Anthony Griffon Date: Wed, 28 Aug 2024 09:52:18 +0200 Subject: [PATCH] feat: add toString method to Listener --- .changeset/purple-tips-care.md | 5 +++++ libs/bunny-sdk/src/net/tcp.ts | 7 +++++++ 2 files changed, 12 insertions(+) create mode 100644 .changeset/purple-tips-care.md 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]. */