@@ -2203,6 +2203,132 @@ const (
2203
2203
IfOperStatusLowerLayerDown = 7
2204
2204
)
2205
2205
2206
+ const (
2207
+ IF_MAX_PHYS_ADDRESS_LENGTH = 32
2208
+ IF_MAX_STRING_SIZE = 256
2209
+ )
2210
+
2211
+ // MIB_IF_ENTRY_LEVEL enumeration from netioapi.h or
2212
+ // https://learn.microsoft.com/en-us/windows/win32/api/netioapi/nf-netioapi-getifentry2ex.
2213
+ const (
2214
+ MibIfEntryNormal = 0
2215
+ MibIfEntryNormalWithoutStatistics = 2
2216
+ )
2217
+
2218
+ // MIB_NOTIFICATION_TYPE enumeration from netioapi.h or
2219
+ // https://learn.microsoft.com/en-us/windows/win32/api/netioapi/ne-netioapi-mib_notification_type.
2220
+ const (
2221
+ MibParameterNotification = 0
2222
+ MibAddInstance = 1
2223
+ MibDeleteInstance = 2
2224
+ MibInitialNotification = 3
2225
+ )
2226
+
2227
+ // MibIfRow2 stores information about a particular interface. See
2228
+ // https://learn.microsoft.com/en-us/windows/win32/api/netioapi/ns-netioapi-mib_if_row2.
2229
+ type MibIfRow2 struct {
2230
+ InterfaceLuid uint64
2231
+ InterfaceIndex uint32
2232
+ InterfaceGuid GUID
2233
+ Alias [IF_MAX_STRING_SIZE + 1 ]uint16
2234
+ Description [IF_MAX_STRING_SIZE + 1 ]uint16
2235
+ PhysicalAddressLength uint32
2236
+ PhysicalAddress [IF_MAX_PHYS_ADDRESS_LENGTH ]uint8
2237
+ PermanentPhysicalAddress [IF_MAX_PHYS_ADDRESS_LENGTH ]uint8
2238
+ Mtu uint32
2239
+ Type uint32
2240
+ TunnelType uint32
2241
+ MediaType uint32
2242
+ PhysicalMediumType uint32
2243
+ AccessType uint32
2244
+ DirectionType uint32
2245
+ InterfaceAndOperStatusFlags uint8
2246
+ OperStatus uint32
2247
+ AdminStatus uint32
2248
+ MediaConnectState uint32
2249
+ NetworkGuid GUID
2250
+ ConnectionType uint32
2251
+ TransmitLinkSpeed uint64
2252
+ ReceiveLinkSpeed uint64
2253
+ InOctets uint64
2254
+ InUcastPkts uint64
2255
+ InNUcastPkts uint64
2256
+ InDiscards uint64
2257
+ InErrors uint64
2258
+ InUnknownProtos uint64
2259
+ InUcastOctets uint64
2260
+ InMulticastOctets uint64
2261
+ InBroadcastOctets uint64
2262
+ OutOctets uint64
2263
+ OutUcastPkts uint64
2264
+ OutNUcastPkts uint64
2265
+ OutDiscards uint64
2266
+ OutErrors uint64
2267
+ OutUcastOctets uint64
2268
+ OutMulticastOctets uint64
2269
+ OutBroadcastOctets uint64
2270
+ OutQLen uint64
2271
+ }
2272
+
2273
+ // MIB_UNICASTIPADDRESS_ROW stores information about a unicast IP address. See
2274
+ // https://learn.microsoft.com/en-us/windows/win32/api/netioapi/ns-netioapi-mib_unicastipaddress_row.
2275
+ type MibUnicastIpAddressRow struct {
2276
+ Address RawSockaddrInet6 // SOCKADDR_INET union
2277
+ InterfaceLuid uint64
2278
+ InterfaceIndex uint32
2279
+ PrefixOrigin uint32
2280
+ SuffixOrigin uint32
2281
+ ValidLifetime uint32
2282
+ PreferredLifetime uint32
2283
+ OnLinkPrefixLength uint8
2284
+ SkipAsSource uint8
2285
+ DadState uint32
2286
+ ScopeId uint32
2287
+ CreationTimeStamp Filetime
2288
+ }
2289
+
2290
+ const ScopeLevelCount = 16
2291
+
2292
+ // MIB_IPINTERFACE_ROW stores interface management information for a particular IP address family on a network interface.
2293
+ // See https://learn.microsoft.com/en-us/windows/win32/api/netioapi/ns-netioapi-mib_ipinterface_row.
2294
+ type MibIpInterfaceRow struct {
2295
+ Family uint16
2296
+ InterfaceLuid uint64
2297
+ InterfaceIndex uint32
2298
+ MaxReassemblySize uint32
2299
+ InterfaceIdentifier uint64
2300
+ MinRouterAdvertisementInterval uint32
2301
+ MaxRouterAdvertisementInterval uint32
2302
+ AdvertisingEnabled uint8
2303
+ ForwardingEnabled uint8
2304
+ WeakHostSend uint8
2305
+ WeakHostReceive uint8
2306
+ UseAutomaticMetric uint8
2307
+ UseNeighborUnreachabilityDetection uint8
2308
+ ManagedAddressConfigurationSupported uint8
2309
+ OtherStatefulConfigurationSupported uint8
2310
+ AdvertiseDefaultRoute uint8
2311
+ RouterDiscoveryBehavior uint32
2312
+ DadTransmits uint32
2313
+ BaseReachableTime uint32
2314
+ RetransmitTime uint32
2315
+ PathMtuDiscoveryTimeout uint32
2316
+ LinkLocalAddressBehavior uint32
2317
+ LinkLocalAddressTimeout uint32
2318
+ ZoneIndices [ScopeLevelCount ]uint32
2319
+ SitePrefixLength uint32
2320
+ Metric uint32
2321
+ NlMtu uint32
2322
+ Connected uint8
2323
+ SupportsWakeUpPatterns uint8
2324
+ SupportsNeighborDiscovery uint8
2325
+ SupportsRouterDiscovery uint8
2326
+ ReachableTime uint32
2327
+ TransmitOffload uint32
2328
+ ReceiveOffload uint32
2329
+ DisableDefaultRoutes uint8
2330
+ }
2331
+
2206
2332
// Console related constants used for the mode parameter to SetConsoleMode. See
2207
2333
// https://docs.microsoft.com/en-us/windows/console/setconsolemode for details.
2208
2334
0 commit comments