protocol

package
v0.3.0-rc1 Latest Latest
Warning

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

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

Documentation

Overview

Package protocol selects the HTTP protocol the server uses. Pass one of the constants to [tether.StatefulConfig].Protocol.

tether.Stateful(app, tether.StatefulConfig[State]{
    Protocol: protocol.HTTP2,
    // ...
})

The default is Auto, which detects the protocol from each request. Most applications should leave this unset.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Protocol

type Protocol int

Protocol identifies the HTTP protocol version. The framework uses this to adapt transport behaviour and emit appropriate warnings when the configured protocol doesn't match the wire protocol.

const (
	// Auto detects the protocol from each request via r.ProtoMajor.
	// If r.TLS is nil, assumes HTTP/1.1 (browsers require TLS for
	// HTTP/2). This is the default and correct for most deployments
	// where a reverse proxy handles protocol negotiation.
	Auto Protocol = iota + 1

	// HTTP1 indicates HTTP/1.1. Use this when running behind a
	// proxy that downgrades HTTP/2 to HTTP/1.1.
	HTTP1

	// HTTP2 indicates HTTP/2. Use this when serving HTTPS directly
	// or behind an HTTP/2-aware proxy.
	HTTP2

	// HTTP3 indicates HTTP/3 (QUIC). Reserved for future use - the
	// Go ecosystem does not yet have standard library support for
	// HTTP/3. When support lands, this constant enables
	// QUIC-specific features.
	HTTP3
)

func (Protocol) String

func (p Protocol) String() string

String returns a human-readable label for the protocol.

Jump to

Keyboard shortcuts

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