network

package
v0.0.0-...-8ff1004 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 15, 2019 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMacAndIP

func GetMacAndIP(address []string) (mac string, ip string, err error)

GetMacAndIp is a helper function that returns a mac and an IP, given a list of strings containing both. This type of array is returned by the oracle API as part of instance details.

Types

type AvailabilityZone

type AvailabilityZone struct {
	// contains filtered or unexported fields
}

AvailabilityZone implements common.AvailabilityZone

func NewAvailabilityZone

func NewAvailabilityZone(name string) AvailabilityZone

NewAvailabilityZone returns a new availability zone

func (AvailabilityZone) Available

func (a AvailabilityZone) Available() bool

Available is specified on the common.AvailabilityZone interface

func (AvailabilityZone) Name

func (a AvailabilityZone) Name() string

Name is specified on the common.AvailabilityZone interface

type Environ

type Environ struct {
	// contains filtered or unexported fields
}

Environ implements the environs.Networking interface

func NewEnviron

NewEnviron returns a new instance of Environ

func (Environ) AllocateContainerAddresses

func (e Environ) AllocateContainerAddresses(
	ctx context.ProviderCallContext,
	hostInstanceID instance.Id,
	containerTag names.MachineTag,
	preparedInfo []network.InterfaceInfo,
) ([]network.InterfaceInfo, error)

AllocateContainerAddresses is defined on the environs.Networking interface.

func (Environ) AreSpacesRoutable

func (Environ) AreSpacesRoutable(ctx context.ProviderCallContext, space1, space2 *environs.ProviderSpaceInfo) (bool, error)

AreSpacesRoutable is defined on the environs.NetworkingEnviron interface.

func (Environ) NetworkInterfaces

func (e Environ) NetworkInterfaces(ctx context.ProviderCallContext, instId instance.Id) ([]network.InterfaceInfo, error)

NetworkInterfaces is defined on the environs.Networking interface.

func (Environ) ProviderSpaceInfo

ProviderSpaceInfo is defined on the environs.NetworkingEnviron interface.

func (Environ) ReleaseContainerAddresses

func (e Environ) ReleaseContainerAddresses(ctx context.ProviderCallContext, interfaces []network.ProviderInterfaceInfo) error

ReleaseContainerAddresses is defined on the environs.Networking interface.

func (*Environ) SSHAddresses

func (*Environ) SSHAddresses(ctx context.ProviderCallContext, addresses []network.Address) ([]network.Address, error)

SSHAddresses is defined on the environs.SSHAddresses interface.

func (Environ) Spaces

Spaces is defined on the environs.Networking interface.

func (Environ) Subnets

func (e Environ) Subnets(ctx context.ProviderCallContext, id instance.Id, subnets []network.Id) ([]network.SubnetInfo, error)

Subnets is defined on the environs.Networking interface.

func (*Environ) SuperSubnets

func (*Environ) SuperSubnets(ctx context.ProviderCallContext) ([]string, error)

SuperSubnets implements environs.SuperSubnets

func (Environ) SupportsContainerAddresses

func (e Environ) SupportsContainerAddresses(ctx context.ProviderCallContext) (bool, error)

SupportsContainerAddresses is defined on the environs.Networking interface.

func (Environ) SupportsSpaceDiscovery

func (e Environ) SupportsSpaceDiscovery(ctx context.ProviderCallContext) (bool, error)

SupportsSpaceDiscovery is defined on the environs.Networking interface.

func (Environ) SupportsSpaces

func (e Environ) SupportsSpaces(ctx context.ProviderCallContext) (bool, error)

SupportsSpaces is defined on the environs.Networking interface.

type Firewall

type Firewall struct {
	// contains filtered or unexported fields
}

Firewall implements environ.Firewaller

func NewFirewall

func NewFirewall(cfg environs.ConfigGetter, client FirewallerAPI, c clock.Clock) *Firewall

NewFirewall returns a new Firewall

func (Firewall) ClosePorts

func (f Firewall) ClosePorts(ctx context.ProviderCallContext, rules []network.IngressRule) error

ClosePorts is specified on the environ.Firewaller interface.

func (Firewall) ClosePortsOnInstance

func (f Firewall) ClosePortsOnInstance(ctx context.ProviderCallContext, machineId string, rules []network.IngressRule) error

ClosePortsOnInstnace will close ports corresponding to the supplied rules for a given instance.

func (Firewall) CreateDefaultACLAndRules

func (f Firewall) CreateDefaultACLAndRules(machineId string) (response.Acl, error)

CreateDefaultACLAndRules creates default ACL and rules for IP networks attached to units. NOTE (gsamfira): For now we apply an allow all on these ACLs. Traffic will be cloud-only between instances connected to the same ip network exchange (the equivalent of a space) There will be no public IP associated to interfaces connected to IP networks, so only instances connected to the same network, or a network managed by the same space will be able to connect. This will ensure that peers and units entering a relationship can connect to services deployed by a particular unit, without having to expose the application.

func (Firewall) CreateMachineSecLists

func (f Firewall) CreateMachineSecLists(machineId string, apiPort int) ([]string, error)

CreateMachineSecLists creates a security list for the given instance. It's worth noting that this function also ensures that the default environment sec list is also present, and has the appropriate default rules. The port parameter is the API port for the state machine, for which we need to create rules.

func (Firewall) DeleteMachineSecList

func (f Firewall) DeleteMachineSecList(machineId string) error

DeleteMachineSecList will delete the security list on the given machine

func (Firewall) GlobalIngressRules

func (f Firewall) GlobalIngressRules(ctx context.ProviderCallContext) ([]network.IngressRule, error)

GlobalIngressRules returns the ingress rules applied to the whole environment.

func (Firewall) IngressRules

func (f Firewall) IngressRules(ctx context.ProviderCallContext) ([]network.IngressRule, error)

IngressRules is specified on the environ.Firewaller interface.

func (Firewall) MachineIngressRules

func (f Firewall) MachineIngressRules(ctx context.ProviderCallContext, machineId string) ([]network.IngressRule, error)

MachineIngressRules returns all ingress rules from the machine specific sec list

func (Firewall) OpenPorts

func (f Firewall) OpenPorts(ctx context.ProviderCallContext, rules []network.IngressRule) error

OpenPorts is specified on the environ.Firewaller interface.

func (Firewall) OpenPortsOnInstance

func (f Firewall) OpenPortsOnInstance(ctx context.ProviderCallContext, machineId string, rules []network.IngressRule) error

OpenPortsOnInstance will open ports corresponding to the supplied rules on the given instance

func (Firewall) RemoveACLAndRules

func (f Firewall) RemoveACLAndRules(machineId string) error

RemoveACLAndRules will remove the ACL and any associated rules.

type Firewaller

type Firewaller interface {
	environs.Firewaller

	// Return all machine ingress rules for a given machine id
	MachineIngressRules(ctx context.ProviderCallContext, id string) ([]network.IngressRule, error)

	// OpenPortsOnInstance will open ports corresponding to the supplied rules
	// on the given instance
	OpenPortsOnInstance(ctx context.ProviderCallContext, machineId string, rules []network.IngressRule) error

	// ClosePortsOnInstnace will close ports corresponding to the supplied rules
	// for a given instance.
	ClosePortsOnInstance(ctx context.ProviderCallContext, machineId string, rules []network.IngressRule) error

	// CreateMachineSecLists creates a security list for the given instance.
	// It's worth noting that this function also ensures that the default environment
	// sec list is also present, and has the appropriate default rules.
	// The port parameter is the API port for the state machine, for which we need
	// to create rules.
	CreateMachineSecLists(id string, port int) ([]string, error)

	// DeleteMachineSecList will delete the security list on the given machine
	// id
	DeleteMachineSecList(id string) error

	// CreateDefaultACLAndRules will create a default ACL and associated rules, for
	// a given machine. This ACL applies to user defined IP networks, which are attached
	// to the instance.
	CreateDefaultACLAndRules(id string) (response.Acl, error)

	// RemoveACLAndRules will remove the ACL and any associated rules.
	RemoveACLAndRules(id string) error
}

Firewaller exposes methods for managing network ports.

type FirewallerAPI

FirewallerAPI defines methods necessary for interacting with the firewall feature of Oracle compute cloud

type NetworkingAPI

type NetworkingAPI interface {
	commonProvider.Instancer
	commonProvider.Composer

	// AllIpNetworks fetches all IP networks matching a filter. A nil valued filter
	// will return all IP networks
	AllIpNetworks([]api.Filter) (response.AllIpNetworks, error)

	// AllAcls fetches all ACLs that match a given filter.
	AllAcls([]api.Filter) (response.AllAcls, error)
}

NetworkingAPI defines methods needed to interact with the networking features of the Oracle API

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL