portutils

package
v1.103.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertToSinglePort

func ConvertToSinglePort(port string) (int64, error)

ConvertToSinglePort converts a string to port.

func ExtractPortsAndProtocol added in v1.1.0

func ExtractPortsAndProtocol(service string) (string, string, error)

ExtractPortsAndProtocol extracts ports and protocol from the service NOTE: The protocol should be in uppercase to match our list of protocols here https://github.com/aporeto-inc/gaia/blob/master/protocols/protocols.go

Types

type PortsList

type PortsList []int64

PortsList holds a list of ports

func ConvertToPortsList

func ConvertToPortsList(ports string) (*PortsList, error)

ConvertToPortsList convert a , separated string to a list of port.

func (*PortsList) HasOverlapWithPort

func (p *PortsList) HasOverlapWithPort(port int64) bool

HasOverlapWithPort returns true if the list has one overlap with the given port.

func (*PortsList) HasOverlapWithPortsList

func (p *PortsList) HasOverlapWithPortsList(ports *PortsList) bool

HasOverlapWithPortsList returns true if the list has one overlap with the given ports.

func (*PortsList) HasOverlapWithPortsRanges

func (p *PortsList) HasOverlapWithPortsRanges(portRanges *PortsRangeList) bool

HasOverlapWithPortsRanges returns true if the list has one overlap with the given ranges.

type PortsRange

type PortsRange struct {
	FromPort int64
	ToPort   int64
}

PortsRange holds a range of ports.

func ConvertToPortsRange

func ConvertToPortsRange(ports string) (*PortsRange, error)

ConvertToPortsRange converts a :-separated string to a min and max port.

func ExtractPortsAndProtocolFromHostService

func ExtractPortsAndProtocolFromHostService(service string) (*PortsRange, string, error)

ExtractPortsAndProtocolFromHostService extracts the port range and the protocol from a host service like tcp/80:100. If the prefix is neither tcp or udp it will return an error. NOTE: The protocol should be in uppercase to match our list of protocols here https://github.com/aporeto-inc/gaia/blob/master/protocols/protocols.go

func (*PortsRange) HasOverlapWithPort

func (p *PortsRange) HasOverlapWithPort(port int64) bool

HasOverlapWithPort returns true if the range overlaps the given port.

func (*PortsRange) HasOverlapWithPortsList

func (p *PortsRange) HasOverlapWithPortsList(ports *PortsList) bool

HasOverlapWithPortsList returns true if the range overlaps one of the given ports.

func (*PortsRange) HasOverlapWithPortsRange

func (p *PortsRange) HasOverlapWithPortsRange(otherRange *PortsRange) bool

HasOverlapWithPortsRange returns true if the range overlaps one of the port ranges.

func (*PortsRange) HasOverlapWithPortsRanges

func (p *PortsRange) HasOverlapWithPortsRanges(otherRanges *PortsRangeList) bool

HasOverlapWithPortsRanges returns true if the range has overlaps with the given ports.

type PortsRangeList

type PortsRangeList []*PortsRange

PortsRangeList holds a list of port range.

Jump to

Keyboard shortcuts

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