package gotoc import ( "unsafe" ) /* #include "../../../../../Include/sigar.h" #include #include typedef unsigned char byte; void translateNetConfig(sigar_t *sigar){ sigar_net_interface_config_t config; sigar_net_interface_config_get(sigar, "eth10", &config); sigar_uint32_t a=config.address.addr.in; char buf[180]; unsigned char* ucp = (unsigned char *)&a; sprintf(buf, "%d.%d.%d.%d", ucp[0] & 0xff, ucp[1] & 0xff, ucp[2] & 0xff, ucp[3] & 0xff); printf("%s\n",buf); } */ import "C" func GetNetConfig()(C.sigar_net_interface_config_t,[]C.sigar_net_interface_config_t,[]C.sigar_net_interface_stat_t){ var sigar *C.sigar_t=GetSigarHandle() var netlistconf C.sigar_net_interface_list_t var netconfPrimary C.sigar_net_interface_config_t C.sigar_net_interface_config_primary_get(sigar, &netconfPrimary) C.sigar_net_interface_list_get(sigar, &netlistconf) var length int=int(netlistconf.number) goInterfacesNames := ((*[1 << 30]*C.char)(unsafe.Pointer(netlistconf.data)))[:length] //cinteraces:=GetGoSlice(length, unsafe.Pointer(netlistconf.data)) //goInterfacesNames := *(*[]C.char)(unsafe.Pointer(&cinteraces)) var netconf =make([]C.sigar_net_interface_config_t,length) var netstat =make([]C.sigar_net_interface_stat_t,length) for i:=0;i