hashicorp / go-sockaddr

IP Address/UNIX Socket convenience functions for Go
Mozilla Public License 2.0
266 stars 53 forks source link

Windows regex doesn't capture wireless adapters #20

Closed schmichael closed 6 years ago

schmichael commented 6 years ago

From hashicorp/nomad#3986

The regex:

ifNameRE *regexp.Regexp = regexp.MustCompile(^Ethernet adapter ([^:]+):)

Fails to match wireless adapters which have the name:

Wireless LAN adapter wifi

Perhaps matching on adapter is sufficient?

lolieatcat commented 6 years ago

Windows IP Configuration

Wireless LAN adapter wifi:

Connection-specific DNS Suffix . : Link-local IPv6 Address . . . . . : fe80::3110:eaca:23d7:b9ac%14 IPv4 Address. . . . . . . . . . . : 172.20.10.5 Subnet Mask . . . . . . . . . . . : 255.255.255.240 Default Gateway . . . . . . . . . : 172.20.10.1

Ethernet adapter 本地连接 2:

Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . :

Ethernet adapter VMware Network Adapter VMnet1:

Connection-specific DNS Suffix . : Link-local IPv6 Address . . . . . : fe80::6069:41f9:ea44:7a8b%18 IPv4 Address. . . . . . . . . . . : 192.168.249.1 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . :

Ethernet adapter VMware Network Adapter VMnet8:

Connection-specific DNS Suffix . : Link-local IPv6 Address . . . . . : fe80::6846:4948:d165:67d8%19 IPv4 Address. . . . . . . . . . . : 192.168.198.1 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . :

Tunnel adapter isatap.{EBACA806-1326-447F-96A0-465285B91CD1}:

Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . :

Tunnel adapter isatap.{45830FF1-D3E8-4C59-B6F7-24660FE3D3D7}:

Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . :

Tunnel adapter isatap.{FF9F237C-4A0A-450B-95FA-CB8E92FC4AA9}:

Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . :