http

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2022 License: MIT Imports: 14 Imported by: 0

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 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
}

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