xnet

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AllowLocal = trace.AuthRequest
	AllowAny   = func(r *http.Request) (any, sensitive bool) { return true, true }
)

Functions

func HTTPHandler

func HTTPHandler(c *Contextor) http.HandlerFunc

HTTPHandler returns an HTTP handler that can be used to enable or disable the tracing.

func NewContext

func NewContext(ctx context.Context, tr Tracer) context.Context

NewContext returns a copy of the parent context and associates it with a Trace.

func Traces

func Traces(auth Authorizer) http.HandlerFunc

Traces returns an HTTP handler, which will respond with traces from the program.

The handler performs authorization by running auth.

Types

type Authorizer

type Authorizer func(r *http.Request) (any, sensitive bool)

Authorizer determines whether a specific request is permitted to load the /debug/requests or /debug/events pages.

type Contextor

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

Contextor is a context manager.

func NewContextor

func NewContextor() *Contextor

func (*Contextor) Disable

func (c *Contextor) Disable()

Disable disables the request tracing.

func (*Contextor) Enable

func (c *Contextor) Enable()

Enable enables the request tracing.

func (*Contextor) HTTPToContext

func (c *Contextor) HTTPToContext(family, title string) kithttp.RequestFunc

HTTPToContext returns an http RequestFunc that associates ctx with a Tracer.

type Tracer

type Tracer interface {
	trace.Trace
}

func FromContext

func FromContext(ctx context.Context) Tracer

FromContext returns the Trace bound to the context, if any.

func NewTracer

func NewTracer(family, title string) Tracer

NewTracer creates a real tracer.

Jump to

Keyboard shortcuts

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