grpcattack

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2026 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveMethod

func ResolveMethod(cfg *Config, conn *grpc.ClientConn) (protoreflect.MethodDescriptor, error)

ResolveMethod returns the MethodDescriptor for the configured service/method. It loads from a .proto file when cfg.ProtoFile is set; otherwise it queries the server's reflection service using the provided connection.

func RunAttack

func RunAttack(cfg *Config, stopCh chan struct{}, metrics *attack.GlobalMetrics) (*attack.GlobalMetrics, time.Duration, error)

RunAttack runs a gRPC unary load test and returns the collected metrics. It accepts a pre-created metrics object so the server can stream live updates.

Types

type Config

type Config struct {
	// Target is the gRPC server address in host:port format.
	Target string

	// Service is the fully qualified service name, e.g. "helloworld.Greeter".
	Service string

	// Method is the RPC method name, e.g. "SayHello".
	Method string

	// ProtoFile is an optional path to a .proto source file.
	// When empty, server reflection is used instead.
	ProtoFile string

	// Data is the JSON-encoded request payload. Defaults to "{}".
	Data string

	// Metadata is a list of "key:value" strings sent as gRPC metadata.
	Metadata []string

	// Insecure disables TLS verification (useful for local testing).
	Insecure bool

	// CACert is an optional path to a PEM-encoded CA certificate for TLS.
	CACert string

	Duration    time.Duration
	Timeout     time.Duration
	Workers     uint
	Connections uint // number of gRPC channels in the pool
	RPS         int
	Output      string
}

Config holds all parameters for a gRPC load test.

Jump to

Keyboard shortcuts

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