blob: b2b3cd957db69ef5390e2d7c6a7412420b688daa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
from net import IpAddress, IpAddressFamily
type
Adapter* = object
## Represents a network interface device controller, such as a network card. An adapter can
## have multiple IP addresses.
ips*: seq[IP] ## List of ``IP`` instances in the order reported by the system.
name*: string ## Unique name that identifies the adapter in the system.
niceName*: string ## Human readable name of the adapter.
IP* = object
## Represents an IP address of an adapter.
case family*: IpAddressFamily
of IpAddressFamily.IPv6:
flowInfo*: uint32
scopeId*: uint32
of IpAddressFamily.IPv4:
discard
ip*: IpAddress ## IP address
networkPrefix*: int ## Number of bits of the IP that represent the network.
niceName*: string ## Human readable name for this IP.
when defined(windows) or defined(nimdoc):
include ifaddr/windows
elif defined(linux) or defined(maxosx):
include ifaddr/ifaddrposix
|