Ejemplo n.º 1
0
func (inst manualBootstrapInstance) Addresses() (addresses []network.Address, err error) {
	addr, err := manual.HostAddress(inst.host)
	if err != nil {
		return nil, err
	}
	return []network.Address{addr}, nil
}
Ejemplo n.º 2
0
func (s *addressesSuite) TestHostAddressIPv6(c *gc.C) {
	addr, err := manual.HostAddress("::1")
	c.Assert(s.netLookupHostCalled, gc.Equals, 0)
	c.Assert(err, gc.IsNil)
	c.Assert(addr, gc.Equals, network.Address{
		Value: "::1",
		Type:  network.IPv6Address,
		Scope: network.ScopePublic,
	})
}
Ejemplo n.º 3
0
func (s *addressesSuite) TestHostAddress(c *gc.C) {
	addr, err := manual.HostAddress(validHost)
	c.Assert(s.netLookupHostCalled, gc.Equals, 1)
	c.Assert(err, gc.IsNil)
	c.Assert(addr, gc.Equals, network.Address{
		Value: validHost,
		Type:  network.HostName,
		Scope: network.ScopePublic,
	})
}
Ejemplo n.º 4
0
func (s *addressesSuite) TestHostAddressError(c *gc.C) {
	addr, err := manual.HostAddress(invalidHost)
	c.Assert(s.netLookupHostCalled, gc.Equals, 1)
	c.Assert(err, gc.ErrorMatches, "invalid host: "+invalidHost)
	c.Assert(addr, gc.Equals, network.Address{})
}