reader

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 License: Apache-2.0 Imports: 3 Imported by: 6

Documentation

Overview

Package reader provides an implementation to read the meridio configmap and convert it to Network Service Platform (NSP) API stucture instances.

Index

Constants

View Source
const (
	TrenchConfigKey     = "trench"
	ConduitsConfigKey   = "conduits"
	StreamsConfigKey    = "streams"
	FlowsConfigKey      = "flows"
	VipsConfigKey       = "vips"
	AttractorsConfigKey = "attractors"
	GatewaysConfigKey   = "gateways"
)
View Source
const (
	ByteMatchPattern = `^(sctp|tcp|udp)\[[0-9]+ *: *[124]\]( *& *0x[0-9a-f]+)? *= *([0-9]+|0x[0-9a-f]+)$`
)

Variables

This section is empty.

Functions

func ConvertAll

func ConvertAll(
	trench *Trench,
	conduits []*Conduit,
	streams []*Stream,
	flows []*Flow,
	vips []*Vip,
	attractors []*Attractor,
	gateways []*Gateway,
) (
	*nspAPI.Trench,
	[]*nspAPI.Conduit,
	[]*nspAPI.Stream,
	[]*nspAPI.Flow,
	[]*nspAPI.Vip,
	[]*nspAPI.Attractor,
	[]*nspAPI.Gateway,
)

func ConvertAttractors

func ConvertAttractors(attractors []*Attractor, trench *nspAPI.Trench, vips []*nspAPI.Vip, gateways []*nspAPI.Gateway) []*nspAPI.Attractor

func ConvertConduits

func ConvertConduits(conduits []*Conduit, trench *nspAPI.Trench, vips []*nspAPI.Vip) []*nspAPI.Conduit

func ConvertFlows

func ConvertFlows(flows []*Flow, streams []*nspAPI.Stream, vips []*nspAPI.Vip) []*nspAPI.Flow

func ConvertGateways

func ConvertGateways(gateways []*Gateway, trench *nspAPI.Trench) []*nspAPI.Gateway

func ConvertPortNats added in v0.8.0

func ConvertPortNats(portNats []*PortNat, vipsAPI []*nspAPI.Vip) []*nspAPI.Conduit_PortNat

func ConvertStreams

func ConvertStreams(streams []*Stream, conduits []*nspAPI.Conduit) []*nspAPI.Stream

func ConvertTrench

func ConvertTrench(trench *Trench) *nspAPI.Trench

func ConvertVips

func ConvertVips(vips []*Vip, trench *nspAPI.Trench) []*nspAPI.Vip

func UnmarshalConfig

func UnmarshalConfig(data map[string]string) (
	*Trench,
	[]*Conduit,
	[]*Stream,
	[]*Flow,
	[]*Vip,
	[]*Attractor,
	[]*Gateway,
	error)

func ValidByteMatch added in v0.7.0

func ValidByteMatch(byteMatch string) bool

Types

type Attractor

type Attractor struct {
	Name     string   `yaml:"name"`
	Vips     []string `yaml:"vips"`
	Gateways []string `yaml:"gateways"`
	Trench   string   `yaml:"trench"`
}

func UnmarshalAttractors

func UnmarshalAttractors(c string) ([]*Attractor, error)

type AttractorList

type AttractorList struct {
	Attractors []*Attractor `yaml:"items"`
}

type BgpAuth added in v0.9.0

type BgpAuth struct {
	KeyName   string `yaml:"key"`
	KeySource string `yaml:"source"`
}

type Conduit

type Conduit struct {
	Name                string     `yaml:"name"`
	Trench              string     `yaml:"trench"`
	DestinationPortNats []*PortNat `yaml:"destination-port-nats,omitempty"`
}

func UnmarshalConduits

func UnmarshalConduits(c string) ([]*Conduit, error)

type ConduitList

type ConduitList struct {
	Conduits []*Conduit `yaml:"items"`
}

type Flow

type Flow struct {
	Name                  string   `yaml:"name"`
	SourceSubnets         []string `yaml:"source-subnets"`
	DestinationPortRanges []string `yaml:"destination-port-ranges"`
	SourcePortRanges      []string `yaml:"source-port-ranges"`
	Protocols             []string `yaml:"protocols"`
	Vips                  []string `yaml:"vips"`
	Priority              int32    `yaml:"priority"`
	Stream                string   `yaml:"stream"`
	ByteMatches           []string `yaml:"byte-matches,omitempty"`
}

func UnmarshalFlows

func UnmarshalFlows(c string) ([]*Flow, error)

type FlowList

type FlowList struct {
	Flows []*Flow `yaml:"items"`
}

type Gateway

type Gateway struct {
	Name       string   `yaml:"name"`
	Address    string   `yaml:"address"`
	RemoteASN  uint32   `yaml:"remote-asn,omitempty"`
	LocalASN   uint32   `yaml:"local-asn,omitempty"`
	RemotePort uint16   `yaml:"remote-port,omitempty"`
	LocalPort  uint16   `yaml:"local-port,omitempty"`
	IPFamily   string   `yaml:"ip-family"`
	BFD        bool     `yaml:"bfd"`
	Protocol   string   `yaml:"protocol"`
	HoldTime   uint     `yaml:"hold-time,omitempty"`
	MinTx      uint     `yaml:"min-tx,omitempty"`
	MinRx      uint     `yaml:"min-rx,omitempty"`
	Multiplier uint     `yaml:"multiplier,omitempty"`
	Trench     string   `yaml:"trench"`
	BGPAuth    *BgpAuth `yaml:"bgp-auth,omitempty"`
}

func UnmarshalGateways

func UnmarshalGateways(c string) ([]*Gateway, error)

type GatewayList

type GatewayList struct {
	Gateways []*Gateway `yaml:"items"`
}

type PortNat added in v0.8.0

type PortNat struct {
	Port       uint16   `yaml:"port"`
	TargetPort uint16   `yaml:"target-port"`
	Vips       []string `yaml:"vips"`
	Protocol   string   `yaml:"protocol"`
}

type Stream

type Stream struct {
	Name       string `yaml:"name"`
	Conduit    string `yaml:"conduit"`
	MaxTargets uint32 `yaml:"max-targets"`
}

func UnmarshalStreams

func UnmarshalStreams(c string) ([]*Stream, error)

type StreamList

type StreamList struct {
	Streams []*Stream `yaml:"items"`
}

type Trench

type Trench struct {
	Name string `yaml:"name"`
}

func UnmarshalTrench

func UnmarshalTrench(c string) (*Trench, error)

type Vip

type Vip struct {
	Name    string `yaml:"name"`
	Address string `yaml:"address"`
	Trench  string `yaml:"trench"`
}

func UnmarshalVips

func UnmarshalVips(c string) ([]*Vip, error)

type VipList

type VipList struct {
	Vips []*Vip `yaml:"items"`
}

Jump to

Keyboard shortcuts

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