grpc

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Name     = "grpc-server"
	ShowName = "GRPC Server"
)
View Source
const CPUUpdateInterval = time.Second * 5

Variables

This section is empty.

Functions

func GetPeerAddressFromStreamContext added in v0.5.0

func GetPeerAddressFromStreamContext(ctx context.Context) string

func GetPeerHostFromStreamContext added in v0.4.0

func GetPeerHostFromStreamContext(ctx context.Context) string

Types

type AcceptConnectionConfig added in v0.5.0

type AcceptConnectionConfig struct {
	CPUUtilization  float64 `mapstructure:"cpu_utilization"`  // The max CPU utilization limit
	ConnectionCount int32   `mapstructure:"connection_count"` // The max connection count
}

type AcceptLimiter added in v0.5.0

type AcceptLimiter struct {
	Config           AcceptConnectionConfig
	ActiveConnection int32
	CurrentCPU       float64

	telemetry.Counter
	// contains filtered or unexported fields
}

func NewAcceptLimiter added in v0.5.0

func NewAcceptLimiter(config AcceptConnectionConfig) (*AcceptLimiter, error)

func (*AcceptLimiter) CloseConnection added in v0.5.0

func (a *AcceptLimiter) CloseConnection()

func (*AcceptLimiter) CouldHandleConnection added in v0.5.0

func (a *AcceptLimiter) CouldHandleConnection() bool

type ConnectionManager added in v0.5.0

type ConnectionManager struct {
	net.Listener
	// contains filtered or unexported fields
}

func NewConnectionManager added in v0.5.0

func NewConnectionManager(network, address string, acceptConnectionConfig AcceptConnectionConfig) (*ConnectionManager, error)

func (*ConnectionManager) Accept added in v0.5.0

func (c *ConnectionManager) Accept() (net.Conn, error)

type ConnectionWrapper added in v0.5.0

type ConnectionWrapper struct {
	net.Conn
	// contains filtered or unexported fields
}

func (*ConnectionWrapper) Close added in v0.5.0

func (c *ConnectionWrapper) Close() error

func (*ConnectionWrapper) CloseNotify added in v0.5.0

func (c *ConnectionWrapper) CloseNotify()

type OriginalData added in v0.4.0

type OriginalData struct {
	Content []byte
}

OriginalData is keep binary Content

func NewOriginalData added in v0.4.0

func NewOriginalData(data []byte) *OriginalData

type Server

type Server struct {
	config.CommonFields
	Address              string `mapstructure:"address"`                // The address of grpc server.
	Network              string `mapstructure:"network"`                // The network of grpc.
	MaxRecvMsgSize       int    `mapstructure:"max_recv_msg_size"`      // The max size of the received log.
	MaxConcurrentStreams uint32 `mapstructure:"max_concurrent_streams"` // The max concurrent stream channels.
	TLSCertFile          string `mapstructure:"tls_cert_file"`          // The TLS cert file path.
	TLSKeyFile           string `mapstructure:"tls_key_file"`           // The TLS key file path.

	AcceptLimit AcceptConnectionConfig `mapstructure:"accept_limit"` // To Accept Connection Limiter when reach the resource
	// contains filtered or unexported fields
}

func (*Server) Close

func (s *Server) Close() error

func (*Server) DefaultConfig

func (s *Server) DefaultConfig() string

func (*Server) Description

func (s *Server) Description() string

func (*Server) GetServer

func (s *Server) GetServer() interface{}

func (*Server) Name

func (s *Server) Name() string

func (*Server) Prepare

func (s *Server) Prepare() error

func (*Server) ShowName added in v0.4.0

func (s *Server) ShowName() string

func (*Server) Start

func (s *Server) Start() error

Jump to

Keyboard shortcuts

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