Documentation
¶
Index ¶
- Constants
- func GetAdaptersAddresses() (table map[uint32]IPAdapterAddressesLh, err error)
- func GetExtendedTcpV4Table() (table map[uint32][]MIB_TCPROW_OWNER_PID, err error)
- func GetIFTable() (table map[uint32]windows.MibIfRow, err error)
- type IPAdapterAddressesLh
- type IPAdapterUnicastAddress
- type MIB_IPFORWARDROW
- type MIB_TCPROW_OWNER_PID
Constants ¶
const ( TCP_TABLE_BASIC_LISTENER = uint32(0) TCP_TABLE_BASIC_CONNECTIONS = uint32(1) TCP_TABLE_BASIC_ALL = uint32(2) TCP_TABLE_OWNER_PID_LISTENER = uint32(3) TCP_TABLE_OWNER_PID_CONNECTIONS = uint32(4) TCP_TABLE_OWNER_PID_ALL = uint32(5) TCP_TABLE_OWNER_MODULE_LISTENER = uint32(6) TCP_TABLE_OWNER_MODULE_CONNECTIONS = uint32(7) TCP_TABLE_OWNER_MODULE_ALL = uint32(8) )
TCP_TABLE_CLASS enum
https://learn.microsoft.com/en-us/windows/win32/api/iprtrmib/ne-iprtrmib-tcp_table_class
Variables ¶
This section is empty.
Functions ¶
func GetAdaptersAddresses ¶
func GetAdaptersAddresses() (table map[uint32]IPAdapterAddressesLh, err error)
GetAdaptersAddresses returns a map of all of the adapters, indexed by interface index
func GetExtendedTcpV4Table ¶
func GetExtendedTcpV4Table() (table map[uint32][]MIB_TCPROW_OWNER_PID, err error)
GetExtendedTcpV4Table returns a list of ipv4 tcp connections indexed by owning PID
https://learn.microsoft.com/en-us/windows/win32/api/iphlpapi/nf-iphlpapi-getextendedtcptable
func GetIFTable ¶
GetIFTable returns a table of interfaces, indexed by the interface index
https://learn.microsoft.com/en-us/windows/win32/api/iphlpapi/nf-iphlpapi-getiftable
Types ¶
type IPAdapterAddressesLh ¶ added in v0.51.0
type IPAdapterAddressesLh struct {
Index uint32
AdapterName string
UnicastAddresses []IPAdapterUnicastAddress
}
IPAdapterAddressesLh is a go adaptation of the C structure IP_ADAPTER_ADDRESSES_LH it is a go adaptation, rather than a matching structure, because the real structure is difficult to approximate in Go.
https://learn.microsoft.com/en-us/windows/win32/api/iptypes/ns-iptypes-ip_adapter_addresses_lh
type IPAdapterUnicastAddress ¶
IPAdapterUnicastAddress is a Go approximation of IP_ADAPTER_UNICAST_ADDRESS_LH
https://learn.microsoft.com/en-us/windows/win32/api/iptypes/ns-iptypes-ip_adapter_unicast_address_lh
type MIB_IPFORWARDROW ¶
type MIB_IPFORWARDROW struct {
DwForwardDest uint32 // destination IP address. 0.0.0.0 is default route
DwForwardMask uint32
DwForwardPolicy uint32
DwForwardNextHop uint32
DwForwardIfIndex uint32
DwForwardType uint32
DwForwardProto uint32
DwForwardAge uint32
DwForwardNextHopAS uint32
DwForwardMetric1 uint32
DwForwardMetric2 uint32
DwForwardMetric3 uint32
DwForwardMetric4 uint32
DwForwardMetric5 uint32
}
MIB_IPFORWARDROW is the matching structure for the IPHelper structure of the same name; it defines a route entry https://docs.microsoft.com/en-us/windows/win32/api/ipmib/ns-ipmib-mib_ipforwardrow
func GetIPv4RouteTable ¶
func GetIPv4RouteTable() (table []MIB_IPFORWARDROW, err error)
GetIPv4RouteTable returns a list of the current ipv4 routes.
https://learn.microsoft.com/en-us/windows/win32/api/iphlpapi/nf-iphlpapi-getipforwardtable
type MIB_TCPROW_OWNER_PID ¶
type MIB_TCPROW_OWNER_PID struct {
/* C declaration
DWORD dwState;
DWORD dwLocalAddr;
DWORD dwLocalPort;
DWORD dwRemoteAddr;
DWORD dwRemotePort;
DWORD dwOwningPid; */
DwState uint32
DwLocalAddr uint32 // network byte order
DwLocalPort uint32 // network byte order
DwRemoteAddr uint32 // network byte order
DwRemotePort uint32 // network byte order
DwOwningPid uint32
}
MIB_TCPROW_OWNER_PID is the matching structure for the IPHelper structure of the same name. Fields documented https://docs.microsoft.com/en-us/windows/win32/api/tcpmib/ns-tcpmib-mib_tcprow_owner_pid