http2server

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2026 License: Apache-2.0 Imports: 23 Imported by: 0

README

http2server

http2server package is ported from github.com/VictoriaMetrics/VictoriaMetrics/lib/httpserver, with HTTP/2 support enabled. Only core features are preserved.

It would work as an experimental package for HTTP/2 support before it is included in the source.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Errorf

func Errorf(w http.ResponseWriter, r *http.Request, format string, args ...any)

Errorf writes formatted error message to w and to logger.

func GetQuotedRemoteAddr

func GetQuotedRemoteAddr(r *http.Request) string

GetQuotedRemoteAddr returns quoted remote address.

func GetRequestURI

func GetRequestURI(r *http.Request) string

GetRequestURI returns requestURI for r.

func Serve

func Serve(addr string, rh httpserver.RequestHandler, tlsConfig *tls.Config)

Serve starts an http server on the given addrs with the given optional rh.

By default, all the responses are transparently compressed, since egress traffic is usually expensive.

func Stop

func Stop(addrs []string) error

Stop stops the http server on the given addrs, which has been started via Serve func.

Types

type ErrorWithStatusCode

type ErrorWithStatusCode struct {
	Err        error
	StatusCode int
}

ErrorWithStatusCode is error with HTTP status code.

The given StatusCode is sent to client when the error is passed to Errorf.

func (*ErrorWithStatusCode) Error

func (e *ErrorWithStatusCode) Error() string

Error implements error interface.

func (*ErrorWithStatusCode) Unwrap

func (e *ErrorWithStatusCode) Unwrap() error

Unwrap returns e.Err.

This is used by standard errors package. See https://golang.org/pkg/errors

type ServeOptions

type ServeOptions struct{}

ServeOptions defines optional parameters for http server

Jump to

Keyboard shortcuts

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