headerpkg

package
v0.3.22 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: Apache-2.0 Imports: 2 Imported by: 8

Documentation

Index

Constants

View Source
const (
	RequestID     = "x-kit-request-id"    // http请求id
	TraceID       = "x-kit-trace-id"      // trace-id
	InternalToken = "x-kit-authorization" // 内部令牌
	IsWebsocket   = "x-kit-websocket"     // http请求设置
	RemoteAddr    = "x-kit-remote-addr"   // 远程地址
	UserTerminal  = "x-kit-user-terminal" // 使用终端、平台

	// AuthorizationKey auth
	AuthorizationKey = "Authorization"

	// WebsocketConnection websocket
	WebsocketConnection = "Connection"
	WebsocketUpgrade    = "Upgrade"
	WebsocketSecVersion = "Sec-Websocket-Version"
	WebsocketSecKey     = "Sec-Websocket-Key"

	// ContentType header
	ContentType               = "Content-Type"
	ContentTypeJSON           = "application/json"
	ContentTypeJSONUtf8       = "application/json; charset=utf-8"
	ContentTypeProto          = "application/proto"
	ContentTypeProtobuf       = "application/x-protobuf"
	ContentTypeFormURLEncoded = "application/x-www-form-urlencoded"
	ContentTypeMultipartForm  = "multipart/form-data"

	// Accept header
	Accept         = "Accept"
	AcceptJSON     = "application/json"
	AcceptJSONUtf8 = "application/json; charset=utf-8"
	AcceptProto    = "application/proto"
	AcceptProtobuf = "application/x-protobuf"
)
View Source
const (
	// PlatformGoogleAppEngine When running on Google App Engine. Trust X-Appengine-Remote-Addr
	// for determining the client's IP
	PlatformGoogleAppEngine = "X-Appengine-Remote-Addr"
	// PlatformCloudflare When using Cloudflare's CDN. Trust CF-Connecting-IP for determining
	// the client's IP
	PlatformCloudflare = "CF-Connecting-IP"
)

Trusted platforms

Variables

This section is empty.

Functions

func ContainsValue

func ContainsValue(header http.Header, name string, value string) bool

ContainsValue . From websocket.tokenListContainsValue

func GetIsWebsocket

func GetIsWebsocket(header http.Header) bool

GetIsWebsocket 获取是否websocket

func GetRequestID

func GetRequestID(header stdhttp.Header) string

GetRequestID 获取RequestID

func SetIsWebsocket

func SetIsWebsocket(header http.Header)

SetIsWebsocket 设置是否websocket

func SetRequestID

func SetRequestID(header stdhttp.Header, requestID string)

SetRequestID 设置RequestID

Types

This section is empty.

Jump to

Keyboard shortcuts

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