package http2
import (
)
var (
NoBody io.ReadCloser
LocalAddrContextKey any
)
var (
ErrAbortHandler = internal.ErrAbortHandler
ErrBodyNotAllowed = internal.ErrBodyNotAllowed
ErrNotSupported = errors.ErrUnsupported
ErrSkipAltProtocol = internal.ErrSkipAltProtocol
)
type ClientRequest struct {
Context context.Context
Method string
URL *url.URL
Header Header
Trailer Header
Body io.ReadCloser
Host string
GetBody func() (io.ReadCloser, error)
ContentLength int64
Cancel <-chan struct{}
Close bool
ResTrailer *Header
stream clientStream
}
func ( *ClientRequest) () *ClientRequest {
return &ClientRequest{
Context: .Context,
Method: .Method,
URL: .URL,
Header: .Header,
Trailer: .Trailer,
Body: .Body,
Host: .Host,
GetBody: .GetBody,
ContentLength: .ContentLength,
Cancel: .Cancel,
Close: .Close,
ResTrailer: .ResTrailer,
}
}
type ClientResponse struct {
Status string
StatusCode int
ContentLength int64
Uncompressed bool
Header Header
Trailer Header
Body io.ReadCloser
TLS *tls.ConnectionState
}
type Header = textproto.MIMEHeader
type TransportConfig interface {
MaxHeaderListSize() int64
MaxResponseHeaderBytes() int64
DisableCompression() bool
DisableKeepAlives() bool
ExpectContinueTimeout() time.Duration
ResponseHeaderTimeout() time.Duration
IdleConnTimeout() time.Duration
HTTP2Config() Config
}
type ServerConfig interface {
MaxHeaderBytes() int
MaxHeaderValueCount() int
ConnState(net.Conn, ConnState)
DoKeepAlives() bool
WriteTimeout() time.Duration
SendPingTimeout() time.Duration
ErrorLog() *log.Logger
ReadTimeout() time.Duration
HTTP2Config() Config
DisableClientPriority() bool
IdleTimeout() time.Duration
}
type Handler interface {
ServeHTTP(*ResponseWriter, *ServerRequest)
}
type ResponseWriter = responseWriter
type PushOptions struct {
Method string
Header Header
}
type ServerRequest struct {
Context context.Context
Proto string
ProtoMajor int
ProtoMinor int
Method string
URL *url.URL
Header Header
Trailer Header
Body io.ReadCloser
Host string
ContentLength int64
RemoteAddr string
RequestURI string
TLS *tls.ConnectionState
MultipartForm *multipart.Form
}
type ConnState int
const (
ConnStateNew ConnState = iota
ConnStateActive
ConnStateIdle
ConnStateHijacked
ConnStateClosed
)