Documentation ¶
Index ¶
- func SelectInternalAddress(addresses []Address, machineLocal bool) string
- func SelectInternalHostPort(hps []HostPort, machineLocal bool) string
- func SelectPublicAddress(addresses []Address) string
- func SelectPublicHostPort(hps []HostPort) string
- func SortPorts(ports []Port)
- type Address
- type AddressType
- type BasicInfo
- type HostPort
- type Id
- type Info
- type Port
- type Scope
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SelectInternalAddress ¶
SelectInternalAddress picks one address from a slice that can be used as an endpoint for juju internal communication. If there are no suitable addresses, the empty string is returned.
func SelectInternalHostPort ¶
SelectInternalHostPort picks one HostPort from a slice that can be used as an endpoint for juju internal communication and returns it in its NetAddr form. If there are no suitable addresses, the empty string is returned.
func SelectPublicAddress ¶
SelectPublicAddress picks one address from a slice that would be appropriate to display as a publicly accessible endpoint. If there are no suitable addresses, the empty string is returned.
TODO(dimitern) Make this work properly with #IPv6 addresses.
func SelectPublicHostPort ¶
Types ¶
type Address ¶
type Address struct { Value string Type AddressType NetworkName string Scope }
Address represents the location of a machine, including metadata about what kind of location the address describes.
func NewAddress ¶
NewAddress creates a new Address, deriving its type from the value.
If the specified scope is ScopeUnknown, then NewAddress will attempt derive the scope based on reserved IP address ranges.
func NewAddresses ¶
NewAddresses is a convenience function to create addresses from a string slice
func (Address) String ¶
String returns a string representation of the address, in the form: scope:address(network name); for example:
public:c2-54-226-162-124.compute-1.amazonaws.com(ec2network)
If the scope is NetworkUnknown, the initial scope: prefix will be omitted. If the NetworkName is blank, the (network name) suffix will be omitted.
type AddressType ¶
type AddressType string
AddressType represents the possible ways of specifying a machine location by either a hostname resolvable by dns lookup, or IPv4 or IPv6 address.
const ( HostName AddressType = "hostname" IPv4Address AddressType = "ipv4" IPv6Address AddressType = "ipv6" )
func DeriveAddressType ¶
func DeriveAddressType(value string) AddressType
DeriveAddressType attempts to detect the type of address given.
type BasicInfo ¶
type BasicInfo struct { // CIDR of the network, in 123.45.67.89/24 format. Can be empty if // unknown. CIDR string // ProviderId is a provider-specific network id. This the only // required field. ProviderId Id // VLANTag needs to be between 1 and 4094 for VLANs and 0 for // normal networks. It's defined by IEEE 802.1Q standard, and used // to define a VLAN network. For more information, see: // http://en.wikipedia.org/wiki/IEEE_802.1Q. VLANTag int }
BasicInfo describes the bare minimum information for a network, which the provider knows about but juju might not yet.
type HostPort ¶
HostPort associates an address with a port.
func AddressesWithPort ¶
AddressesWithPort returns the given addresses all associated with the given port.
type Info ¶
type Info struct { // MACAddress is the network interface's hardware MAC address // (e.g. "aa:bb:cc:dd:ee:ff"). MACAddress string // CIDR of the network, in 123.45.67.89/24 format. CIDR string // NetworkName is juju-internal name of the network. NetworkName string // ProviderId is a provider-specific network id. ProviderId Id // VLANTag needs to be between 1 and 4094 for VLANs and 0 for // normal networks. It's defined by IEEE 802.1Q standard. VLANTag int // InterfaceName is the raw OS-specific network device name (e.g. // "eth1", even for a VLAN eth1.42 virtual interface). InterfaceName string // Disabled is true when the interface needs to be disabled on the // machine, e.g. not to configure it. Disabled bool }
Info describes a single network interface available on an instance. For providers that support networks, this will be available at StartInstance() time.
func (*Info) ActualInterfaceName ¶
ActualInterfaceName returns raw interface name for raw interface (e.g. "eth0") and virtual interface name for virtual interface (e.g. "eth0.42")
type Scope ¶
type Scope string
Scope denotes the context a location may apply to. If a name or address can be reached from the wider internet, it is considered public. A private network address is either specific to the cloud or cloud subnet a machine belongs to, or to the machine itself for containers.