config

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Copyright 2023 Louis Royer and the NextMN-SRv6 contributors. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. SPDX-License-Identifier: MIT

Copyright 2023 Louis Royer and the NextMN-SRv6 contributors. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. SPDX-License-Identifier: MIT

Copyright 2023 Louis Royer and the NextMN-SRv6 contributors. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. SPDX-License-Identifier: MIT

Copyright 2023 Louis Royer and the NextMN-SRv6 contributors. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. SPDX-License-Identifier: MIT

Copyright 2023 Louis Royer and the NextMN-SRv6 contributors. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. SPDX-License-Identifier: MIT

Copyright 2023 Louis Royer and the NextMN-SRv6 contributors. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. SPDX-License-Identifier: MIT

Copyright 2023 Louis Royer and the NextMN-SRv6 contributors. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. SPDX-License-Identifier: MIT

Copyright 2024 Louis Royer and the NextMN-SRv6 contributors. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. SPDX-License-Identifier: MIT

Copyright 2023 Louis Royer and the NextMN-SRv6 contributors. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. SPDX-License-Identifier: MIT

Copyright 2023 Louis Royer and the NextMN-SRv6 contributors. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. SPDX-License-Identifier: MIT

Copyright 2023 Louis Royer and the NextMN-SRv6 contributors. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file. SPDX-License-Identifier: MIT

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BehaviorOptions

type BehaviorOptions struct {
	SourceAddress *string `yaml:"set-source-address,omitempty"` // mandatory for End.M.GTP6.(E|D)
}

type Bsid

type Bsid struct {
	BsidPrefix   *string  `yaml:"bsid-prefix,omitempty"`
	SegmentsList []string `yaml:"segments-list"`
}

func (*Bsid) ReverseSegmentsList

func (a *Bsid) ReverseSegmentsList() []net.IP

func (*Bsid) ToIPRoute2

func (a *Bsid) ToIPRoute2() string

type Endpoint

type Endpoint struct {
	Provider Provider              `yaml:"provider"` // Linux, NextMN, …
	Prefix   string                `yaml:"prefix"`   // Prefix = LOC+FUNC example of prefix: fd00:51D5:0000:1:1:11/80
	Behavior iana.EndpointBehavior `yaml:"behavior"` // example of behavior: End.DX4
	Options  *BehaviorOptions      `yaml:"options,omitempty"`
}

type Endpoints

type Endpoints []*Endpoint

func (Endpoints) Filter

func (el Endpoints) Filter(provider Provider) Endpoints

type Headend

type Headend struct {
	Name                string          `yaml:"name"`
	To                  string          `yaml:"to"` // IP Prefix this Headend will handle (can be the same as GTP4HeadendPrefix if you have a single Headend)
	Provider            Provider        `yaml:"provider"`
	Behavior            HeadendBehavior `yaml:"behavior"`
	Policy              *[]Policy       `yaml:"policy,omitempty"`
	SourceAddressPrefix *string         `yaml:"source-address-prefix"`
	MTU                 *string         `yaml:"mtu,omitempty"` // suggested value is 1400 (same as UERANSIM) if the path includes a End.M.GTP4.E
}

type HeadendBehavior

type HeadendBehavior uint32
const (
	H_Encaps   HeadendBehavior = iota // encapsulate the packet into a new IPv6 Header with a SRH
	H_Inline                          // add a SRH to an existing IPv6 Header
	H_M_GTP4_D                        // RFC 9433, section 6.7
)

func (HeadendBehavior) String

func (hb HeadendBehavior) String() string

func (*HeadendBehavior) UnmarshalYAML

func (p *HeadendBehavior) UnmarshalYAML(n *yaml.Node) error

Unmarshal YAML to HeadendBehavior

type Headends

type Headends []*Headend

func (Headends) Filter

func (he Headends) Filter(provider Provider) Headends

func (Headends) FilterWithBehavior

func (he Headends) FilterWithBehavior(provider Provider, behavior HeadendBehavior) Headends

func (Headends) FilterWithoutBehavior added in v0.0.12

func (he Headends) FilterWithoutBehavior(provider Provider, behavior HeadendBehavior) Headends

type Hooks

type Hooks struct {
	PreInitHook  *string `yaml:"pre-init-hook,omitempty"`  // script to execute before interfaces are configured
	PostInitHook *string `yaml:"post-init-hook,omitempty"` // script to execute after interfaces are configured
	PreExitHook  *string `yaml:"pre-exit-hook,omitempty"`  // script to execute before interfaces are configured
	PostExitHook *string `yaml:"post-exit-hook,omitempty"` // script to execute after interfaces are configured
}

type Logger added in v0.0.13

type Logger struct {
	Level logrus.Level `yaml:"level"`
}

type Match

type Match struct {
	Teid                     *uint32 `yaml:"teid,omitempty"`
	InnerHeaderIPv4SrcPrefix *string `yaml:"inner-header-ipv4-src-prefix,omitempty"` // e.g. 192.168.0.1/32, Teid must be present
}

type Policy

type Policy struct {
	Match *Match `yaml:"match,omitempty"`
	Bsid  Bsid   `yaml:"bsid"`
}

type Provider

type Provider int
const (
	ProviderLinux Provider = iota
	ProviderNextMN
	ProviderNextMNWithController
)

func (Provider) String

func (p Provider) String() string

func (*Provider) UnmarshalYAML

func (p *Provider) UnmarshalYAML(n *yaml.Node) error

Unmarshal YAML to Provider

type SRv6Config

type SRv6Config struct {
	Hooks *Hooks `yaml:"hooks"`

	// interface with controller
	HTTPAddress netip.Addr `yaml:"http-address"`
	HTTPPort    *string    `yaml:"http-port,omitempty"` // default: 80
	// TODO: use a better type for this information
	ControllerURI string `yaml:"controller-uri"` // example: http://192.0.2.2/8080

	// Backbone IPv6 address
	// TODO: use a better type for this information
	BackboneIP netip.Addr `yaml:"backbone-ip"`

	// headends
	LinuxHeadendSetSourceAddress *string  `yaml:"linux-headend-set-source-address,omitempty"`
	GTP4HeadendPrefix            *string  `yaml:"gtp4-headend-prefix,omitempty"` // example of prefix: 10.0.0.1/32 (if you use a single GTP4 headend) or 10.0.1.0/24 (with more headends)
	IPV4HeadendPrefix            *string  `yaml:"ipv4-headend-prefix,omitempty"` // example of prefix: 10.0.0.1/32 (if you use a single IPV4 headend) or 10.0.1.0/24 (with more headends)
	Headends                     Headends `yaml:"headends"`

	// endpoints
	Locator   *string   `yaml:"locator,omitempty"` // example of locator: fd00:51D5:0000:1::/64
	Endpoints Endpoints `yaml:"endpoints"`
	Logger    *Logger   `yaml:"logger,omitempty"`
}

func ParseConf

func ParseConf(file string) (*SRv6Config, error)

Jump to

Keyboard shortcuts

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