Documentation ¶
Overview ¶
Package grpcserver implements the GRPCServer.
Index ¶
- Constants
- type GRPCServer
- func (g *GRPCServer) Category() supervisor.ObjectCategory
- func (g *GRPCServer) Close()
- func (g *GRPCServer) DefaultSpec() interface{}
- func (g *GRPCServer) Inherit(superSpec *supervisor.Spec, previousGeneration supervisor.Object, ...)
- func (g *GRPCServer) Init(superSpec *supervisor.Spec, muxMapper context.MuxMapper)
- func (g *GRPCServer) Kind() string
- func (g *GRPCServer) Status() *supervisor.Status
- type Header
- type Method
- type MuxMethod
- type Rule
- type Spec
- type Status
Constants ¶
const ( // Category is the category of GRPCServer. Category = supervisor.CategoryTrafficGate // Kind is the kind of HTTPServer. Kind = "GRPCServer" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GRPCServer ¶
type GRPCServer struct {
// contains filtered or unexported fields
}
GRPCServer is TrafficGate Object GRPCServer
func (*GRPCServer) Category ¶
func (g *GRPCServer) Category() supervisor.ObjectCategory
Category returns the category of GrpcServer.
func (*GRPCServer) DefaultSpec ¶
func (g *GRPCServer) DefaultSpec() interface{}
DefaultSpec returns the default Spec of GrpcServer.
func (*GRPCServer) Inherit ¶
func (g *GRPCServer) Inherit(superSpec *supervisor.Spec, previousGeneration supervisor.Object, muxMapper context.MuxMapper)
Inherit inherits previous generation of GrpcServer.
func (*GRPCServer) Init ¶
func (g *GRPCServer) Init(superSpec *supervisor.Spec, muxMapper context.MuxMapper)
Init first create GrpcServer by Spec.name
func (*GRPCServer) Status ¶
func (g *GRPCServer) Status() *supervisor.Status
Status returns the status of GrpcServer.
type Header ¶
type Header struct { Key string `json:"key" jsonschema:"required"` Values []string `json:"values,omitempty" jsonschema:"omitempty,uniqueItems=true"` Regexp string `json:"regexp,omitempty" jsonschema:"omitempty,format=regexp"` // contains filtered or unexported fields }
Header is the third level entry of router. A header entry is always under a specific path entry, that is to mean the headers entry will only be checked after a path entry matched. However, the headers entry has a higher priority than the path entry itself.
type Method ¶
type Method struct { IPFilter *ipfilter.Spec `json:"ipFilter,omitempty" jsonschema:"omitempty"` Method string `json:"method,omitempty" jsonschema:"omitempty,pattern=^/"` MethodPrefix string `json:"methodPrefix,omitempty" jsonschema:"omitempty,pattern=^/"` MethodRegexp string `json:"methodRegexp,omitempty" jsonschema:"omitempty,format=regexp"` Backend string `json:"backend" jsonschema:"required"` Headers []*Header `json:"headers" jsonschema:"omitempty"` MatchAllHeader bool `json:"matchAllHeader" jsonschema:"omitempty"` }
Method is second level entry of router.
type MuxMethod ¶
type MuxMethod struct {
// contains filtered or unexported fields
}
MuxMethod describes gRPCserver's method
type Rule ¶
type Rule struct { // NOTICE: If the field is a pointer, it must have `omitempty` in tag `json` // when it has `omitempty` in tag `jsonschema`. // Otherwise it will output null value, which is invalid in json schema (the type is object). // the original reason is the jsonscheme(genjs) has not support multiple types. // Reference: https://github.com/alecthomas/jsonschema/issues/30 // In the future if we have the scenario where we need marshal the field, but omitempty // in the schema, we are suppose to support multiple types on our own. IPFilter *ipfilter.Spec `json:"ipFilter,omitempty" jsonschema:"omitempty"` Host string `json:"host" jsonschema:"omitempty"` HostRegexp string `json:"hostRegexp" jsonschema:"omitempty,format=regexp"` Methods []*Method `json:"methods" jsonschema:"omitempty"` }
Rule is first level entry of router.
type Spec ¶
type Spec struct { Port uint16 `json:"port" jsonschema:"required,minimum=1025"` MaxConnections uint32 `json:"maxConnections" jsonschema:"omitempty,minimum=1"` // MinTime see keepalive.EnforcementPolicy MinTime string `json:"minTimeClientSendPing" jsonschema:"omitempty,format=duration"` // PermitWithoutStream see keepalive.EnforcementPolicy, false by default. PermitWithoutStream bool `json:"permitClintSendPingWithoutStream" jsonschema:"omitempty,format=duration"` // MaxConnectionIdle see keepalive.ServerParameters MaxConnectionIdle string `json:"maxConnectionIdle" jsonschema:"omitempty,format=duration"` // MaxConnectionAge see keepalive.ServerParameters MaxConnectionAge string `json:"maxConnectionAge" jsonschema:"omitempty,format=duration"` // MaxConnectionAgeGrace see keepalive.ServerParameters MaxConnectionAgeGrace string `json:"maxConnectionAgeGrace" jsonschema:"omitempty,format=duration"` // Time see keepalive.ServerParameters Time string `json:"keepaliveTime" jsonschema:"omitempty,format=duration"` // Timeout see keepalive.ServerParameters Timeout string `json:"keepaliveTimeout" jsonschema:"omitempty,format=duration"` IPFilter *ipfilter.Spec `json:"ipFilter,omitempty" jsonschema:"omitempty"` Rules []*Rule `json:"rules" jsonschema:"omitempty"` CacheSize uint32 `json:"cacheSize" jsonschema:"omitempty"` GlobalFilter string `json:"globalFilter,omitempty" jsonschema:"omitempty"` XForwardedFor bool `json:"xForwardedFor" jsonschema:"omitempty"` }
Spec describe gRPC server