connection

package
v2.0.0-alpha56 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

README

Connection Package Documentation

This package contains the events that are triggered during the ingress call, capturing both the input and output of the user API call.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Emoji = "\U0001F430" + " Keploy:"

Functions

func ConvertUnixNanoToTime

func ConvertUnixNanoToTime(unixNano uint64) time.Time

ConvertUnixNanoToTime takes a Unix timestamp in nanoseconds as a uint64 and returns the corresponding time.Time

Types

type Factory

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

Factory is a routine-safe container that holds a trackers with unique ID, and able to create new tracker.

func NewFactory

func NewFactory(inactivityThreshold time.Duration, logger *zap.Logger) *Factory

NewFactory creates a new instance of the factory.

func (*Factory) GetOrCreate

func (factory *Factory) GetOrCreate(connectionID structs.ConnID) *Tracker

GetOrCreate returns a tracker that related to the given connection and transaction ids. If there is no such tracker we create a new one.

func (*Factory) HandleReadyConnections

func (factory *Factory) HandleReadyConnections(db platform.TestCaseDB, ctx context.Context, filters *models.Filters)

type Tracker

type Tracker struct {
	SentBuf []byte
	RecvBuf []byte
	// contains filtered or unexported fields
}

func NewTracker

func NewTracker(connID structs2.ConnID, logger *zap.Logger) *Tracker

func (*Tracker) AddCloseEvent

func (conn *Tracker) AddCloseEvent(event structs2.SocketCloseEvent)

func (*Tracker) AddDataEvent

func (conn *Tracker) AddDataEvent(event structs2.SocketDataEvent)

func (*Tracker) AddOpenEvent

func (conn *Tracker) AddOpenEvent(event structs2.SocketOpenEvent)

func (*Tracker) IsComplete

func (conn *Tracker) IsComplete() (bool, []byte, []byte, time.Time, time.Time)

IsComplete() checks if the current connection has valid request & response info to capture and also returns the request and response data buffer.

func (*Tracker) IsInactive

func (conn *Tracker) IsInactive(duration time.Duration) bool

func (*Tracker) ToBytes

func (conn *Tracker) ToBytes() ([]byte, []byte)

func (*Tracker) UpdateTimestamps

func (conn *Tracker) UpdateTimestamps()

Jump to

Keyboard shortcuts

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