Documentation ¶
Index ¶
- Constants
- Variables
- func ConvertIPToUint32(ipStr string) (uint32, error)
- func LogAny(value string) error
- func NewLocalDb(schemaMap map[string]map[string]string) (*localDb, error)
- func NewLocalDbSchema(tableAndIndexMap map[string]map[string]string) *memdb.DBSchema
- type Hook
- func (h *Hook) AppendMocks(m *models.Mock, ctx context.Context) error
- func (h *Hook) CleanProxyEntry(srcPort uint16)
- func (h *Hook) DeleteConfigMock(mock *models.Mock) (bool, error)
- func (h *Hook) DeleteTcsMock(mock *models.Mock) (bool, error)
- func (h *Hook) GetConfigMocks() ([]*models.Mock, error)
- func (h *Hook) GetDestinationInfo(srcPort uint16) (*structs.DestInfo, error)
- func (h *Hook) GetProxyPort() uint32
- func (h *Hook) GetTcsMocks() ([]*models.Mock, error)
- func (h *Hook) GetUserIP() string
- func (h *Hook) IsDockerRelatedCmd(cmd string) (bool, string)
- func (h *Hook) IsUsrAppTerminateInitiated() bool
- func (h *Hook) LaunchPerfBufferConsumers(connectionFactory *connection.Factory)
- func (h *Hook) LaunchUserApplication(appCmd, appContainer, appNetwork string, Delay uint64, ...) error
- func (h *Hook) LoadHooks(appCmd, appContainer string, pid uint32, ctx context.Context, ...) error
- func (h *Hook) PrintRedirectProxyMap()
- func (h *Hook) Recover(id int)
- func (h *Hook) ResetDeps() int
- func (h *Hook) SendAppPid(pid uint32) error
- func (h *Hook) SendKeployPid(kPid uint32) error
- func (h *Hook) SendKeployServerPort(port uint32) error
- func (h *Hook) SendNameSpaceId(key uint32, inode uint64) error
- func (h *Hook) SendPassThroughPorts(filterPorts []uint) error
- func (h *Hook) SendProxyInfo(ip4, port uint32, ip6 [4]uint32) error
- func (h *Hook) SetConfigMocks(m []*models.Mock) error
- func (h *Hook) SetKeployModeInKernel(mode uint32)
- func (h *Hook) SetProxyPort(port uint32)
- func (h *Hook) SetTcsMocks(m []*models.Mock) error
- func (h *Hook) Stop(forceStop bool)
- func (h *Hook) StopUserApplication()
Constants ¶
const ( // TODO : Remove hard-coded container & network name. KeployContainerName = "keploy-v2" KeployNetworkName = "keploy-network" )
Variables ¶
var ( ErrInterrupted = errors.New("exited with interrupt") ErrCommandError = errors.New("exited due to command error") ErrUnExpected = errors.New("an unexpected error occurred") ErrDockerError = errors.New("an error occurred while using docker client") ErrFailedUnitTest = errors.New("test failure occured when running keploy tests along with unit tests") )
Define custom error variables
var Emoji = "\U0001F430" + " Keploy:"
var PerfEventReaders []*perf.Reader
var RingEventReaders []*ringbuf.Reader
Functions ¶
func ConvertIPToUint32 ¶
ConvertIPToUint32 converts a string representation of an IPv4 address to a 32-bit integer.
func NewLocalDbSchema ¶
Types ¶
type Hook ¶
type Hook struct { platform.TestCaseDB // contains filtered or unexported fields }
func (*Hook) CleanProxyEntry ¶
func (*Hook) GetDestinationInfo ¶
GetDestinationInfo retrieves destination information associated with a source port.
func (*Hook) GetProxyPort ¶
func (*Hook) IsDockerRelatedCmd ¶
It checks if the cmd is related to docker or not, it also returns if its a docker compose file
func (*Hook) IsUsrAppTerminateInitiated ¶
func (*Hook) LaunchPerfBufferConsumers ¶
func (h *Hook) LaunchPerfBufferConsumers(connectionFactory *connection.Factory)
LaunchPerfBufferConsumers launches socket events
func (*Hook) LaunchUserApplication ¶
func (*Hook) LoadHooks ¶
func (h *Hook) LoadHooks(appCmd, appContainer string, pid uint32, ctx context.Context, filters *models.Filters) error
LoadHooks is used to attach the eBPF hooks into the linux kernel. Hooks are attached for outgoing and incoming network requests.
proxyPorts is used for redirecting outgoing network calls to the unoccupied proxy server.
$BPF_CLANG and $BPF_CFLAGS are set by the Makefile.
func (*Hook) PrintRedirectProxyMap ¶
func (h *Hook) PrintRedirectProxyMap()
// printing the whole map
func (*Hook) SendAppPid ¶
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 (*Hook) SendKeployPid ¶
func (*Hook) SendKeployServerPort ¶
SendKeployServerPort sends the keploy graphql server port to be filtered in the eBPF program.
func (*Hook) SendNameSpaceId ¶
This function is helpful when user application in running inside a docker container.
func (*Hook) SendPassThroughPorts ¶
SendPassThroughPorts sends the destination ports of the server which should not be intercepted by keploy proxy.
func (*Hook) SendProxyInfo ¶
This function sends the IP and Port of the running proxy in the eBPF program.
func (*Hook) SetKeployModeInKernel ¶
func (*Hook) SetProxyPort ¶
func (*Hook) StopUserApplication ¶
func (h *Hook) StopUserApplication()
StopUserApplication stops the user application