firewall

package
v0.0.0-...-b0bff92 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2021 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SSHRule is a rule for SSH connections.
	SSHRule = WellKnownServiceType("ssh")

	// JujuControllerRule is a rule for connections to the Juju controller.
	JujuControllerRule = WellKnownServiceType("juju-controller")

	// JujuApplicationOfferRule is a rule for connections to a Juju offer.
	JujuApplicationOfferRule = WellKnownServiceType("juju-application-offer")
)
View Source
const AllNetworksIPV4CIDR = "0.0.0.0/0"

AllNetworksIPV4CIDR represents the zero address (quad-zero) CIDR for an IPV4 network.

View Source
const AllNetworksIPV6CIDR = "::/0"

AllNetworksIPV6CIDR represents the zero address (quad-zero) CIDR for an IPV6 network.

Variables

This section is empty.

Functions

This section is empty.

Types

type IngressRule

type IngressRule struct {
	// The destination port range for the incoming traffic.
	PortRange network.PortRange

	// A set of CIDRs that describe the origin for incoming traffic. An
	// implicit 0.0.0.0/0 CIDR is assumed if no CIDRs are specified.
	SourceCIDRs set.Strings
}

IngressRule represents a rule for allowing traffic from a set of source CIDRs to reach a particular port range.

func NewIngressRule

func NewIngressRule(portRange network.PortRange, sourceCIDRs ...string) IngressRule

NewIngressRule creates a new IngressRule for allowing access to portRange from the list of sourceCIDRs. If no sourceCIDRs are specified, the rule will implicitly apply to all networks.

func (IngressRule) EqualTo

func (r IngressRule) EqualTo(other IngressRule) bool

EqualTo returns true if this rule is equal to the provided rule.

func (IngressRule) LessThan

func (r IngressRule) LessThan(other IngressRule) bool

LessThan compares two IngressRule instances for equality.

func (IngressRule) String

func (r IngressRule) String() string

String is the string representation of IngressRule.

func (IngressRule) Validate

func (r IngressRule) Validate() error

Validate ensures that the ingress rule contains valid source and destination parameters.

type IngressRules

type IngressRules []IngressRule

IngressRules represents a collection of IngressRule instances.

func (IngressRules) Diff

func (r IngressRules) Diff(target IngressRules) (toOpen, toClose IngressRules)

Diff returns a list of IngressRules to open and/or close so that this set of ingress rules matches the target.

func (IngressRules) EqualTo

func (rules IngressRules) EqualTo(other IngressRules) bool

EqualTo returns true if this rule list is equal to the provided rule list.

func (IngressRules) RemoveCIDRsMatchingAddressType

func (rules IngressRules) RemoveCIDRsMatchingAddressType(removeAddrType network.AddressType) IngressRules

RemoveCIDRsMatchingAddressType returns a new list of rules where any CIDR whose address type corresponds to the specified AddressType argument has been removed.

func (IngressRules) Sort

func (rules IngressRules) Sort()

Sort the rule list by port range and then by source CIDRs.

func (IngressRules) UniqueRules

func (rules IngressRules) UniqueRules() IngressRules

UniqueRules returns a copy of the ingress rule list after removing any duplicate entries.

func (IngressRules) Validate

func (rules IngressRules) Validate() error

Validate the list of ingress rules

type WellKnownServiceType

type WellKnownServiceType string

WellKnownService defines a service for which firewall rules may be applied.

func (WellKnownServiceType) Validate

func (v WellKnownServiceType) Validate() error

Jump to

Keyboard shortcuts

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