netfunc

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2024 License: MIT Imports: 21 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 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

func NewEndpoint

func NewEndpoint(ec *config.Endpoint, ttl uint8, hopLimit uint8, debug bool) (netfunc_api.NetFunc, error)

func NewHeadend

func NewHeadend(he *config.Headend, ttl uint8, hopLimit uint8, debug bool) (netfunc_api.NetFunc, error)

func NewHeadendWithCtrl added in v0.0.12

func NewHeadendWithCtrl(he *config.Headend, ttl uint8, hopLimit uint8, debug bool, setup_registry app_api.Registry) (netfunc_api.NetFunc, error)

Types

type BaseHandler

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

Use this as a base for new handlers

func NewBaseHandler

func NewBaseHandler(prefix netip.Prefix, ttl uint8, hopLimit uint8) BaseHandler

func (BaseHandler) CheckDAInPrefixRange

func (h BaseHandler) CheckDAInPrefixRange(pqt *Packet) (netip.Addr, error)

Return the packet IP destination address (first network layer) if it is in the prefix range

func (BaseHandler) GetSrcAddr added in v0.0.12

func (h BaseHandler) GetSrcAddr(pqt *Packet) (netip.Addr, error)

func (BaseHandler) HopLimit

func (h BaseHandler) HopLimit() uint8

func (BaseHandler) Prefix

func (h BaseHandler) Prefix() netip.Prefix

Return prefix of the Handler as a *netip.Prefix

func (BaseHandler) TTL

func (h BaseHandler) TTL() uint8

type EndpointMGTP4E

type EndpointMGTP4E struct {
	BaseHandler
}

func NewEndpointMGTP4E

func NewEndpointMGTP4E(prefix netip.Prefix, ttl uint8, hopLimit uint8) *EndpointMGTP4E

func (EndpointMGTP4E) Handle

func (e EndpointMGTP4E) Handle(packet []byte) ([]byte, error)

Handle a packet

type HeadendEncapsWithCtrl added in v0.0.12

type HeadendEncapsWithCtrl struct {
	RulesRegistry ctrl_api.RulesRegistry
	BaseHandler
}

func NewHeadendEncapsWithCtrl added in v0.0.12

func NewHeadendEncapsWithCtrl(prefix netip.Prefix, rr ctrl_api.RulesRegistry, ttl uint8, hopLimit uint8) *HeadendEncapsWithCtrl

func (HeadendEncapsWithCtrl) Handle added in v0.0.12

func (h HeadendEncapsWithCtrl) Handle(packet []byte) ([]byte, error)

Handle a packet

type HeadendGTP4

type HeadendGTP4 struct {
	BaseHandler
	// contains filtered or unexported fields
}

func NewHeadendGTP4

func NewHeadendGTP4(prefix netip.Prefix, sourceAddressPrefix netip.Prefix, policy []config.Policy, ttl uint8, hopLimit uint8) *HeadendGTP4

func (HeadendGTP4) Handle

func (h HeadendGTP4) Handle(packet []byte) ([]byte, error)

Handle a packet

type HeadendGTP4WithCtrl added in v0.0.12

type HeadendGTP4WithCtrl struct {
	RulesRegistry ctrl_api.RulesRegistry
	BaseHandler
	// contains filtered or unexported fields
}

func NewHeadendGTP4WithCtrl added in v0.0.12

func NewHeadendGTP4WithCtrl(prefix netip.Prefix, rr ctrl_api.RulesRegistry, ttl uint8, hopLimit uint8, db db_api.Uplink) (*HeadendGTP4WithCtrl, error)

func (HeadendGTP4WithCtrl) Handle added in v0.0.12

func (h HeadendGTP4WithCtrl) Handle(packet []byte) ([]byte, error)

Handle a packet

type NetFunc

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

func NewNetFunc

func NewNetFunc(handler netfunc_api.Handler, debug bool) *NetFunc

func (NetFunc) Debug

func (n NetFunc) Debug() bool

func (*NetFunc) Start

func (n *NetFunc) Start(tunIface *iproute2.TunIface)

Start the NetFunc goroutine

func (*NetFunc) Stop

func (n *NetFunc) Stop()

Stop the NetFunc goroutine

type Packet

type Packet struct {
	gopacket.Packet
	// contains filtered or unexported fields
}

func NewIPv4Packet

func NewIPv4Packet(packet []byte) (*Packet, error)

func NewIPv6Packet

func NewIPv6Packet(packet []byte) (*Packet, error)

func (*Packet) CheckDAInPrefixRange

func (p *Packet) CheckDAInPrefixRange(prefix netip.Prefix) (netip.Addr, error)

Return the packet IP destination address (first network layer) if it is in the prefix range

func (*Packet) DownlinkAction added in v0.0.12

func (p *Packet) DownlinkAction(rr ctrl_api.RulesRegistry) (uuid.UUID, json_api.Action, error)

Returns the DownlinkAction related to this packet

func (*Packet) GetSrcAddr added in v0.0.12

func (p *Packet) GetSrcAddr() (netip.Addr, error)

func (*Packet) PopGTP4Headers

func (p *Packet) PopGTP4Headers() (gopacket.Layer, error)

Returns the first gopacket.Layer after IPv4/UDP/GTPU headers

func (*Packet) PopIPv6Headers

func (p *Packet) PopIPv6Headers() (gopacket.Layer, error)

Returns the first gopacket.Layer after IPv6 header / extension headers

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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