Documentation ¶
Index ¶
- Constants
- func FromContext(ctx context.Context) map[string]string
- func GetXCSEContext(k string, r *http.Request) string
- func NewContext(m map[string]string) context.Context
- func SetXCSEContext(vm map[string]string, r *http.Request)
- func WithContext(ctx context.Context, key, val string) context.Context
- type ContextHeaderKey
Constants ¶
const ( Provider = "Provider" Consumer = "Consumer" )
constant for provider and consumer
const ( // ScopeFull means service is able to access to another app's service ScopeFull = "full" // ScopeApp means service is not able to access to another app's service ScopeApp = "app" )
const ( Env = "CHASSIS_ENV" EnvNodeIP = "HOSTING_SERVER_IP" EnvSchemaRoot = "SCHEMA_ROOT" EnvProjectID = "CSE_PROJECT_ID" )
constant for micro service environment parameters
const ( CseRegistryAddress = "CSE_REGISTRY_ADDR" CseConfigCenterAddress = "CSE_CONFIG_CENTER_ADDR" EnvCSEEndpoint = "PAAS_CSE_ENDPOINT" EnvCSESCEndpoint = "PAAS_CSE_SC_ENDPOINT" EnvCSECCEndpoint = "PAAS_CSE_CC_ENDPOINT" )
constant environment keys service center, config center, monitor server addresses
const ( ServiceName = "SERVICE_NAME" Version = "VERSION" )
env connect with "." like service_description.name and service_description.version which can not be used in k8s. So we can not use archaius to set env. To support this declaring constant for service name and version constant for service name and version.
const ( EnvValueDev = "development" EnvValueProd = "production" )
constant for microservice environment
const ( SslCipherPluginKey = "cipherPlugin" SslVerifyPeerKey = "verifyPeer" SslCipherSuitsKey = "cipherSuits" SslProtocolKey = "protocol" SslCaFileKey = "caFile" SslCertFileKey = "certFile" SslKeyFileKey = "keyFile" SslCertPwdFileKey = "certPwdFile" AKSKCustomCipher = "cse.credentials.akskCustomCipher" )
constant for secure socket layer parameters
const ( ProtocolRest = "rest" ProtocolHighway = "highway" LBSessionID = "go-chassisLB" )
constant for protocol types
const ( // HeaderSourceName is constant for header source name HeaderSourceName = "x-cse-src-microservice" // HeaderXCseContent is constant for header , get some json msg about HeaderSourceName like {"k":"v"} HeaderXCseContent = "x-cse-context" )
const ( DefaultApp = "default" DefaultVersion = "0.0.1" LatestVersion = "latest" AllVersion = "0+" DefaultStatus = "UP" TESTINGStatus = "TESTING" DefaultLevel = "BACK" DefaultHBInterval = 30 )
constant for default application name and version
const ( HTTP = "http" HTTPS = "https" JSON = "application/json" Create = "CREATE" Update = "UPDATE" Delete = "DELETE" Client = "client" File = "File" DefaultTenant = "default" DefaultChainName = "default" FileRegistry = "File" DefaultUserName = "default" DefaultDomainName = "default" DefaultProvider = "default" TRUE = "true" FALSE = "false" )
constant used
const BuildinLabelVersion = BuildinTagVersion + ":" + LatestVersion
BuildinLabelVersion build label for version
const BuildinTagApp = "app"
BuildinTagApp build tag for the application
const BuildinTagVersion = "version"
BuildinTagVersion build tag version
const CallerKey = "caller"
CallerKey caller key
const DefaultKey = "default"
DefaultKey default key
const (
DefaultRefreshMode = 1
)
const default config for config-center
const DefaultValue = "default"
DefaultValue default value
const (
PlaceholderInternalIP = "$INTERNAL_IP"
)
configuration placeholders
const (
// RestMethod is the http method for restful protocol
RestMethod = "method"
)
const SessionNameSpaceDefaultValue = "default"
SessionNameSpaceDefaultValue default session namespace value
const SessionNameSpaceKey = "_Session_Namespace"
SessionNameSpaceKey metadata session namespace key
Variables ¶
This section is empty.
Functions ¶
func FromContext ¶
FromContext return the headers which should be send to provider through transport
func GetXCSEContext ¶ added in v1.4.2
GetXCSEContext get x-cse-context from req.header
func NewContext ¶
NewContext transforms a metadata to context object
func SetXCSEContext ¶ added in v1.4.2
SetXCSEContext set value into x-cse-context
Types ¶
type ContextHeaderKey ¶ added in v0.7.1
type ContextHeaderKey struct{}
ContextHeaderKey is the unified key of header value in context all protocol integrated with go chassis must set protocol header into context in this context key