提交 50a3266a 编写于 作者: S Sharif Elgamal

fix virtualbox IP address retrieval

上级 64173240
......@@ -65,11 +65,13 @@ func HostIP(host *host.Host) (net.IP, error) {
}
re := regexp.MustCompile(`hostonlyadapter2="(.*?)"`)
iface := re.FindStringSubmatch(string(out))[1]
ip, err := getIPForInterface(iface)
ipList, err := exec.Command(driver.VBoxManagePath(), "list", "hostonlyifs").Output()
if err != nil {
return []byte{}, errors.Wrap(err, "Error getting VM/Host IP address")
}
return ip, nil
re = regexp.MustCompile(`(?s)Name:\s*` + iface + `.+IPAddress:\s*(\S+)`)
ip := re.FindStringSubmatch(string(ipList))[1]
return net.ParseIP(ip), nil
case driver.HyperKit:
return net.ParseIP("192.168.64.1"), nil
case driver.VMware:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册