hooks

package
v2.3.0-beta9 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

README

Hooks Package Documentation

The hooks package contains the user-space Go code responsible for loading eBPF hooks and eBPF maps, which are used to instrument the user API. This package is utilized by the CLI commands. Additionally, it launches proxy on a defined port to capture egress calls.

Documentation

Overview

Package hooks provides functionality for managing hooks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IPv4ToUint32

func IPv4ToUint32(ipStr string) (uint32, error)

IPv4ToUint32 converts a string representation of an IPv4 address to a 32-bit integer.

func ToIPv4MappedIPv6

func ToIPv4MappedIPv6(ipv4 string) ([4]uint32, error)

ToIPv4MappedIPv6 converts an IPv4 address to an IPv4-mapped IPv6 address.

Types

type Hooks

type Hooks struct {
	DockerCmdMap *ebpf.Map
	DNSPort      *ebpf.Map
	// contains filtered or unexported fields
}

func NewHooks

func NewHooks(logger *zap.Logger, cfg *config.Config) *Hooks

func (*Hooks) CleanProxyEntry

func (h *Hooks) CleanProxyEntry(srcPort uint16) error

func (*Hooks) Delete

func (h *Hooks) Delete(_ context.Context, srcPort uint16) error

func (*Hooks) Get

func (h *Hooks) Get(_ context.Context, srcPort uint16) (*core.NetworkAddress, error)

Get Used by proxy

func (*Hooks) GetDestinationInfo

func (h *Hooks) GetDestinationInfo(srcPort uint16) (*structs.DestInfo, error)

GetDestinationInfo retrieves destination information associated with a source port.

func (*Hooks) Load

func (h *Hooks) Load(ctx context.Context, id uint64, opts core.HookCfg) error

func (*Hooks) PassThroughPortsInKernel

func (h *Hooks) PassThroughPortsInKernel(_ context.Context, _ uint64, ports []uint) error

func (*Hooks) Record

func (h *Hooks) Record(ctx context.Context, _ uint64, opts models.IncomingOptions) (<-chan *models.TestCase, error)

func (*Hooks) SendAppPid

func (h *Hooks) SendAppPid(pid uint32) error

SendAppPid sends the application's process ID (PID) to the kernel. This function is used when running Keploy tests along with unit tests of the application.

func (*Hooks) SendCmdType

func (h *Hooks) SendCmdType(isDocker bool) error

func (*Hooks) SendDNSPort

func (h *Hooks) SendDNSPort(port uint32) error

func (*Hooks) SendInode

func (h *Hooks) SendInode(_ context.Context, _ uint64, inode uint64) error

SendInode sends the inode of the container to ebpf hooks to filter the network traffic

func (*Hooks) SendKeployPid

func (h *Hooks) SendKeployPid(pid uint32) error

func (*Hooks) SendKeployPids

func (h *Hooks) SendKeployPids(key models.ModeKey, pid uint32) error

SendKeployPids is used to send keploy recordServer(key-0) or testServer(key-1) Pid to the ebpf program

func (*Hooks) SendKeployPorts

func (h *Hooks) SendKeployPorts(key models.ModeKey, port uint32) error

SendKeployPorts is used to send keploy recordServer(key-0) or testServer(key-1) Port to the ebpf program

func (*Hooks) SendNameSpaceID

func (h *Hooks) SendNameSpaceID(key uint32, inode uint64) error

SendNameSpaceID function is helpful when user application in running inside a docker container.

func (*Hooks) SendPassThroughPorts

func (h *Hooks) SendPassThroughPorts(filterPorts []uint) error

SendPassThroughPorts sends the destination ports of the server which should not be intercepted by keploy proxy.

func (*Hooks) SendProxyInfo

func (h *Hooks) SendProxyInfo(ip4, port uint32, ip6 [4]uint32) error

SendProxyInfo sends the IP and Port of the running proxy in the eBPF program.

func (*Hooks) SetKeployModeInKernel

func (h *Hooks) SetKeployModeInKernel(mode uint32) error

Directories

Path Synopsis
Package conn provides functionality for handling connections.
Package conn provides functionality for handling connections.
Package structs provides data structures for hooks.
Package structs provides data structures for hooks.

Jump to

Keyboard shortcuts

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