package http2
import (
"context"
"crypto/tls"
"errors"
"io"
"log"
"mime/multipart"
"net"
"net/http/internal"
"net/textproto"
"net/url"
"time"
)
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 (req *ClientRequest ) Clone () *ClientRequest {
return &ClientRequest {
Context : req .Context ,
Method : req .Method ,
URL : req .URL ,
Header : req .Header ,
Trailer : req .Trailer ,
Body : req .Body ,
Host : req .Host ,
GetBody : req .GetBody ,
ContentLength : req .ContentLength ,
Cancel : req .Cancel ,
Close : req .Close ,
ResTrailer : req .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
)
The pages are generated with Golds v0.8.7 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds .