vc5tmp

package module
v0.0.34 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: GPL-2.0 Imports: 17 Imported by: 0

README

vc5tmp

Temporary repo to test new api

BPF object file will be in repo to avoid need to do custom build process.

This should mean that the module can be used like any regular go module.

As the BPF is for a virtual architecture then is doesn't matter what platform the module is used on.

Includes bgp and monitoring cod for now for convenience.

NAT probably won't work on a tagged interface just yet?

XDP Virtual Server

Documentation

Index

Constants

View Source
const (
	TCP protocol = 0x06
	UDP protocol = 0x11
)
View Source
const NAMESPACE = "vc5"
View Source
const PREFIXES = 1048576

Variables

This section is empty.

Functions

func BPF added in v0.0.9

func BPF() []byte

func DefaultInterface added in v0.0.32

func DefaultInterface(addr IP4) *net.Interface

func VlanInterface

func VlanInterface(prefix net.IPNet) (ret iface, _ bool)

func VlanInterfaces

func VlanInterfaces(in map[uint16]net.IPNet) map[uint16]iface

Types

type Client

type Client struct {
	Interfaces []string
	VLANs      map[uint16]net.IPNet
	NAT        bool
	Native     bool
	Redirect   bool
	Address    netip.Addr // find default interface when not in VLAN mode
	// contains filtered or unexported fields
}

func (*Client) CreateDestination

func (b *Client) CreateDestination(s Service, d Destination) error

func (*Client) CreateService

func (b *Client) CreateService(s Service) error

func (*Client) Destinations

func (b *Client) Destinations(s Service) ([]DestinationExtended, error)

func (*Client) Info added in v0.0.32

func (c *Client) Info() (i Info)

func (*Client) NATAddr

func (b *Client) NATAddr(vip, rip IP4) (r IP4, _ bool)

func (*Client) NATAddress added in v0.0.9

func (b *Client) NATAddress(vip, rip netip.Addr) (r netip.Addr, _ bool)

func (*Client) Namespace added in v0.0.20

func (c *Client) Namespace() string

func (*Client) NamespaceAddress added in v0.0.20

func (c *Client) NamespaceAddress() string

func (*Client) Prefixes added in v0.0.33

func (c *Client) Prefixes() [PREFIXES]uint64

func (*Client) RemoveDestination

func (b *Client) RemoveDestination(s Service, d Destination) error

func (*Client) RemoveService

func (b *Client) RemoveService(s Service) error

func (*Client) Service added in v0.0.15

func (b *Client) Service(s Service) (se ServiceExtended, e error)

func (*Client) Services

func (b *Client) Services() ([]ServiceExtended, error)

func (*Client) Start

func (b *Client) Start() error

func (*Client) UpdateDestination

func (b *Client) UpdateDestination(s Service, d Destination) error

func (*Client) UpdateService

func (b *Client) UpdateService(s Service) error

func (*Client) UpdateVLANs added in v0.0.22

func (b *Client) UpdateVLANs(vlans map[uint16]net.IPNet)

type Destination

type Destination struct {
	Address netip.Addr
	Weight  uint8
}

type DestinationExtended

type DestinationExtended struct {
	Destination Destination
	MAC         MAC
	Stats       Stats
}

type ICMP

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

func (*ICMP) Ping added in v0.0.34

func (s *ICMP) Ping(target string)

func (*ICMP) Start added in v0.0.34

func (i *ICMP) Start() error

func (*ICMP) Stop added in v0.0.34

func (s *ICMP) Stop()

type IP4

type IP4 [4]byte
var IP IP4 = IP4{10, 255, 255, 254}

func (*IP4) IsNil

func (i *IP4) IsNil() bool

func (IP4) String

func (i IP4) String() string

type Info added in v0.0.32

type Info struct {
	Packets   uint64
	Octets    uint64
	Flows     uint64
	Latency   uint64
	Dropped   uint64
	Blocked   uint64
	NotQueued uint64
}

type MAC

type MAC [6]byte

func (*MAC) IsNil

func (m *MAC) IsNil() bool

func (*MAC) MarshalText added in v0.0.25

func (m *MAC) MarshalText() ([]byte, error)

func (MAC) String

func (m MAC) String() string

type Maps

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

func (*Maps) DEFCON added in v0.0.26

func (m *Maps) DEFCON(d uint8) uint8

func (*Maps) Distributed added in v0.0.26

func (m *Maps) Distributed(d bool)

func (*Maps) Era added in v0.0.26

func (m *Maps) Era(era uint8)

func (*Maps) MultiNIC added in v0.0.26

func (m *Maps) MultiNIC(mode bool)

func (*Maps) ReadPrefixCounters added in v0.0.26

func (m *Maps) ReadPrefixCounters() [PREFIXES]uint64

type Protocol added in v0.0.14

type Protocol uint8

type Service

type Service struct {
	Address  netip.Addr
	Port     uint16
	Protocol protocol

	Sticky bool
	// contains filtered or unexported fields
}

func (*Service) Service

func (s *Service) Service(x svc) Service

type ServiceExtended

type ServiceExtended struct {
	Service Service
	Stats   Stats
}

type Stats

type Stats struct {
	Packets uint64
	Octets  uint64
	Flows   uint64
}

func (Stats) String

func (s Stats) String() string

type Target

type Target struct {
	VIP      IP4
	RIP      IP4
	Port     uint16
	Protocol uint8
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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