http2

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package http2 implements a protocol.Protocol driver that speaks HTTP/2, over TLS (the normal case, negotiated via ALPN) or over plain TCP ("h2c") when the target is an http:// URL — many internal services run h2c precisely to skip TLS termination, and a load tester that only understood h2-over-TLS would be unable to test them at all.

Go's standard net/http client only ever negotiates HTTP/2 via TLS, so this driver is built directly on golang.org/x/net/http2's Transport instead of net/http's default one — that is the whole reason this package exists separately from http1.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Driver

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

Driver is an HTTP/2 protocol.Protocol.

func New

func New(target protocol.Target, timeout time.Duration) (*Driver, error)

New returns a ready-to-use Driver for target. timeout bounds each individual request. New returns an error only if target.URL cannot be parsed at all — a malformed scheme or host is a configuration problem, not a per-request failure.

func (*Driver) Close

func (d *Driver) Close() error

Close implements protocol.Protocol.

func (*Driver) Do

func (d *Driver) Do(ctx context.Context) (protocol.Result, error)

Do implements protocol.Protocol.

func (*Driver) Name

func (d *Driver) Name() string

Name implements protocol.Protocol.

Jump to

Keyboard shortcuts

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