driver

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2026 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GRPCStatusToHTTP = grpcStatusToHTTP

grpcStatusToHTTP maps a gRPC status code to an HTTP-like status code so the engine's error classifier and metrics work uniformly across all driver types.

OK(0)                 → 200
InvalidArgument(3)    → 400
OutOfRange(11)        → 400
Unauthenticated(16)   → 401
PermissionDenied(7)   → 403
NotFound(5)           → 404
AlreadyExists(6)      → 409
ResourceExhausted(8)  → 429
Unimplemented(12)     → 501
Unavailable(14)       → 503
DeadlineExceeded(4)   → 504
other                 → 500

GRPCStatusToHTTP is exported for testing.

Functions

This section is empty.

Types

type BrowserDriver

type BrowserDriver struct{}

BrowserDriver executes tasks using a headless Chrome browser via chromedp. Each Execute call spawns an isolated browser instance to avoid memory leaks.

func NewBrowserDriver

func NewBrowserDriver() *BrowserDriver

NewBrowserDriver creates a BrowserDriver.

func (*BrowserDriver) Execute

func (d *BrowserDriver) Execute(ctx context.Context, t task.Task) task.Result

Execute navigates to t.URL with a headless Chrome instance.

type DNSDriver

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

DNSDriver performs DNS lookups using the miekg/dns library.

func NewDNSDriver

func NewDNSDriver() *DNSDriver

NewDNSDriver creates a DNSDriver with a shared DNS client.

func (*DNSDriver) Execute

func (d *DNSDriver) Execute(ctx context.Context, t task.Task) task.Result

Execute performs a DNS query for t.URL using the configured resolver and record type.

type Driver

type Driver interface {
	Execute(ctx context.Context, t task.Task) task.Result
}

Driver executes a single task and returns a result.

type GRPCDriver added in v1.1.0

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

GRPCDriver executes unary gRPC requests. It uses server reflection to resolve request/response types so no .proto files are required at runtime. Connections and method descriptors are cached across calls.

URL format:

grpc://host:port/package.Service/Method   — plaintext
grpcs://host:port/package.Service/Method  — TLS

func NewGRPCDriver added in v1.1.0

func NewGRPCDriver() *GRPCDriver

NewGRPCDriver creates a GRPCDriver.

func (*GRPCDriver) Execute added in v1.1.0

func (d *GRPCDriver) Execute(ctx context.Context, t task.Task) task.Result

Execute performs the unary gRPC call described by t.

type HTTPDriver

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

HTTPDriver executes HTTP requests.

func NewHTTPDriver

func NewHTTPDriver() *HTTPDriver

NewHTTPDriver creates an HTTPDriver with a shared transport.

func (*HTTPDriver) Execute

func (d *HTTPDriver) Execute(ctx context.Context, t task.Task) task.Result

Execute performs the HTTP request described by t.

type WebSocketDriver

type WebSocketDriver struct{}

WebSocketDriver connects to a WebSocket endpoint, sends messages, and waits.

func NewWebSocketDriver

func NewWebSocketDriver() *WebSocketDriver

NewWebSocketDriver creates a WebSocketDriver.

func (*WebSocketDriver) Execute

func (d *WebSocketDriver) Execute(ctx context.Context, t task.Task) task.Result

Execute opens a WebSocket connection, sends configured messages, optionally waits for expected messages, then holds the connection for duration_s.

Jump to

Keyboard shortcuts

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