diff options
| author | Oskari Timperi <oskari.timperi@iki.fi> | 2020-02-19 22:14:08 +0200 |
|---|---|---|
| committer | Oskari Timperi <oskari.timperi@iki.fi> | 2020-02-19 22:14:08 +0200 |
| commit | b5665310e5c1e5d60893248ff146b1a60032dd87 (patch) | |
| tree | 57e7eb9aea927f08c57879b452e82c3e6da4af14 /src/ifaddr.nim | |
| download | ifaddr-nim-b5665310e5c1e5d60893248ff146b1a60032dd87.tar.gz ifaddr-nim-b5665310e5c1e5d60893248ff146b1a60032dd87.zip | |
Diffstat (limited to 'src/ifaddr.nim')
| -rw-r--r-- | src/ifaddr.nim | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/ifaddr.nim b/src/ifaddr.nim new file mode 100644 index 0000000..b2b3cd9 --- /dev/null +++ b/src/ifaddr.nim @@ -0,0 +1,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 |
