netext

package
v0.0.0-...-29e7bc9 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OCSP_STATUS_GOOD                   = "good"
	OCSP_STATUS_REVOKED                = "revoked"
	OCSP_STATUS_SERVER_FAILED          = "server_failed"
	OCSP_STATUS_UNKNOWN                = "unknown"
	OCSP_REASON_UNSPECIFIED            = "unspecified"
	OCSP_REASON_KEY_COMPROMISE         = "key_compromise"
	OCSP_REASON_CA_COMPROMISE          = "ca_compromise"
	OCSP_REASON_AFFILIATION_CHANGED    = "affiliation_changed"
	OCSP_REASON_SUPERSEDED             = "superseded"
	OCSP_REASON_CESSATION_OF_OPERATION = "cessation_of_operation"
	OCSP_REASON_CERTIFICATE_HOLD       = "certificate_hold"
	OCSP_REASON_REMOVE_FROM_CRL        = "remove_from_crl"
	OCSP_REASON_PRIVILEGE_WITHDRAWN    = "privilege_withdrawn"
	OCSP_REASON_AA_COMPROMISE          = "aa_compromise"
	TLS_1_0                            = "tls1.0"
	TLS_1_1                            = "tls1.1"
	TLS_1_2                            = "tls1.2"
	TLS_1_3                            = "tls1.3"
)

Variables

This section is empty.

Functions

func ParseTLSConnState

func ParseTLSConnState(tlsState *tls.ConnectionState) (TLSInfo, OCSP)

Types

type BlackListedIPError

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

BlackListedIPError is an error that is returned when a given IP is blacklisted

func (BlackListedIPError) Error

func (b BlackListedIPError) Error() string

type BlockedHostError

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

BlockedHostError is returned when a given hostname is blocked

func (BlockedHostError) Error

func (b BlockedHostError) Error() string

type Conn

type Conn struct {
	net.Conn

	BytesRead, BytesWritten *int64
}

Conn wraps net.Conn and keeps track of sent and received data size

func (*Conn) Read

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

func (*Conn) Write

func (c *Conn) Write(b []byte) (int, error)

type Dialer

type Dialer struct {
	net.Dialer

	Resolver         Resolver
	Blacklist        []*lib.IPNet
	BlockedHostnames *types.HostnameTrie
	Hosts            *types.Hosts

	BytesRead    int64
	BytesWritten int64
}

Dialer wraps net.Dialer and provides k6 specific functionality - tracing, blacklists and DNS cache and aliases.

func NewDialer

func NewDialer(dialer net.Dialer, resolver Resolver) *Dialer

NewDialer constructs a new Dialer with the given DNS resolver.

func (*Dialer) DialContext

func (d *Dialer) DialContext(ctx context.Context, proto, addr string) (net.Conn, error)

DialContext wraps the net.Dialer.DialContext and handles the k6 specifics

func (*Dialer) GetTrail

func (d *Dialer) GetTrail(
	startTime, endTime time.Time, fullIteration bool, emitIterations bool, ctm metrics.TagsAndMeta,
	builtinMetrics *metrics.BuiltinMetrics,
) *NetTrail

GetTrail creates a new NetTrail instance with the Dialer sent and received data metrics and the supplied times and tags. TODO: Refactor this according to https://github.com/k6io/k6/pull/1203#discussion_r337938370

type MultiResolver

type MultiResolver func(host string) ([]net.IP, error)

MultiResolver returns all IP addresses for the given host.

type NetTrail

type NetTrail struct {
	BytesRead     int64
	BytesWritten  int64
	FullIteration bool
	StartTime     time.Time
	EndTime       time.Time
	Tags          *metrics.TagSet
	Samples       []metrics.Sample
}

NetTrail contains information about the exchanged data size and length of a series of connections from a particular netext.Dialer

func (*NetTrail) GetSamples

func (ntr *NetTrail) GetSamples() []metrics.Sample

GetSamples implements the metrics.SampleContainer interface.

func (*NetTrail) GetTags

func (ntr *NetTrail) GetTags() *metrics.TagSet

GetTags implements the metrics.ConnectedSampleContainer interface.

func (*NetTrail) GetTime

func (ntr *NetTrail) GetTime() time.Time

GetTime implements the metrics.ConnectedSampleContainer interface.

type OCSP

type OCSP struct {
	ProducedAt       int64  `json:"produced_at"`
	ThisUpdate       int64  `json:"this_update"`
	NextUpdate       int64  `json:"next_update"`
	RevokedAt        int64  `json:"revoked_at"`
	RevocationReason string `json:"revocation_reason"`
	Status           string `json:"status"`
}

type Resolver

type Resolver interface {
	LookupIP(host string) (net.IP, error)
}

Resolver is an interface that returns DNS information about a given host.

func NewResolver

func NewResolver(
	actRes MultiResolver, ttl time.Duration, sel types.DNSSelect, pol types.DNSPolicy,
) Resolver

NewResolver returns a new DNS resolver. If ttl is not 0, responses will be cached per host for the specified period. The IP returned from LookupIP() will be selected based on the given sel and pol values.

type TLSInfo

type TLSInfo struct {
	Version     string
	CipherSuite string
}

Directories

Path Synopsis
Package grpcext allows gRPC requests collecting stats info.
Package grpcext allows gRPC requests collecting stats info.

Jump to

Keyboard shortcuts

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