httpctx

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

httpctx package provides context keys for http server handlers.

Index

Constants

View Source
const KConn contextKey = "conn" // for assigning net.Conn to context
View Source
const KListener contextKey = "listener" // for assigning listener to context
View Source
const KUUID contextKey = "uuid" // for assigning UUID to context

Variables

This section is empty.

Functions

func GetAny

func GetAny[T any](ctx context.Context, tag any) (T, bool)

func GetConn

func GetConn(ctx context.Context) net.Conn

GetConn see also GetTCPConn and GetTLSConn

func GetListener

func GetListener(ctx context.Context) net.Listener

func GetTCPConn

func GetTCPConn(ctx context.Context) (*net.TCPConn, bool)

GetTCPConn same as GetConn but uses different type assertion

Example:

var _, isTcp = httpctx.GetTCPConn(ctx)

func GetTLSConn

func GetTLSConn(ctx context.Context) (*tls.Conn, bool)

GetTLSConn same as GetConn but uses different type assertion

Example:

var _, isTls = httpctx.GetTLSConn(ctx)

func GetUUID

func GetUUID(ctx context.Context) int

Types

This section is empty.

Jump to

Keyboard shortcuts

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