core

package
v2.2.0-alpha29 Latest Latest
Warning

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

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

Documentation

Overview

Package core provides functionality for managing core functionalities in Keploy.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPortToSendToKernel

func GetPortToSendToKernel(_ context.Context, rules []config.BypassRule) []uint

Types

type App

type App interface {
	Setup(ctx context.Context, opts app.Options) error
	Run(ctx context.Context, inodeChan chan uint64, opts app.Options) error
	Kind(ctx context.Context) utils.CmdType
	KeployIPv4Addr() string
}

type AppInfo

type AppInfo interface {
	SendInode(ctx context.Context, id uint64, inode uint64) error
}

type Core

type Core struct {
	Proxy  // embedding the Proxy interface to transfer the proxy methods to the core object
	Hooks  // embedding the Hooks interface to transfer the hooks methods to the core object
	Tester // embedding the Tester interface to transfer the tester methods to the core object
	// contains filtered or unexported fields
}

func New

func New(logger *zap.Logger, hook Hooks, proxy Proxy, tester Tester, client docker.Client) *Core

func (*Core) GetContainerIP

func (c *Core) GetContainerIP(_ context.Context, id uint64) (string, error)

func (*Core) GetIncoming

func (c *Core) GetIncoming(ctx context.Context, id uint64, opts models.IncomingOptions) (<-chan *models.TestCase, error)

func (*Core) GetOutgoing

func (c *Core) GetOutgoing(ctx context.Context, id uint64, opts models.OutgoingOptions) (<-chan *models.Mock, error)

func (*Core) Hook

func (c *Core) Hook(ctx context.Context, id uint64, opts models.HookOptions) error

func (*Core) MockOutgoing

func (c *Core) MockOutgoing(ctx context.Context, id uint64, opts models.OutgoingOptions) error

func (*Core) Run

func (*Core) Setup

func (c *Core) Setup(ctx context.Context, cmd string, opts models.SetupOptions) (uint64, error)

type DestInfo

type DestInfo interface {
	Get(ctx context.Context, srcPort uint16) (*NetworkAddress, error)
	Delete(ctx context.Context, srcPort uint16) error
}

type HookCfg

type HookCfg struct {
	AppID      uint64
	Pid        uint32
	IsDocker   bool
	KeployIPV4 string
	Mode       models.Mode
}

type Hooks

type Hooks interface {
	AppInfo
	DestInfo
	OutgoingInfo
	TestBenchInfo
	Load(ctx context.Context, id uint64, cfg HookCfg) error
	Record(ctx context.Context, id uint64, opts models.IncomingOptions) (<-chan *models.TestCase, error)
}

type NetworkAddress

type NetworkAddress struct {
	AppID    uint64
	Version  uint32
	IPv4Addr uint32
	IPv6Addr [4]uint32
	Port     uint32
}

type OutgoingInfo

type OutgoingInfo interface {
	PassThroughPortsInKernel(ctx context.Context, id uint64, ports []uint) error
}

type Proxy

type Proxy interface {
	StartProxy(ctx context.Context, opts ProxyOptions) error
	Record(ctx context.Context, id uint64, mocks chan<- *models.Mock, opts models.OutgoingOptions) error
	Mock(ctx context.Context, id uint64, opts models.OutgoingOptions) error
	SetMocks(ctx context.Context, id uint64, filtered []*models.Mock, unFiltered []*models.Mock) error
	GetConsumedMocks(ctx context.Context, id uint64) ([]string, error)
}

Proxy listens on all available interfaces and forwards traffic to the destination

type ProxyOptions

type ProxyOptions struct {
	// DNSIPv4Addr is the proxy IP returned by the DNS server. default is loopback address
	DNSIPv4Addr string
	// DNSIPv6Addr is the proxy IP returned by the DNS server. default is loopback address
	DNSIPv6Addr string
}

type Session

type Session struct {
	ID   uint64
	Mode models.Mode
	TC   chan<- *models.TestCase
	MC   chan<- *models.Mock
	models.OutgoingOptions
}

type Sessions

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

func NewSessions

func NewSessions() *Sessions

func (*Sessions) Delete

func (s *Sessions) Delete(id uint64)

func (*Sessions) Get

func (s *Sessions) Get(id uint64) (*Session, bool)

func (*Sessions) GetAllMC

func (s *Sessions) GetAllMC() []chan<- *models.Mock

func (*Sessions) Set

func (s *Sessions) Set(id uint64, session *Session)

type TestBenchInfo

type TestBenchInfo interface {
	SendKeployPids(key models.ModeKey, pid uint32) error
	SendKeployPorts(key models.ModeKey, port uint32) error
}

type Tester

type Tester interface {
	Setup(ctx context.Context, opts models.TestingOptions) error
}

Directories

Path Synopsis
Package app provides functionality for managing applications.
Package app provides functionality for managing applications.
Package hooks provides functionality for managing hooks.
Package hooks provides functionality for managing hooks.
conn
Package conn provides functionality for handling connections.
Package conn provides functionality for handling connections.
structs
Package structs provides data structures for hooks.
Package structs provides data structures for hooks.
Package proxy provides functionality for handling proxies.
Package proxy provides functionality for handling proxies.
integrations
Package integrations provides functionality for integrating different types of services.
Package integrations provides functionality for integrating different types of services.
integrations/generic
Package generic provides functionality for decoding generic dependencies.
Package generic provides functionality for decoding generic dependencies.
integrations/grpc
Package grpc provides functionality for integrating with gRPC outgoing calls.
Package grpc provides functionality for integrating with gRPC outgoing calls.
integrations/http
Package http provides functionality for handling HTTP outgoing calls.
Package http provides functionality for handling HTTP outgoing calls.
integrations/mongo
Package mongo provides functionality for working with MongoDB outgoing calls.
Package mongo provides functionality for working with MongoDB outgoing calls.
integrations/mysql
Package mysql provides integration with MySQL outgoing.
Package mysql provides integration with MySQL outgoing.
integrations/postgres/v1
Package v1 provides functionality for decoding Postgres requests and responses.
Package v1 provides functionality for decoding Postgres requests and responses.
integrations/redis
Package redis is the decode point for the redis application.
Package redis is the decode point for the redis application.
integrations/scram
Package scram provides functionality for SCRAM authentication.
Package scram provides functionality for SCRAM authentication.
integrations/util
Package util provides utility functions for the integration package.
Package util provides utility functions for the integration package.
util
Package util provides utility functions for the proxy package.
Package util provides utility functions for the proxy package.
Package tester provides functionality for testing keploy with itself
Package tester provides functionality for testing keploy with itself

Jump to

Keyboard shortcuts

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