add NetConnection placeholder on windows.

pull/4/head
WAKAYAMA Shirou 11 years ago
parent 855ec85dbc
commit 49857dbdd0

@ -3,12 +3,31 @@
package gopsutil package gopsutil
import ( import (
"errors"
"net" "net"
"os" "os"
"syscall" "syscall"
"unsafe" "unsafe"
) )
var (
modiphlpapi = NewLazyDLL("iphlpapi.dll")
procGetExtendedTcpTable = modiphlpapi.NewProc("GetExtendedTcpTable")
procGetExtendedUdpTable = modiphlpapi.NewProc("GetExtendedUdpTable")
)
const (
TCP_TABLE_BASIC_LISTENER = iota
TCP_TABLE_BASIC_CONNECTIONS
TCP_TABLE_BASIC_ALL
TCP_TABLE_OWNER_PID_LISTENER
TCP_TABLE_OWNER_PID_CONNECTIONS
TCP_TABLE_OWNER_PID_ALL
TCP_TABLE_OWNER_MODULE_LISTENER
TCP_TABLE_OWNER_MODULE_CONNECTIONS
TCP_TABLE_OWNER_MODULE_ALL
)
func NetIOCounters(pernic bool) ([]NetIOCountersStat, error) { func NetIOCounters(pernic bool) ([]NetIOCountersStat, error) {
ifs, err := net.Interfaces() ifs, err := net.Interfaces()
if err != nil { if err != nil {
@ -49,6 +68,13 @@ func NetIOCounters(pernic bool) ([]NetIOCountersStat, error) {
return ret, nil return ret, nil
} }
// Return a list of network connections opened by a process
func NetConnections(kind string) ([]NetConnectionStat, error) {
var ret []NetConnectionStat
return ret, erros.New("not implemented yet")
}
// borrowed from src/pkg/net/interface_windows.go // borrowed from src/pkg/net/interface_windows.go
func getAdapterList() (*syscall.IpAdapterInfo, error) { func getAdapterList() (*syscall.IpAdapterInfo, error) {
b := make([]byte, 1000) b := make([]byte, 1000)

Loading…
Cancel
Save