proxy

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: 41 Imported by: 0

README

Proxy Package Documentation

This package includes modules that the hooks package utilizes to redirect the outgoing calls of the user API. This redirection is done with the aim to record or stub the outputs of dependency calls.

Documentation

Overview

Package proxy provides functionality for handling proxies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupCA

func SetupCA(ctx context.Context, logger *zap.Logger) error

SetupCA setups custom certificate authority to handle TLS connections

Types

type Conn

type Conn struct {
	net.Conn
	// contains filtered or unexported fields
}

func (*Conn) Read

func (c *Conn) Read(p []byte) (int, error)

type MockManager

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

func NewMockManager

func NewMockManager(filtered, unfiltered *TreeDb, logger *zap.Logger) *MockManager

func (*MockManager) DeleteFilteredMock

func (m *MockManager) DeleteFilteredMock(mock models.Mock) bool

func (*MockManager) DeleteUnFilteredMock

func (m *MockManager) DeleteUnFilteredMock(mock models.Mock) bool

func (*MockManager) FlagMockAsUsed

func (m *MockManager) FlagMockAsUsed(mock models.Mock) error

func (*MockManager) GetConsumedMocks

func (m *MockManager) GetConsumedMocks() []string

func (*MockManager) GetFilteredMocks

func (m *MockManager) GetFilteredMocks() ([]*models.Mock, error)

func (*MockManager) GetUnFilteredMocks

func (m *MockManager) GetUnFilteredMocks() ([]*models.Mock, error)

func (*MockManager) SetFilteredMocks

func (m *MockManager) SetFilteredMocks(mocks []*models.Mock)

func (*MockManager) SetUnFilteredMocks

func (m *MockManager) SetUnFilteredMocks(mocks []*models.Mock)

func (*MockManager) UpdateUnFilteredMock

func (m *MockManager) UpdateUnFilteredMock(old *models.Mock, new *models.Mock) bool

type Option

type Option struct {
	Port          uint32
	DNSPort       uint32
	MongoPassword string
}

Option provides a means to initiate the proxy based on user input.

type Proxy

type Proxy struct {
	IP4     string
	IP6     string
	Port    uint32
	DNSPort uint32

	DestInfo     core.DestInfo
	Integrations map[string]integrations.Integrations

	MockManagers sync.Map

	Listener net.Listener

	UDPDNSServer *dns.Server
	TCPDNSServer *dns.Server
	// contains filtered or unexported fields
}

func New

func New(logger *zap.Logger, info core.DestInfo, opts *config.Config) *Proxy

func (*Proxy) GetConsumedMocks

func (p *Proxy) GetConsumedMocks(_ context.Context, id uint64) ([]string, error)

GetConsumedMocks returns the consumed filtered mocks for a given app id

func (*Proxy) InitIntegrations

func (p *Proxy) InitIntegrations(_ context.Context) error

func (*Proxy) Mock

func (p *Proxy) Mock(_ context.Context, id uint64, opts models.OutgoingOptions) error

func (*Proxy) Record

func (p *Proxy) Record(_ context.Context, id uint64, mocks chan<- *models.Mock, opts models.OutgoingOptions) error

func (*Proxy) ServeDNS

func (p *Proxy) ServeDNS(w dns.ResponseWriter, r *dns.Msg)

func (*Proxy) SetMocks

func (p *Proxy) SetMocks(_ context.Context, id uint64, filtered []*models.Mock, unFiltered []*models.Mock) error

func (*Proxy) StartProxy

func (p *Proxy) StartProxy(ctx context.Context, opts core.ProxyOptions) error

func (*Proxy) StopProxyServer

func (p *Proxy) StopProxyServer(ctx context.Context)

type TreeDb

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

func NewTreeDb

func NewTreeDb(comparator func(a, b interface{}) int) *TreeDb

Directories

Path Synopsis
Package integrations provides functionality for integrating different types of services.
Package integrations provides functionality for integrating different types of services.
generic
Package generic provides functionality for decoding generic dependencies.
Package generic provides functionality for decoding generic dependencies.
grpc
Package grpc provides functionality for integrating with gRPC outgoing calls.
Package grpc provides functionality for integrating with gRPC outgoing calls.
http
Package http provides functionality for handling HTTP outgoing calls.
Package http provides functionality for handling HTTP outgoing calls.
mongo
Package mongo provides functionality for working with MongoDB outgoing calls.
Package mongo provides functionality for working with MongoDB outgoing calls.
mysql
Package mysql provides the MySQL integration.
Package mysql provides the MySQL integration.
mysql/recorder
Package recorder is used to record the MySQL traffic between the client and the server.
Package recorder is used to record the MySQL traffic between the client and the server.
mysql/replayer
Package replayer is used to mock the MySQL traffic between the client and the server.
Package replayer is used to mock the MySQL traffic between the client and the server.
mysql/utils
Package utils provides utility functions for MySQL packets
Package utils provides utility functions for MySQL packets
mysql/wire
Package wire provides encoding and decoding operation of MySQL packets.
Package wire provides encoding and decoding operation of MySQL packets.
mysql/wire/phase
Package phase contains the encoding and decoding functions for the different phases of the MySQL protocol.
Package phase contains the encoding and decoding functions for the different phases of the MySQL protocol.
mysql/wire/phase/conn
Package conn provides decoding and encoding of connection phase mysql packets
Package conn provides decoding and encoding of connection phase mysql packets
mysql/wire/phase/query
Package query provides functions to decode MySQL command phase packets.
Package query provides functions to decode MySQL command phase packets.
mysql/wire/phase/query/preparedstmt
Package preparedstmt provides functionality for decoding prepared statement packets.
Package preparedstmt provides functionality for decoding prepared statement packets.
mysql/wire/phase/query/rowscols
Package rowscols provides encoding and decoding of MySQL row & column packets.
Package rowscols provides encoding and decoding of MySQL row & column packets.
mysql/wire/phase/query/utility
Package utility provides encoding and decoding of utility command packets.
Package utility provides encoding and decoding of utility command packets.
postgres/v1
Package v1 provides functionality for decoding Postgres requests and responses.
Package v1 provides functionality for decoding Postgres requests and responses.
redis
Package redis is the decode point for the redis application.
Package redis is the decode point for the redis application.
scram
Package scram provides functionality for SCRAM authentication.
Package scram provides functionality for SCRAM authentication.
util
Package util provides utility functions for the integration package.
Package util provides utility functions for the integration package.
Package util provides utility functions for the proxy package.
Package util provides utility functions for the proxy package.

Jump to

Keyboard shortcuts

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