This commit is contained in:
ge
2026-04-04 00:47:35 +03:00
parent 4e43912583
commit 1cf6d878b5
19 changed files with 438 additions and 302 deletions
+17
View File
@@ -0,0 +1,17 @@
import netio
fn test_socket_addr_ipv4() {
addr := netio.SocketAddr.ipv4([u8(127), 0, 0, 1]!, 1080)
assert addr.str() == '127.0.0.1:1080'
}
fn test_socket_addr_ipv6() {
addr := netio.SocketAddr.ipv6([u8(0xfd), 0xf1, 0x72, 0xd1, 0x00, 0x33, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x02, 0x47]!, 25535, 0, 0)
assert addr.str() == '[fdf1:72d1:0033:0000:0000:0000:0000:0247]:25535'
}
fn test_socket_addr_unix() {
addr := netio.SocketAddr.unix('/run/app.sock')!
assert addr.str() == '/run/app.sock'
}