activator

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2025 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package activator contains a userspace TCP proxy that listens on a random port and loads an eBPF program to intercept and redirect packets destined to the configured ports. The activator accepts the connection, calls onAccept, signals to disable the eBPF redirect and then proxies the initial data to the defined ports as soon as something is listening.

Index

Constants

View Source
const (
	BPFFSPath = "/sys/fs/bpf"

	SocketTrackerMap     = "socket_tracker"
	PodKubeletAddrsMapv4 = "kubelet_addrs_v4"
	PodKubeletAddrsMapv6 = "kubelet_addrs_v6"
)

Variables

View Source
var ErrMapNotFound = errors.New("bpf map could not be found")

Functions

func MapsPath added in v0.2.0

func MapsPath() string

func MountBPFFS added in v0.2.0

func MountBPFFS(path string) error

MountBPFFS executes a bpf mount on the supplied path. It has been adapted by: https://github.com/cilium/cilium/blob/cf3889af46a4058d5e89495d502fc19c10713110/pkg/bpf/bpffs_linux.go#L124

func PinPath added in v0.2.0

func PinPath(pid int) string

Types

type BPF added in v0.2.0

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

func InitBPF added in v0.2.0

func InitBPF(pid int, log *slog.Logger, probeBinaryName string, opts ...BPFOpts) (*BPF, error)

func (*BPF) AttachRedirector added in v0.2.0

func (bpf *BPF) AttachRedirector(ifaces ...string) error

func (*BPF) Cleanup added in v0.2.0

func (bpf *BPF) Cleanup() error

type BPFConfig added in v0.9.0

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

type BPFOpts added in v0.9.0

type BPFOpts func(cfg *BPFConfig)

func OverrideMapSize added in v0.9.0

func OverrideMapSize(mapSizes map[string]uint32) BPFOpts

type ConnHook added in v0.7.0

type ConnHook func(net.Conn) (conn net.Conn, cont bool, err error)

type NoActivityRecordedErr added in v0.9.0

type NoActivityRecordedErr struct{}

func (NoActivityRecordedErr) Error added in v0.9.0

func (err NoActivityRecordedErr) Error() string

type RestoreHook added in v0.7.0

type RestoreHook func() error

type Server

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

func NewServer

func NewServer(ctx context.Context, nn ns.NetNS) (*Server, error)

func (*Server) DisableRedirects added in v0.1.0

func (s *Server) DisableRedirects() error

func (*Server) LastActivity added in v0.9.0

func (s *Server) LastActivity(port uint16) (time.Time, error)

func (*Server) RedirectPort added in v0.1.0

func (s *Server) RedirectPort(from, to uint16) error

RedirectPort redirects the port from to on ingress and to from on egress.

func (*Server) Reset added in v0.1.0

func (s *Server) Reset() error

func (*Server) SetPeekBufferSize added in v0.7.0

func (s *Server) SetPeekBufferSize(size int)

func (*Server) Start

func (s *Server) Start(ctx context.Context, connHook ConnHook, restoreHook RestoreHook, ports ...uint16) error

func (*Server) Started added in v0.2.0

func (s *Server) Started() bool

func (*Server) Stop

func (s *Server) Stop(ctx context.Context)

Jump to

Keyboard shortcuts

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