http

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2023 License: MIT Imports: 15 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeJSON added in v0.3.0

func DecodeJSON(req *http.Request, obj interface{}) error

func NewClient

func NewClient(cfg *ClientConfig) (*http.Client, error)

New creates a new HTTP client

func NewTransport

func NewTransport(cfg *TransportConfig) (*http.Transport, error)

NewTransport creates a http.Transport

func ParseQuery added in v0.3.0

func ParseQuery(req *http.Request, obj interface{}) error

func WriteError added in v0.3.0

func WriteError(rw http.ResponseWriter, statusCode int, err error)

func WriteJSON added in v0.3.0

func WriteJSON(rw http.ResponseWriter, statusCode int, data interface{}) error

Types

type ClientConfig

type ClientConfig struct {
	Transport *TransportConfig    `json:"transport,omitempty"`
	Timeout   *kilntypes.Duration `json:"timeout,omitempty"`
}

Config for creating an HTTP Client

func (*ClientConfig) SetDefault

func (cfg *ClientConfig) SetDefault() *ClientConfig

type ConnStateCallbackTypeWrapper added in v0.4.0

type ConnStateCallbackTypeWrapper func(net.Conn, http.ConnState)

func (ConnStateCallbackTypeWrapper) MarshalJSON added in v0.4.0

func (c ConnStateCallbackTypeWrapper) MarshalJSON() ([]byte, error)

type ErrorRespMsg added in v0.3.3

type ErrorRespMsg struct {
	Message string `json:"message" example:"error message"`
	Code    string `json:"status,omitempty" example:"IR001"`

} // @name Error

type Server added in v0.3.0

type Server struct {
	// contains filtered or unexported fields
}

func NewServer added in v0.3.0

func NewServer(cfg *ServerConfig) (*Server, error)

func (*Server) Done added in v0.3.0

func (s *Server) Done() chan struct{}

func (*Server) Error added in v0.3.0

func (s *Server) Error() error

func (*Server) Logger added in v0.3.0

func (s *Server) Logger() logrus.FieldLogger

func (*Server) SetHandler added in v0.3.0

func (s *Server) SetHandler(h http.Handler) *Server

func (*Server) SetLogger added in v0.3.0

func (s *Server) SetLogger(logger logrus.FieldLogger)

func (*Server) Start added in v0.3.0

func (s *Server) Start(ctx context.Context) error

func (*Server) Stop added in v0.3.0

func (s *Server) Stop(ctx context.Context) error

type ServerConfig added in v0.3.0

type ServerConfig struct {
	Entrypoint *kilnnet.EntrypointConfig

	ReadTimeout       *types.Duration
	ReadHeaderTimeout *types.Duration

	WriteTimeout *types.Duration

	IdleTimeout *types.Duration

	MaxHeaderBytes *int

	ConnStateCallback ConnStateCallbackTypeWrapper
}

func (*ServerConfig) SetDefault added in v0.3.0

func (cfg *ServerConfig) SetDefault() *ServerConfig

type ServerFlagPrefixer added in v0.3.1

type ServerFlagPrefixer struct {
	// contains filtered or unexported fields
}

func NewServerFlagPrefixer added in v0.3.1

func NewServerFlagPrefixer(name, defaultAddr string) ServerFlagPrefixer

func (*ServerFlagPrefixer) ConfigFromViper added in v0.3.1

func (fl *ServerFlagPrefixer) ConfigFromViper(v *viper.Viper) *ServerConfig

func (*ServerFlagPrefixer) Flags added in v0.3.1

func (fl *ServerFlagPrefixer) Flags(v *viper.Viper, f *pflag.FlagSet)

type TransportConfig

type TransportConfig struct {
	Dialer                *kilnnet.DialerConfig
	IdleConnTimeout       *kilntypes.Duration
	ResponseHeaderTimeout *kilntypes.Duration
	ExpectContinueTimeout *kilntypes.Duration
	MaxIdleConnsPerHost   int
	MaxConnsPerHost       int
	DisableKeepAlives     bool
	DisableCompression    bool
	EnableHTTP2           bool

	TLS *kilntls.Config
}

TransportConfig options to configure communication between Traefik and the servers

func (*TransportConfig) SetDefault

func (cfg *TransportConfig) SetDefault() *TransportConfig

Directories

Path Synopsis
Package httptestutils is a generated GoMock package.
Package httptestutils is a generated GoMock package.

Jump to

Keyboard shortcuts

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