handler

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetNodeID

func GetNodeID(ctx context.Context) string

GetNodeID returns the node ID of the client

func GetRemoteAddr

func GetRemoteAddr(ctx context.Context) string

GetRemoteAddr returns the remote address of the client

func GetUserID added in v0.1.10

func GetUserID(ctx context.Context) string

GetUserID returns the user ID of the client

func New

func New(verify func(ctx context.Context, token string) (*types.JWTPayload, error), next http.HandlerFunc) http.Handler

New returns a new HTTP handler with the given auth handler and additional request context fields

Types

type Handler

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

Handler represents an HTTP handler that also adds remote client address and node ID to the request context

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves an HTTP request with the added client remote address and node ID in the request context

type ID added in v0.1.10

type ID struct{}

user id (node id)

type RemoteAddr

type RemoteAddr struct{}

RemoteAddr client address

Jump to

Keyboard shortcuts

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