rkmid

package
v2.2.3 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2022 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

View Source
const (
	HeaderAuthorization                   = "authorization"
	HeaderApiKey                          = "X-API-Key"
	HeaderRequestId                       = "X-Request-Id"
	HeaderTraceId                         = "X-Trace-Id"
	HeaderOrigin                          = "Origin"
	HeaderAccessControlAllowOrigin        = "Access-Control-Allow-Origin"
	HeaderAccessControlAllowCredentials   = "Access-Control-Allow-Credentials"
	HeaderAccessControlExposeHeaders      = "Access-Control-Expose-Headers"
	HeaderVary                            = "Vary"
	HeaderAccessControlRequestMethod      = "Access-Control-Request-Method"
	HeaderAccessControlRequestHeaders     = "Access-Control-Request-Headers"
	HeaderAccessControlAllowMethods       = "Access-Control-Allow-Methods"
	HeaderAccessControlAllowHeaders       = "Access-Control-Allow-Headers"
	HeaderAccessControlMaxAge             = "Access-Control-Max-Age"
	HeaderContentEncoding                 = "Content-Encoding"
	HeaderContentLength                   = "Content-Length"
	HeaderContentType                     = "Content-Type"
	HeaderAcceptEncoding                  = "Accept-Encoding"
	HeaderXXSSProtection                  = "X-Xss-Protection"
	HeaderXContentTypeOptions             = "X-Content-Type-Options"
	HeaderXFrameOptions                   = "X-Frame-Options"
	HeaderXForwardedProto                 = "X-Forwarded-Proto"
	HeaderStrictTransportSecurity         = "Strict-Transport-Security"
	HeaderContentSecurityPolicyReportOnly = "Content-Security-Policy-Report-Only"
	HeaderContentSecurityPolicy           = "Content-Security-Policy"
	HeaderReferrerPolicy                  = "Referrer-Policy"
	HeaderXCSRFToken                      = "X-CSRF-Token"
	HeaderCookie                          = "Cookie"
)

Variables

View Source
var (
	EntryNameKey      = &entryNameKey{}
	EntryTypeKey      = &entryTypeKey{}
	EventKey          = &eventKey{}
	LoggerKey         = &loggerKey{}
	TracerKey         = &tracerKey{}
	SpanKey           = &spanKey{}
	TracerProviderKey = &tracerProviderKey{}
	PropagatorKey     = &propagatorKey{}
	JwtTokenKey       = &jwtTokenKey{}
	CsrfTokenKey      = &csrfTokenKey{}

	// Domain environment variable
	Domain = zap.String("domain", getEnvValueOrDefault("DOMAIN", "*"))
	// LocalIp read local IP from localhost
	LocalIp = zap.String("localIp", getLocalIP())
	// LocalHostname read hostname from localhost
	LocalHostname = zap.String("localHostname", getLocalHostname())
)

Functions

func AddPathToIgnoreGlobal

func AddPathToIgnoreGlobal(prefix ...string)

func GenerateRequestId

func GenerateRequestId() string

GenerateRequestId generate request id based on google/uuid. UUIDs are based on RFC 4122 and DCE 1.1: Authentication and Security Services.

A UUID is a 16 byte (128 bit) array. UUIDs may be used as keys to maps or compared directly.

func GenerateRequestIdWithPrefix

func GenerateRequestIdWithPrefix(prefix string) string

GenerateRequestIdWithPrefix generate request id based on google/uuid. UUIDs are based on RFC 4122 and DCE 1.1: Authentication and Security Services.

A UUID is a 16 byte (128 bit) array. UUIDs may be used as keys to maps or compared directly.

func GetErrorBuilder

func GetErrorBuilder() rkerror.ErrorBuilder

func GetRemoteAddressSet

func GetRemoteAddressSet(req *http.Request) (remoteIp, remotePort string)

GetRemoteAddressSet returns remote endpoint information set including IP, Port. We will do as best as we can to determine it. If fails, then just return default ones.

func SetErrorBuilder

func SetErrorBuilder(builder rkerror.ErrorBuilder)

func ShouldIgnoreGlobal

func ShouldIgnoreGlobal(urlPath string) bool

Types

This section is empty.

Directories

Path Synopsis
Package rkmidauth provide auth related options
Package rkmidauth provide auth related options
Package rkmidcors provide cors related options
Package rkmidcors provide cors related options
Package rkmidcsrf provide auth related options
Package rkmidcsrf provide auth related options
Package rkmidjwt is a middleware for JWT
Package rkmidjwt is a middleware for JWT
Package rkmidlog provide options
Package rkmidlog provide options
Package rkmidmeta is a middleware for metadata
Package rkmidmeta is a middleware for metadata
Package rkmidpanic provide options
Package rkmidpanic provide options
Package rkmidprom has a couple of utility functions to start prometheus and pushgateway client locally.
Package rkmidprom has a couple of utility functions to start prometheus and pushgateway client locally.
Package rkmidlimit provide options
Package rkmidlimit provide options
Package rkmidsec provide auth related options
Package rkmidsec provide auth related options
Package rkmidtimeout provide options
Package rkmidtimeout provide options
Package rkmidtrace is a middleware for recording tracing
Package rkmidtrace is a middleware for recording tracing

Jump to

Keyboard shortcuts

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