http_transport

package
v0.2.19 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyTracingToHTTPClient

func ApplyTracingToHTTPClient(cli *http.Client)

ApplyTracingToHTTPClient propagate tracing.ID and X-Request-ID on exists http.Client.

func BasicAuthHandler added in v0.2.14

func BasicAuthHandler(next http.Handler, cfg BasicAuthConfig) http.Handler

func TracingMiddleware

func TracingMiddleware(handler http.Handler, opts ...otelhttp.Option) http.Handler

TracingMiddleware wraps the passed http.Handler, functioning like middleware, in a span named after the operation and with any provided Options.

func TracingMiddlewareFunc

func TracingMiddlewareFunc(handler http.HandlerFunc, opts ...otelhttp.Option) http.Handler

HTTPTracingMiddlewareFunc wraps the passed http.HandlerFunc, functioning like middleware, in a span named after the operation and with any provided Options.

Types

type BasicAuthConfig added in v0.2.14

type BasicAuthConfig struct {
	Enabled  bool   `default:"false" usage:"allows to enable basic auth"`
	Username string `usage:"auth username"`
	Password string `usage:"auth password"`
}

type Config

type Config struct {
	Enabled bool   `default:"false" usage:"allows to enable http server" example:"true"`
	Address string `default:":8080" validate:"required,hostname_port" usage:"HTTP server listen address" example:"localhost:9000"`
	Network string `default:"tcp" validate:"required" usage:"HTTP server listen network: tpc/udp" example:"tcp"`
	NoTrace bool   `yaml:"no_trace" default:"false" usage:"allows to disable tracing for HTTP server" example:"false"`
}

Config provides configuration for http server.

type HttpServer added in v0.2.13

type HttpServer struct {
	Config
	// contains filtered or unexported fields
}

func NewServer

func NewServer(opts ...Option) *HttpServer

NewServer creates http server.

func (HttpServer) Enabled added in v0.2.13

func (s HttpServer) Enabled() bool

Enabled returns is service enabled.

func (HttpServer) Name added in v0.2.13

func (s HttpServer) Name() string

Name returns name of http server.

func (*HttpServer) Start added in v0.2.13

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

Start allows starting http server.

func (*HttpServer) Stop added in v0.2.13

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

Stop allows stop http server.

type Option

type Option func(*HttpServer)

Option allows customizing http component settings.

func WithConfig

func WithConfig(v Config) Option

WithConfig allows set custom http settings.

func WithHandler

func WithHandler(v http.Handler) Option

WithHandler allows set custom http.Handler value.

func WithLogger

func WithLogger(v logger.ExtendedLogger) Option

WithLogger allows set custom logger value.

func WithName

func WithName(v string) Option

WithName allows set custom http name value.

Jump to

Keyboard shortcuts

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