provide netmask in NetworkInterface
This commit is contained in:
parent
02a96ac412
commit
44cc3955b5
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue