Documentation ¶
Index ¶
- Constants
- Variables
- func CopyResponse(w http.ResponseWriter, resp *http.Response) error
- func FixRequest(r *http.Request)
- func GetCacheKey(req *http.Request) string
- func GetValueFromContext[T any](ctx context.Context, key string) (ret T, ok bool)
- func IsIgnoredError(err error) bool
- func IsNetCancelError(err error) bool
- func IsRequestCachable(req *http.Request) bool
- func NewHttpClient(tr http.RoundTripper) *http.Client
- func NewLogger(name string) log.ContextLogger
- func NewPeekedConn(c net.Conn, r io.Reader) net.Conn
- func RandomString(length int) string
- func SpawnPprofServer(port int)
- func WrapCompressedReader(r io.Reader, encoding string) (io.ReadCloser, error)
- type AutoFallbackClient
- type Cleaner
- type Data
- type HTTPRequestDoer
- type PeekedConn
- type TTLCache
Constants ¶
View Source
const ( INFINITY = -1 DEFAULT = 0 )
Variables ¶
View Source
var ( DebugMode = false LogFactory log.Factory )
Functions ¶
func CopyResponse ¶
func CopyResponse(w http.ResponseWriter, resp *http.Response) error
func FixRequest ¶
func GetCacheKey ¶
func GetValueFromContext ¶
func IsIgnoredError ¶
func IsNetCancelError ¶
func IsRequestCachable ¶
func NewHttpClient ¶
func NewHttpClient(tr http.RoundTripper) *http.Client
func NewLogger ¶
func NewLogger(name string) log.ContextLogger
func RandomString ¶
func SpawnPprofServer ¶
func SpawnPprofServer(port int)
func WrapCompressedReader ¶
Types ¶
type AutoFallbackClient ¶
type AutoFallbackClient struct {
// contains filtered or unexported fields
}
use http2 first and fallback to http1.1 if failed
func NewAutoFallbackClient ¶
func NewAutoFallbackClient() *AutoFallbackClient
type HTTPRequestDoer ¶
type PeekedConn ¶
A peekedConn subverts the net.Conn.Read implementation, primarily so that sniffed bytes can be transparently prepended.
type TTLCache ¶
type TTLCache struct {
// contains filtered or unexported fields
}
func NewTTLCache ¶
Click to show internal directories.
Click to hide internal directories.