netfunc

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: MIT Imports: 14 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

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)

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) error

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

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 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 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) error

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

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