From 44cc3955b50cac29ba44ed27fc5f06f960246641 Mon Sep 17 00:00:00 2001 From: Christian Ulrich Date: Tue, 21 Jul 2020 23:53:28 +0200 Subject: [PATCH] provide netmask in NetworkInterface --- network_interface.nim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/network_interface.nim b/network_interface.nim index 3000b3e..8fd38b1 100644 --- a/network_interface.nim +++ b/network_interface.nim @@ -4,6 +4,7 @@ from posix import SockAddr, Sockaddr_in, inet_ntoa, AF_INET type NetworkInterface* = object ipAddress*: string + netMask*: string name*: string index*: cint flags*: cuint @@ -34,6 +35,7 @@ proc fromIpAddress*(address: string): NetworkInterface = it.ifa_addr.sa_family.cint == AF_INET and it.ifa_addr.getAddrString() == address: result.ipAddress = address + result.netMask = it.ifa_netmask.getAddrString() result.name = $it.ifa_name result.index = if_nametoindex(result.name).cint result.flags = it.ifa_flags