mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-10-17 10:09:05 +02:00
headers: fail Build on missing native exports and assert MI/COM layouts (#2739)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
@@ -22,6 +22,7 @@ import (
|
||||
"fmt"
|
||||
"unsafe"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/headers/lazyproc"
|
||||
"golang.org/x/sys/windows"
|
||||
)
|
||||
|
||||
@@ -29,8 +30,14 @@ import (
|
||||
var (
|
||||
modiphlpapi = windows.NewLazySystemDLL("iphlpapi.dll")
|
||||
procGetExtendedTcpTable = modiphlpapi.NewProc("GetExtendedTcpTable")
|
||||
|
||||
load = lazyproc.Once(modiphlpapi, procGetExtendedTcpTable)
|
||||
)
|
||||
|
||||
// Load checks that iphlpapi.dll exports every function of this package. Call
|
||||
// it in Build: a missing export panics on the first call otherwise.
|
||||
func Load() error { return load() }
|
||||
|
||||
func GetTCPConnectionStates(family uint32) (map[MIB_TCP_STATE]uint32, error) {
|
||||
stateCounts := make(map[MIB_TCP_STATE]uint32)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user