Help us shape the future of Go! Take the 2026 Go Developer Survey

variable

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Time is the current time.
	Time                        = "$time"
	ServerID                    = "$server_id"
	RouteID                     = "$route_id"
	ServiceID                   = "$service_id"
	UpstreamID                  = "$upstream_id"
	RequestOrig                 = "$request_orig"
	NetworkPeerAddress          = "$network.peer.address"
	Hostname                    = "$hostname"
	TraceID                     = "$trace_id"
	HTTPStart                   = "$http.start"
	HTTPFinish                  = "$http.finish"
	HTTPRoute                   = "$http.route"
	HTTPRequest                 = "$http.request"
	HTTPRequestSize             = "$http.request.size"
	HTTPRequestScheme           = "$http.request.scheme"
	HTTPRequestHost             = "$http.request.host"
	HTTPRequestMethod           = "$http.request.method"
	HTTPRequestPath             = "$http.request.path"
	HTTPRequestQuery            = "$http.request.query"
	HTTPRequestProtocol         = "$http.request.protocol"
	HTTPRequestURI              = "$http.request.uri"
	HTTPRequestTags             = "$http.request.tags"
	HTTPRequestBody             = "$http.request.body"
	HTTPResponseSize            = "$http.response.size"
	HTTPResponseStatusCode      = "$http.response.status_code"
	HTTPRequestDuration         = "$http.request.duration"
	ErrorType                   = "$error.type"
	ErrorMessage                = "$error.message"
	LogTime                     = "$log_time"
	UpstreamRequest             = "$upstream.request"
	UpstreamRequestHost         = "$upstream.request.host"
	UpstreamRequestMethod       = "$upstream.request.method"
	UpstreamRequestPath         = "$upstream.request.path"
	UpstreamRequestQuery        = "$upstream.request.query"
	UpstreamRequestURI          = "$upstream.request.uri"
	UpstreamRequestProtocol     = "$upstream.request.protocol"
	UpstreamDuration            = "$upstream.duration"
	UpstreamResponoseStatusCode = "$upstream.response.status_code"
	Allow                       = "$allow"
	ClientIP                    = "$client_ip"
	BifrostRoute                = "$bifrost.route"
	TargetTimeout               = "target_timeout"
	GRPCStatusCode              = "$grpc.status_code"
	GRPCMessage                 = "$grpc.message"
	B                           = 1
	KB                          = 1024 * B
	MB                          = 1024 * KB
	GB                          = 1024 * MB
)

Variable names used in directives.

Variables

This section is empty.

Functions

func Get

func Get(key string, c *app.RequestContext) (val any, found bool)

Get returns the value of a variable or directive.

func GetBool

func GetBool(key string, c *app.RequestContext) bool

GetBool returns the bool value of a variable or directive.

func GetFloat32

func GetFloat32(key string, c *app.RequestContext) float32

GetFloat32 returns the float32 value of a variable or directive.

func GetFloat64

func GetFloat64(key string, c *app.RequestContext) float64

GetFloat64 returns the float64 value of a variable or directive.

func GetInt32

func GetInt32(key string, c *app.RequestContext) int32

GetInt32 returns the int32 value of a variable or directive.

func GetInt64

func GetInt64(key string, c *app.RequestContext) int64

GetInt64 returns the int64 value of a variable or directive.

func GetString

func GetString(key string, c *app.RequestContext) string

GetString returns the string value of a variable or directive.

func GetTime added in v0.3.0

func GetTime(key string, c *app.RequestContext) time.Time

GetTime returns the time.Time value of a variable or directive.

func IsDirective

func IsDirective(key string) bool

IsDirective checks if a key is a known directive.

func MethodToString added in v0.5.0

func MethodToString(m []byte) string

MethodToString tries to return consts without allocation.

func ParseDirectives added in v0.2.0

func ParseDirectives(content string) []string

ParseDirectives parses directives from a string.

Types

type RequestOriginal added in v0.2.0

type RequestOriginal struct {
	ServerID string
	Method   string
	Protocol string
	Scheme   []byte
	Host     []byte
	Path     []byte
	Query    []byte
}

RequestOriginal stores the original request information.

type RequestRoute added in v0.2.0

type RequestRoute struct {
	RouteID   string
	Route     string
	ServiceID string
	Tags      []string
}

RequestRoute stores information about the routed request.

Jump to

Keyboard shortcuts

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