Documentation ¶
Index ¶
- Variables
- type AuthMiddlewareParams
- type AuthMiddlewareResult
- type ConnectionMuxParams
- type ConnectionMuxResult
- type GatewayServiceParams
- type GatewayServiceResult
- type GrpcServiceParams
- type GrpcServiceResult
- type OTelProviderParams
- type OTelProviderResult
- type SecuritySettingsParams
- type SecuritySettingsResult
- type SettingsParams
- type SettingsResult
- type ZinxServiceParams
- type ZinxServiceResult
Constants ¶
This section is empty.
Variables ¶
var ConnectionMuxModule = fx.Provide( func(l *zap.Logger, g SettingsParams, s SecuritySettingsParams) (ConnectionMuxResult, error) { return CreateConnectionMux(l, g, s) }, )
ConnectionMuxModule module for ConnectionMux
var OTelModule = fx.Provide( func( appSetting mfx.AppParams, sSetting SettingsParams, ) (OTelProviderResult, error) { return CreateOTelProvider(appSetting, sSetting) }, )
OTelModule OTelModule provides OTel Tracer and Meter
var SecuritySettingsModule = fx.Provide( func() (SecuritySettingsResult, error) { return CreateSecuritySettings() }, )
SecuritySettingsModule module for SecuritySettings
var SettingsModule = fx.Provide( func() (out SettingsResult, err error) { return CreateSettings() }, )
SettingsModule module for server settings
Functions ¶
This section is empty.
Types ¶
type AuthMiddlewareParams ¶ added in v1.0.2
type AuthMiddlewareParams struct { fx.In AuthMiddleware siface.IAuthMiddleware `name:"AuthMiddleware" optional:"true"` }
AuthMiddlewareParams module params for injecting AuthMiddleware
type AuthMiddlewareResult ¶ added in v1.0.2
type AuthMiddlewareResult struct { fx.Out AuthMiddleware siface.IAuthMiddleware `name:"AuthMiddleware"` }
AuthMiddlewareResult module result for exporting AuthMiddleware
type ConnectionMuxParams ¶
type ConnectionMuxParams struct { fx.In ConnectionMux siface.IConnectionMux `name:"ConnectionMux"` }
ConnectionMuxParams module params for injecting ConnectionMux
type ConnectionMuxResult ¶
type ConnectionMuxResult struct { fx.Out ConnectionMux siface.IConnectionMux `name:"ConnectionMux"` }
ConnectionMuxResult module result for exporting ConnectionMux
func CreateConnectionMux ¶ added in v1.0.3
func CreateConnectionMux( l *zap.Logger, g SettingsParams, s SecuritySettingsParams, ) (out ConnectionMuxResult, err error)
CreateConnectionMux creates a connection mux for the server
type GatewayServiceParams ¶
type GatewayServiceParams struct { fx.In GatewayServices []siface.IGatewayService `group:"GatewayService"` }
GatewayServiceParams module params for injecting GatewayService
type GatewayServiceResult ¶
type GatewayServiceResult struct { fx.Out GatewayService siface.IGatewayService `group:"GatewayService"` }
GatewayServiceResult module result for exporting GatewayService
type GrpcServiceParams ¶
type GrpcServiceParams struct { fx.In GrpcServices []siface.IGrpcService `group:"GrpcService"` }
GrpcServiceParams module params for injecting GrpcService
type GrpcServiceResult ¶
type GrpcServiceResult struct { fx.Out GrpcService siface.IGrpcService `group:"GrpcService"` }
GrpcServiceResult module result for exporting GrpcService
type OTelProviderParams ¶ added in v0.0.32
type OTelProviderParams struct { fx.In TracerProvider *sdktrace.TracerProvider `name:"TracerProvider" optional:"true"` MetricProvider *sdkmetric.MeterProvider `name:"MetricProvider" optional:"true"` }
OTelProviderParams OTelProviderModule provides OTel Tracer and Meter
type OTelProviderResult ¶ added in v0.0.32
type OTelProviderResult struct { fx.Out TracerProvider *sdktrace.TracerProvider `name:"TracerProvider" ` MetricProvider *sdkmetric.MeterProvider `name:"MetricProvider"` }
OTelProviderResult OTelProviderModule provides OTel Tracer and Meter
func CreateOTelProvider ¶ added in v1.0.3
func CreateOTelProvider( appSetting mfx.AppParams, sSetting SettingsParams, ) (out OTelProviderResult, err error)
CreateOTelProvider creates a OTelProvider with the given settings
type SecuritySettingsParams ¶
type SecuritySettingsParams struct { fx.In // client mTLS settings ClientCaCert string `name:"ClientCaCert"` ClientCert string `name:"ClientCert"` ClientKey string `name:"ClientKey"` // server mTLS settings ServerCaCert string `name:"ServerCaCert"` ServerCert string `name:"ServerCert"` ServerKey string `name:"ServerKey"` ServerName string `name:"ServerName"` // Zero trust security model: all services must be mTLS enabled // if true, enable imports client for grpc/http(cmux service) clients MTLSEnable bool `name:"MTLSEnable"` // if true, enable service tls for grpc/http(cmux service) services TLSEnable bool `name:"TLSEnable"` // if true, enable Tls for tcp services(zinx service) TCPTlsEnable bool `name:"TCPTlsEnable"` }
SecuritySettingsParams module params for injecting SecuritySettings
type SecuritySettingsResult ¶
type SecuritySettingsResult struct { fx.Out //client mTLS settings ClientCaCert string `name:"ClientCaCert" envconfig:"CLIENT_CA_CERT" default:"./configs/tls-client/ca.crt"` ClientCert string `name:"ClientCert" envconfig:"CLIENT_CERT" default:"./configs/tls-client/tls.crt"` ClientKey string `name:"ClientKey" envconfig:"CLIENT_KEY" default:"./configs/tls-client/tls.key"` //server mTLS settings ServerCACert string `name:"ServerCaCert" envconfig:"SERVER_CA_CERT" default:"./configs/tls-server/ca.crt"` ServerCert string `name:"ServerCert" envconfig:"SERVER_CERT" default:"./configs/tls-server/tls.crt"` ServerKey string `name:"ServerKey" envconfig:"SERVER_KEY" default:"./configs/tls-server/tls.key"` ServerName string `name:"ServerName" envconfig:"SERVER_NAME" default:""` // if true, enable mTLS for grpc/http(cmux service) services // Zero trust security model: all services must be mTLS enabled MTLSEnable bool `name:"MTLSEnable" envconfig:"MTLS_ENABLE" default:"false"` // if true, enable service tls for grpc/http(cmux service) services TLSEnable bool `name:"TLSEnable" envconfig:"TLS_ENABLE" default:"false"` // if true, enable Tls for tcp services(zinx service) TcpTlsEnable bool `name:"TCPTlsEnable" envconfig:"TCP_TLS_ENABLE" default:"false"` }
SecuritySettingsResult module result for exporting SecuritySettings
func CreateSecuritySettings ¶ added in v1.0.3
func CreateSecuritySettings() (out SecuritySettingsResult, err error)
CreateSecuritySettings load server settings from environment
type SettingsParams ¶
type SettingsParams struct { fx.In Port int32 `name:"Port"` // grpc/http port Timeout int32 `name:"Timeout"` // tcp service heartbeat timeout RateLimit int32 `name:"RateLimit"` // all server type rate limit per second OtelEnable bool `name:"OtelEnable"` // open telemetry enable //--------------------- zinx settings --------------------- // pure tcp port ZinxTcpPort int32 `name:"ZinxTcpPort"` // tcp port // websocket port ZinxWSPort int32 `name:"ZinxWSPort"` // websocket port // The maximum size of the packets that can be sent or received MaxPacketSize uint32 `name:"MaxPacketSize"` // The number of worker pools in the business logic WorkerPoolSize uint32 `name:"WorkerPoolSize"` // The maximum number of tasks that a worker pool can handle MaxWorkerTaskLen uint32 `name:"MaxWorkerTaskLen"` // The maximum length of the send buffer message queue MaxMsgChanLen uint32 `name:"MaxMsgChanLen"` }
SettingsParams All server settings module
type SettingsResult ¶
type SettingsResult struct { fx.Out Port int32 `name:"Port" envconfig:"PORT" default:"8081"` Timeout int32 `name:"Timeout" envconfig:"TIMEOUT" default:"10"` RateLimit int32 `name:"RateLimit" envconfig:"RATE_LIMIT" default:"1000"` OtelEnable bool `name:"OtelEnable" envconfig:"OTEL_ENABLE" default:"false"` // --------------------- zinx settings --------------------- ZinxTcpPort int32 `name:"ZinxTcpPort" envconfig:"ZINX_TCP_PORT" default:"8888"` // websocket port ZinxWSPort int32 `name:"ZinxWSPort" envconfig:"ZINX_WS_PORT" default:""` // The maximum size of the packets that can be sent or received MaxPacketSize uint32 `name:"MaxPacketSize" envconfig:"MAX_PACKET_SIZE" default:"4096"` // The number of worker pools in the business logic WorkerPoolSize uint32 `name:"WorkerPoolSize" envconfig:"WORKER_POOL_SIZE" default:"64"` // The maximum number of tasks that a worker pool can handle MaxWorkerTaskLen uint32 `name:"MaxWorkerTaskLen" envconfig:"MAX_WORKER_TASK_LEN" default:"1024"` // The maximum length of the send buffer message queue MaxMsgChanLen uint32 `name:"MaxMsgChanLen" envconfig:"MAX_MSG_CHAN_LEN" default:"1024"` }
SettingsResult loads from the environment and its members are injected into the tfx dependency graph.
func CreateSettings ¶ added in v1.0.3
func CreateSettings() (out SettingsResult, err error)
CreateSettings load server settings from environment
type ZinxServiceParams ¶
type ZinxServiceParams struct { fx.In ZinxServices []siface.IZinxService `group:"ZinxService"` }
ZinxServiceParams module params for injecting ZinxService
type ZinxServiceResult ¶
type ZinxServiceResult struct { fx.Out ZinxService siface.IZinxService `group:"ZinxService"` }
ZinxServiceResult module result for exporting ZinxService