1 Star 0 Fork 0

litian/machine

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
ip.go 738 Bytes
一键复制 编辑 原始数据 按行查看 历史
David Gageot 提交于 2016-01-11 11:42 . Test VirtualBox VM creation
package virtualbox
import (
"time"
"github.com/docker/machine/libmachine/drivers"
"github.com/docker/machine/libmachine/mcnutils"
)
// IPWaiter waits for an IP to be configured.
type IPWaiter interface {
Wait(d *Driver) error
}
func NewIPWaiter() IPWaiter {
return &sshIPWaiter{}
}
type sshIPWaiter struct{}
func (w *sshIPWaiter) Wait(d *Driver) error {
// Wait for SSH over NAT to be available before returning to user
if err := drivers.WaitForSSH(d); err != nil {
return err
}
// Bail if we don't get an IP from DHCP after a given number of seconds.
if err := mcnutils.WaitForSpecific(d.hostOnlyIPAvailable, 5, 4*time.Second); err != nil {
return err
}
var err error
d.IPAddress, err = d.GetIP()
return err
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/litian33/machine.git
git@gitee.com:litian33/machine.git
litian33
machine
machine
v0.8.2

搜索帮助