Open ChenYahui2019 opened 4 years ago
I found the list of net.Interfaces()
is same with ipconfig
or GetAdaptersAddresses/GetAdaptersInfo
, Wireshark use another Windows API pcap.FindAllDevs/pcapFindalldevsPtr
.
So, may net.Interfaces()
chang the method of getting all interfaces here?
/cc @mikioh @alexbrainman @bradfitz
I found the list of
net.Interfaces()
is same withipconfig
orGetAdaptersAddresses/GetAdaptersInfo
, Wireshark use another Windows APIpcap.FindAllDevs/pcapFindalldevsPtr
.
Sorry, but I don't have time even to investigate this. I don't think net.Interfaces is very useful on Windows.
Alex
What types of interfaces does Wireshark include that Go/ipconfig do not?
@bradfitz The NIC2 which is used for Hyper-v vswitch.
PS C:\Program Files> Get-NetAdapter
Name InterfaceDescription ifIndex Status MacAddress LinkSpeed
---- -------------------- ------- ------ ---------- ---------
NIC4 Broadcom NetXtreme Gigabit Ethernet 19 Disconnected C8-1F-66-F8-24-A8 0 bps
NIC3 Broadcom NetXtreme Gigabit Ethernet #2 18 Disconnected C8-1F-66-F8-24-A7 0 bps
vEthernet (vswitch123) Hyper-V Virtual Ethernet Adapter 45 Up C8-1F-66-F8-24-A6 1 Gbps
Npcap Loopback Adapter Npcap Loopback Adapter 65 Up 02-00-4C-4F-4F-50 1.2 Gbps
NIC2 Broadcom NetXtreme Gigabit Ethernet #3 10 Up C8-1F-66-F8-24-A6 1 Gbps
NIC1 Broadcom NetXtreme Gigabit Ethernet #4 7 Up C8-1F-66-F8-24-A5 1 Gbps
PS C:\Program Files> Get-VMSwitch vswitch123
Name SwitchType NetAdapterInterfaceDescription
---- ---------- ------------------------------
vswitch123 External Broadcom NetXtreme Gigabit Ethernet #3
PS C:\Program Files> ipconfig.exe
Windows IP 配置
以太网适配器 NIC4:
媒体状态 . . . . . . . . . . . . : 媒体已断开连接
连接特定的 DNS 后缀 . . . . . . . :
以太网适配器 NIC3:
媒体状态 . . . . . . . . . . . . : 媒体已断开连接
连接特定的 DNS 后缀 . . . . . . . :
以太网适配器 NIC1:
连接特定的 DNS 后缀 . . . . . . . :
本地链接 IPv6 地址. . . . . . . . : xxxx::xxx:xxxxx:xxxx:xxxxxxxx
IPv4 地址 . . . . . . . . . . . . : 172.16.1.134
子网掩码 . . . . . . . . . . . . : 255.255.0.0
默认网关. . . . . . . . . . . . . :
以太网适配器 Npcap Loopback Adapter:
连接特定的 DNS 后缀 . . . . . . . :
本地链接 IPv6 地址. . . . . . . . : xxxx::xxx:xxxxx:xxxx:xxxxxxxx
自动配置 IPv4 地址 . . . . . . . : 169.254.70.224
子网掩码 . . . . . . . . . . . . : 255.255.0.0
默认网关. . . . . . . . . . . . . :
以太网适配器 vEthernet (vswitch123):
连接特定的 DNS 后缀 . . . . . . . :
本地链接 IPv6 地址. . . . . . . . : xxxx::xxx:xxxxx:xxxx:xxxxxxxx
IPv4 地址 . . . . . . . . . . . . : x.x.x.x
子网掩码 . . . . . . . . . . . . : 255.255.0.0
默认网关. . . . . . . . . . . . . : x.x.x.x
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Y
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I am trying to use
net.Interfaces()
to get all interfaces on Windows, however, some interfaces can only display using Wireshark.What did you expect to see?
If Wireshark was able to display an interface on Windows, net.Interfaces() can also do the same.
What did you see instead?
Some interfaces can be seen using Wireshark on Windows, which cannot been seen by
net.Interfaces()
.