constant

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2025 License: Apache-2.0 Imports: 2 Imported by: 4

Documentation

Overview

* Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

Index

Constants

View Source
const (
	ConfigEnv  = "GVA_CONFIG"
	ConfigFile = "config.yaml"
)
View Source
const (
	EnvResponseStrategy = "dgp-response-strategy"
	EnvMock             = "dgp-mock"
)

env key

View Source
const (
	EnvDubbogoPixiuConfig    = "DUBBOGO_PIXIU_CONFIG"
	EnvDubbogoPixiuApiConfig = "DUBBOGO_PIXIU_API_CONFIG"
	EnvDubbogoPixiuLogConfig = "DUBBOGO_PIXIU_LOG_CONFIG"
	EnvDubbogoPixiuLogLevel  = "DUBBOGO_PIXIU_LOG_LEVEL"
	EnvDubbogoPixiuLogFormat = "DUBBOGO_PIXIU_LOG_FORMAT"
	EnvDubbogoPixiuLimitCpus = "DUBBOGO_PIXIU_LIMIT_CPUS"
)
View Source
const (
	// nolint
	// FileDateFormat
	FileDateFormat = "2006-01-02"
	// nolint
	// MessageDateLayout
	MessageDateLayout = "2006-01-02 15:04:05"
	// nolint
	// LogFileMode
	LogFileMode = 0o600
	// nolint
	// buffer
	LogDataBuffer = 5000
	// console
	Console = "console"

	DefaultReqTimeout = 10 * time.Second
)
View Source
const (
	// dgp.filter.http.metric
	DefaultMetricMode           = "push" // Default mode is push
	DefaultMetricPushGatewayURL = "http://localhost:9091"
	DefaultMetricPushJobName    = "pixiu"
	DefaultMetricPushInterval   = 100
	DefaultMetricPushPath       = "/metrics"
)
View Source
const (
	HeaderKeyContextType      = "Content-Type"
	HeaderKeyCacheControl     = "Cache-Control"
	HeaderKeyConnection       = "Connection"
	HeaderKeyTransferEncoding = "Transfer-Encoding"
	HeaderKeyContentLength    = "Content-Length"
	HeaderKeyContentEncoding  = "Content-Encoding"
	HeaderKeyUserAgent        = "User-Agent"
	HeaderKeyAccept           = "Accept"

	HeaderKeyAccessControlAllowOrigin      = "Access-Control-Allow-Origin"
	HeaderKeyAccessControlAllowHeaders     = "Access-Control-Allow-Headers"
	HeaderKeyAccessControlExposeHeaders    = "Access-Control-Expose-Headers"
	HeaderKeyAccessControlAllowMethods     = "Access-Control-Allow-Methods"
	HeaderKeyAccessControlMaxAge           = "Access-Control-Max-Age"
	HeaderKeyAccessControlAllowCredentials = "Access-Control-Allow-Credentials"

	HeaderValueJsonUtf8               = "application/json;charset=UTF-8"
	HeaderValueTextPlain              = "text/plain"
	HeaderValueTextEventStream        = "text/event-stream"
	HeaderValueApplicationJson        = "application/json"
	HeaderValueApplicationOctetStream = "application/octet-stream"
	HeaderValueApplicationNDJson      = "application/x-ndjson"
	HeaderValueImageJpeg              = "image/jpeg"
	HeaderValueChunked                = "chunked"
	HeaderValueTextPrefix             = "text/"

	// Media type wildcards for Accept header negotiation
	MediaTypeWildcard        = "*/*"
	MediaTypeApplicationWild = "application/*"
	MediaTypeTextWild        = "text/*"

	HeaderValueGzip    = "gzip"
	HeaderValueDeflate = "deflate"

	HeaderValueKeepAlive = "keep-alive"
	HeaderValueNoCache   = "no-cache"

	HeaderValueAuthorization = "Authorization"

	HeaderValueAll       = "*"
	HeaderValueAllLevels = "**"

	PathSlash           = "/"
	ProtocolSlash       = "://"
	PathParamIdentifier = ":"
)
View Source
const (
	Http1HeaderKeyHost = "Host"
	Http2HeaderKeyHost = ":authority"
)
View Source
const (
	PprofDefaultAddress = "0.0.0.0"
	PprofDefaultPort    = 7070
)
View Source
const (
	Get     = "GET"
	Put     = "PUT"
	Post    = "POST"
	Delete  = "DELETE"
	Options = "OPTIONS"
)
View Source
const (
	DubboHttpDubboVersion   = "x-dubbo-http1.1-dubbo-version"
	DubboServiceProtocol    = "x-dubbo-service-protocol"
	DubboServiceVersion     = "x-dubbo-service-version"
	DubboGroup              = "x-dubbo-service-group"
	DubboServiceMethodTypes = "x-dubbo-service-method-overloading"
)
View Source
const (
	Host                       = "Host"
	Authorization              = "Authorization"
	WWWAuthenticate            = "WWW-Authenticate"
	XForwardedFor              = "X-Forwarded-For"
	AccessControlRequestMethod = "Access-Control-Request-Method"
	Origin                     = "Origin"
	XForwardedProto            = "X-Forwarded-Proto"
)
View Source
const (
	HeaderKeyMCPProtocolVersion = "Mcp-Protocol-Version"
	HeaderKeyMCPSessionId       = "Mcp-Session-Id"
)

MCP (Model Context Protocol) specific headers

View Source
const (
	MCPProtocolVersion20250618 = "2025-06-18"
	MCPProtocolVersion20250326 = "2025-03-26"
)

MCP protocol versions

View Source
const (
	SSEData  = "data"
	SSEEvent = "event"
	SSEId    = "id"
)

SSE response prefixes

View Source
const (
	HTTPConnectManagerFilter = "dgp.filter.httpconnectionmanager"
	GRPCConnectManagerFilter = "dgp.filter.grpcconnectionmanager"
	// TODO: Pending refactor, move network.grpcconnectionmanager and network.dubboconnectionmanager into common
	GRPCProxyConnectionFilter = "dgp.filter.network.grpcconnectionmanager"
	DubboConnectManagerFilter = "dgp.filter.network.dubboconnectionmanager"

	HTTPAuthorityFilter        = "dgp.filter.http.authority"
	HTTPProxyFilter            = "dgp.filter.http.httpproxy"
	HTTPHeaderFilter           = "dgp.filter.http.header"
	HTTPHostFilter             = "dgp.filter.http.host"
	HTTPMetricFilter           = "dgp.filter.http.metric"
	HTTPRecoveryFilter         = "dgp.filter.http.recovery"
	HTTPResponseFilter         = "dgp.filter.http.response"
	HTTPAccessLogFilter        = "dgp.filter.http.accesslog"
	HTTPRateLimitFilter        = "dgp.filter.http.ratelimit"
	HTTPGrpcProxyFilter        = "dgp.filter.http.grpcproxy"
	HTTPDubboProxyFilter       = "dgp.filter.http.dubboproxy"
	HTTPDirectDubboProxyFilter = "dgp.filter.http.directdubboproxy"
	HTTPApiConfigFilter        = "dgp.filter.http.apiconfig"
	HTTPTimeoutFilter          = "dgp.filter.http.timeout"
	TracingFilter              = "dgp.filters.tracing"
	HTTPWasmFilter             = "dgp.filter.http.webassembly"
	HTTPCircuitBreakerFilter   = "dgp.filter.http.circuitbreaker"
	HTTPAuthJwtFilter          = "dgp.filter.http.auth.jwt"
	HTTPMCPAuthFilter          = "dgp.filter.http.auth.mcp"
	HTTPCorsFilter             = "dgp.filter.http.cors"
	HTTPCsrfFilter             = "dgp.filter.http.csrf"
	HTTPProxyRewriteFilter     = "dgp.filter.http.proxyrewrite"
	HTTPLoadBalanceFilter      = "dgp.filter.http.loadbalance"
	HTTPEventFilter            = "dgp.filter.http.event"
	HTTPTrafficFilter          = "dgp.filter.http.traffic"
	HTTPPrometheusMetricFilter = "dgp.filter.http.prometheusmetric"
	HTTPFailInjectFilter       = "dgp.filter.http.faultinjection"
	HTTPAuthOPAFilter          = "dgp.filter.http.opa"

	DubboHttpFilter  = "dgp.filter.dubbo.http"
	DubboProxyFilter = "dgp.filter.dubbo.proxy"
	GRPCProxyFilter  = "dgp.filter.grpc.proxy"

	LLMProxyFilter     = "dgp.filter.llm.proxy"
	LLMTokenizerFilter = "dgp.filter.llm.tokenizer"

	MCPServerFilter = "dgp.filter.mcp.mcpserver"
)
View Source
const (
	SpringCloudAdapter         = "dgp.adapter.springcloud"
	DubboRegistryCenterAdapter = "dgp.adapter.dubboregistrycenter"
	LLMRegistryCenterAdapter   = "dgp.adapter.llmregistrycenter"
	McpServerAdapter           = "dgp.adapter.mcpserver"
)
View Source
const (
	ConfigPathKey    = "config"
	ApiConfigPathKey = "api-config"
	LogConfigPathKey = "log-config"
	LogLevelKey      = "log-level"
	LimitCpusKey     = "limit-cpus"
	LogFormatKey     = "log-format"
)
View Source
const (
	MQTypeKafka    = "kafka"
	MQTypeRocketMQ = "rocketmq"
)
View Source
const (
	ApplicationKey = "application"
	AppVersionKey  = "app.version"
	ClusterKey     = "cluster"
	GroupKey       = "group"
	VersionKey     = "version"
	InterfaceKey   = "interface"
	MethodsKey     = "methods"
	// NameKey name of interface
	NameKey = "name"
	// RetriesKey retry times
	RetriesKey = "retries"
)
View Source
const (
	// DubboRequest represents the dubbo request
	DubboRequest = "dubbo"
	// HTTPRequest represents the http request
	HTTPRequest = "http"
	// GRPCRequest represents the grpc request
	GRPCRequest = "grpc"
)
View Source
const (
	// Name pixiu name
	Name = "dubbo-go-pixiu"
	// Version pixiu version
	Version = "1.1.0"
)
View Source
const (
	DefaultTimeoutStr = "1s"
	DefaultTimeout    = time.Second
)

default timeout 1s.

View Source
const (
	ResponseStrategyNormal = "normal"
	ResponseStrategyHump   = "hump"
)

strategy for response.

View Source
const (
	// DefaultDiscoveryType Set up default discovery type.
	DefaultDiscoveryType = "EDS"
	// DefaultLoadBalanceType Set up default load balance type.
	DefaultLoadBalanceType = "RoundRobin"
	// DefaultFilterType Set up default filter type.
	DefaultFilterType = "dgp.filter.httpconnectionmanager"
	// DefaultHTTPType Set up default HTTP Type.
	DefaultHTTPType = "net/http"
	// DefaultProtocolType Set up default protocol type.
	DefaultProtocolType = "HTTP"
)
View Source
const (
	// YAML .yaml
	YAML = ".yaml"
	//YML .yml
	YML = ".yml"
)
View Source
const (
	StringSeparator      = ","
	DefaultConfigPath    = "configs/conf.yaml"
	DefaultApiConfigPath = "configs/api_config.yaml"
	DefaultLogConfigPath = "configs/log.yml"
	DefaultLogLevel      = "info"
	DefaultLimitCpus     = "0"
	DefaultLogFormat     = ""
)
View Source
const (
	Zookeeper string = "zookeeper"
	Nacos     string = "nacos"
	Consul    string = "consul"
)

env key

View Source
const (
	// RequestBody name of api config mapping from/to
	RequestBody = "requestBody"
	// QueryStrings name of api config mapping from/to
	QueryStrings = "queryStrings"
	// Headers name of api config mapping from/to
	Headers = "headers"
	// RequestURI name of api config mapping from/to, retrieve parameters from uri
	// for instance, https://test.com/:id uri.id will retrieve the :id parameter
	RequestURI = "uri"
	// Dot defines the . which will be used to present the path to specific field in the body
	Dot      = "."
	AnyValue = "*"
	At       = "@"
)
View Source
const (
	ResourceTypePrefix = "dubbo-go.pixiu"
	ClusterType        = ResourceTypePrefix + "/v1/discovery:cluster"
	ListenerType       = ResourceTypePrefix + "/v1/discovery:listener"
	EndpointType       = ResourceTypePrefix + "/v1/discovery:endpoint"
	RouterType         = ResourceTypePrefix + "/v1/discovery:route"
	RuntimeType        = ResourceTypePrefix + "/v1/discovery:runtime"
)
View Source
const (
	CheckConfigInterval = 1 * time.Second
)
View Source
const (
	// DefaultBodyAll body passthrough.
	DefaultBodyAll = "_all"
)
View Source
const (
	EnvDubbogoPixiuNacosRegistryAddress = "NACOS_ADDRESS"
)

registry configuration

Variables

View Source
var JTypeMapper = map[string]reflect.Type{
	"string":           reflect.TypeOf(""),
	"java.lang.String": reflect.TypeOf(""),
	"char":             reflect.TypeOf(""),
	"short":            reflect.TypeOf(int16(0)),
	"int":              reflect.TypeOf(int(0)),
	"long":             reflect.TypeOf(int64(0)),
	"float":            reflect.TypeOf(float32(0)),
	"double":           reflect.TypeOf(float64(0)),
	"boolean":          reflect.TypeOf(true),
	"java.util.Date":   reflect.TypeOf(time.Time{}),
	"date":             reflect.TypeOf(time.Time{}),
	"object":           reflect.TypeOf([]Object{}).Elem(),
	"java.lang.Object": reflect.TypeOf([]Object{}).Elem(),
}

JTypeMapper maps the java basic types to golang types

Functions

This section is empty.

Types

type Object

type Object any

Object represents the java.lang.Object type

Jump to

Keyboard shortcuts

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