Documentation
¶
Index ¶
- Constants
- Variables
- func NameForEnv(input string) string
- func StringToDurationHookFunc() mapstructure.DecodeHookFunc
- func StringToPEMDataHookFunc() mapstructure.DecodeHookFunc
- type AWSPublicationDataModeConfig
- type Admin
- type AwsSqsConsumerConfig
- type AzureServiceBusConsumerConfig
- type AzureServiceBusPublicationDataModeConfig
- type Broker
- type Channel
- type ChannelNamespace
- type ChannelNamespaces
- type ChannelOptions
- type ChannelProxyContainer
- type Client
- type ClientProxyContainer
- type Compiled
- type ConnectCodeToHTTPResponse
- type ConnectCodeToHTTPResponseTransform
- type ConnectCodeToHTTPResponseTransforms
- type ConnectCodeToUnidirectionalDisconnect
- type ConnectProxy
- type Consumer
- type Consumers
- type Debug
- type Duration
- type Emulation
- type Engine
- type EngineRedisBroker
- type EngineRedisPresenceManager
- type GooglePubSubConsumerConfig
- type GooglePubSubPublicationDataModeConfig
- type Graphite
- type GrpcAPI
- type HTTP3
- type HTTPServer
- type HTTPStream
- type Health
- type HttpAPI
- type HttpStatusToCodeTransform
- type HttpStatusToCodeTransforms
- type KafkaConsumerConfig
- type KafkaPublicationDataModeConfig
- type Log
- type MapStringString
- type NamedProxies
- type NamedProxy
- type NatsBroker
- type NatsCommon
- type NatsJetStreamConsumerConfig
- type NatsJetStreamPublicationDataModeConfig
- type NatsPrefixed
- type Node
- type OpenTelemetry
- type PEMData
- func (p PEMData) Load(statFile StatFileFunc, readFile ReadFileFunc) ([]byte, string, error)
- func (p PEMData) MarshalJSON() ([]byte, error)
- func (p PEMData) MarshalText() ([]byte, error)
- func (p PEMData) MarshalYAML() (interface{}, error)
- func (p PEMData) String() string
- func (p *PEMData) UnmarshalJSON(data []byte) error
- func (p *PEMData) UnmarshalText(text []byte) error
- func (p *PEMData) UnmarshalYAML(unmarshal func(interface{}) error) error
- type PingPong
- type PostgresConsumerConfig
- type PresenceManager
- type Prometheus
- type Proxy
- type ProxyCommon
- type ProxyCommonGRPC
- type ProxyCommonHTTP
- type RPC
- type RPCNamespaces
- type RPCPing
- type RawModeConfig
- type ReadFileFunc
- type Redis
- type RedisBroker
- type RedisBrokerCommon
- type RedisEngine
- type RedisNatsBroker
- type RedisPrefixed
- type RedisPresenceManager
- type RedisPresenceManagerCommon
- type RedisReplicaClient
- type RedisStreamConsumerConfig
- type RedisStreamPublicationDataModeConfig
- type RefreshProxy
- type RpcNamespace
- type RpcOptions
- type SSE
- type Shutdown
- type StatFileFunc
- type SubscribeToUserPersonalChannel
- type SubscriptionToken
- type Swagger
- type TLSAutocert
- type TLSConfig
- type Token
- type TransformDisconnect
- type TransformError
- type TransformedConnectErrorHttpResponse
- type UniConnectCodeToDisconnectTransform
- type UniConnectCodeToDisconnectTransforms
- type UniGRPC
- type UniHTTPStream
- type UniSSE
- type UniWebSocket
- type UsageStats
- type WebSocket
- type WebTransport
Constants ¶
const ( ConsumerTypePostgres = "postgresql" ConsumerTypeKafka = "kafka" ConsumerTypeNatsJetStream = "nats_jetstream" ConsumerTypeGooglePubSub = "google_pub_sub" ConsumerTypeAwsSqs = "aws_sqs" ConsumerTypeAzureServiceBus = "azure_service_bus" ConsumerTypeRedisStream = "redis_stream" )
Variables ¶
var KnownConsumerTypes = []string{ ConsumerTypePostgres, ConsumerTypeKafka, ConsumerTypeNatsJetStream, ConsumerTypeGooglePubSub, ConsumerTypeAwsSqs, ConsumerTypeAzureServiceBus, ConsumerTypeRedisStream, }
Functions ¶
func NameForEnv ¶
func StringToDurationHookFunc ¶
func StringToDurationHookFunc() mapstructure.DecodeHookFunc
func StringToPEMDataHookFunc ¶
func StringToPEMDataHookFunc() mapstructure.DecodeHookFunc
StringToPEMDataHookFunc for mapstructure to decode PEMData from strings.
Types ¶
type AWSPublicationDataModeConfig ¶ added in v6.2.0
type AWSPublicationDataModeConfig struct { // Enabled enables publication data mode. Enabled bool `mapstructure:"enabled" json:"enabled" envconfig:"enabled" yaml:"enabled" toml:"enabled"` // ChannelsAttribute is the attribute name containing comma-separated channel names. ChannelsAttribute string `` /* 172-byte string literal not displayed */ // IdempotencyKeyAttribute is the attribute name for an idempotency key. IdempotencyKeyAttribute string `` /* 214-byte string literal not displayed */ // DeltaAttribute is the attribute name for a delta flag. DeltaAttribute string `` /* 154-byte string literal not displayed */ // VersionAttribute is the attribute name for a version of publication. VersionAttribute string `` /* 166-byte string literal not displayed */ // VersionEpochAttribute is the attribute name for a version epoch of publication. VersionEpochAttribute string `` /* 202-byte string literal not displayed */ // TagsAttributePrefix is the prefix for attributes containing tags. TagsAttributePrefix string `` /* 183-byte string literal not displayed */ }
AWSPublicationDataModeConfig holds configuration for the publication data mode.
type Admin ¶
type Admin struct { Enabled bool `mapstructure:"enabled" json:"enabled" envconfig:"enabled" yaml:"enabled" toml:"enabled"` HandlerPrefix string `` /* 133-byte string literal not displayed */ // Password is an admin password. Password string `mapstructure:"password" json:"password" envconfig:"password" yaml:"password" toml:"password"` // Secret is a secret to generate auth token for admin requests. Secret string `mapstructure:"secret" json:"secret" envconfig:"secret" yaml:"secret" toml:"secret"` // Insecure turns on insecure mode for admin endpoints - no auth // required to connect to web interface and for requests to admin API. // Admin resources must be protected by firewall rules in production when // this option enabled otherwise everyone from internet can make admin // actions. Insecure bool `mapstructure:"insecure" json:"insecure" envconfig:"insecure" yaml:"insecure" toml:"insecure"` // WebPath is path to admin web application to serve. WebPath string `mapstructure:"web_path" json:"web_path" envconfig:"web_path" yaml:"web_path" toml:"web_path"` // WebProxyAddress is an address for proxying to the running admin web application app. // So it's possible to run web app in dev mode and point Centrifugo to its address for // development purposes. WebProxyAddress string `` /* 137-byte string literal not displayed */ // External is a flag to run admin interface on external port. External bool `mapstructure:"external" json:"external" envconfig:"external" yaml:"external" toml:"external"` }
type AwsSqsConsumerConfig ¶ added in v6.2.0
type AwsSqsConsumerConfig struct { // Queues is a list of SQS queue URLs to consume. Queues []string `mapstructure:"queues" json:"queues" envconfig:"queues" yaml:"queues" toml:"queues"` // SNSEnvelope, when true, expects messages to be wrapped in an SNS envelope – this is required when // consuming from SNS topics with SQS subscriptions. SNSEnvelope bool `mapstructure:"sns_envelope" json:"sns_envelope" envconfig:"sns_envelope" yaml:"sns_envelope" toml:"sns_envelope"` // Region is the AWS region. Region string `mapstructure:"region" json:"region" envconfig:"region" yaml:"region" toml:"region"` // MaxNumberOfMessages is the maximum number of messages to receive per poll. MaxNumberOfMessages int32 `` /* 175-byte string literal not displayed */ // PollWaitTime is the long-poll wait time. Rounded to seconds internally. PollWaitTime Duration `` /* 136-byte string literal not displayed */ // VisibilityTimeout is the time a message is hidden from other consumers. Rounded to seconds internally. VisibilityTimeout Duration `` /* 156-byte string literal not displayed */ // MaxConcurrency defines max concurrency during message batch processing. MaxConcurrency int `` /* 139-byte string literal not displayed */ // CredentialsProfile is a shared credentials profile to use. CredentialsProfile string `` /* 147-byte string literal not displayed */ // AssumeRoleARN, if provided, will cause the consumer to assume the given IAM role. AssumeRoleARN string `` /* 127-byte string literal not displayed */ // MethodAttribute is the attribute name to extract a method for command messages. // If provided in message, then payload must be just a serialized API request object. MethodAttribute string `` /* 160-byte string literal not displayed */ // LocalStackEndpoint if set enables using localstack with provided URL. LocalStackEndpoint string `` /* 147-byte string literal not displayed */ // PublicationDataMode holds settings for the mode where message payload already contains data // ready to publish into channels. PublicationDataMode AWSPublicationDataModeConfig `` /* 157-byte string literal not displayed */ }
AwsSqsConsumerConfig holds configuration for the AWS consumer.
func (AwsSqsConsumerConfig) Validate ¶ added in v6.2.0
func (c AwsSqsConsumerConfig) Validate() error
Validate ensures required fields are set.
type AzureServiceBusConsumerConfig ¶ added in v6.2.0
type AzureServiceBusConsumerConfig struct { // ConnectionString is the full connection string used for connection-string–based authentication. ConnectionString string `mapstructure:"connection_string" json:"connection_string" yaml:"connection_string" toml:"connection_string"` // UseAzureIdentity toggles Azure Identity (AAD) authentication instead of connection strings. UseAzureIdentity bool `mapstructure:"use_azure_identity" json:"use_azure_identity" yaml:"use_azure_identity" toml:"use_azure_identity"` // FullyQualifiedNamespace is the Service Bus namespace, e.g. "your-namespace.servicebus.windows.net". FullyQualifiedNamespace string `` /* 139-byte string literal not displayed */ // TenantID is the Azure Active Directory tenant ID used with Azure Identity. TenantID string `mapstructure:"tenant_id" json:"tenant_id" yaml:"tenant_id" toml:"tenant_id"` // ClientID is the Azure AD application (client) ID used for authentication. ClientID string `mapstructure:"client_id" json:"client_id" yaml:"client_id" toml:"client_id"` // ClientSecret is the secret associated with the Azure AD application. ClientSecret string `mapstructure:"client_secret" json:"client_secret" yaml:"client_secret" toml:"client_secret"` // Queues is the list of the Azure Service Bus queues to consume from. Queues []string `mapstructure:"queues" json:"queues" yaml:"queues" toml:"queues"` // UseSessions enables session-aware message handling. // All messages must include a SessionID; messages within the same session will be processed in order. UseSessions bool `mapstructure:"use_sessions" json:"use_sessions" yaml:"use_sessions" toml:"use_sessions"` // MaxConcurrentCalls controls the maximum number of messages processed concurrently. MaxConcurrentCalls int `` /* 131-byte string literal not displayed */ // MaxReceiveMessages sets the batch size when receiving messages from the queue. MaxReceiveMessages int `` /* 131-byte string literal not displayed */ // MethodProperty is the name of the message property used to extract the method (for API command). // If provided in message, then payload must be just a serialized API request object. MethodProperty string `` /* 127-byte string literal not displayed */ // PublicationDataMode configures how structured publication-ready data is extracted from the message. PublicationDataMode AzureServiceBusPublicationDataModeConfig `mapstructure:"publication_data_mode" json:"publication_data_mode" yaml:"publication_data_mode" toml:"publication_data_mode"` }
AzureServiceBusConsumerConfig holds configuration for the Azure Service Bus consumer.
func (AzureServiceBusConsumerConfig) Validate ¶ added in v6.2.0
func (c AzureServiceBusConsumerConfig) Validate() error
Validate checks that required fields are set.
type AzureServiceBusPublicationDataModeConfig ¶ added in v6.2.0
type AzureServiceBusPublicationDataModeConfig struct { // Enabled toggles the publication data mode. Enabled bool `mapstructure:"enabled" json:"enabled" yaml:"enabled" toml:"enabled"` // ChannelsProperty is the name of the message property that contains the list of target channels. ChannelsProperty string `` /* 137-byte string literal not displayed */ // IdempotencyKeyProperty is the property that holds an idempotency key for deduplication. IdempotencyKeyProperty string `` /* 172-byte string literal not displayed */ // DeltaProperty is the property that represents changes or deltas in the payload. DeltaProperty string `mapstructure:"delta_property" default:"centrifugo-delta" json:"delta_property" yaml:"delta_property" toml:"delta_property"` // VersionProperty is the property that holds the version of the message. VersionProperty string `` /* 132-byte string literal not displayed */ // VersionEpochProperty is the property that holds the version epoch of the message. VersionEpochProperty string `` /* 162-byte string literal not displayed */ // TagsPropertyPrefix defines the prefix used to extract dynamic tags from message properties. TagsPropertyPrefix string `` /* 145-byte string literal not displayed */ }
AzureServiceBusPublicationDataModeConfig holds configuration for publication data mode, where the incoming message payload is already structured for downstream publication.
type Broker ¶
type Broker struct { Enabled bool `mapstructure:"enabled" json:"enabled" envconfig:"enabled" yaml:"enabled" toml:"enabled"` // Type of broker to use. Can be "memory", "redis", "nats" at this point. Type string `mapstructure:"type" default:"memory" json:"type" envconfig:"type" yaml:"type" toml:"type"` // Redis is a configuration for "redis" broker. Redis RedisBroker `mapstructure:"redis" json:"redis" envconfig:"redis" toml:"redis" yaml:"redis"` // Nats is a configuration for NATS broker. It does not support history/recovery/cache. Nats NatsBroker `mapstructure:"nats" json:"nats" envconfig:"nats" toml:"nats" yaml:"nats"` // RedisNats is a configuration for Redis + NATS broker. It's highly experimental, undocumented and // can only be used when enable_unreleased_features option is set to true. NODOC. RedisNats *RedisNatsBroker `` /* 127-byte string literal not displayed */ }
type Channel ¶
type Channel struct { // Proxy configuration for channel-related events. All types inside can be referenced by the name "default". Proxy ChannelProxyContainer `mapstructure:"proxy" json:"proxy" envconfig:"proxy" toml:"proxy" yaml:"proxy"` // WithoutNamespace is a configuration of channels options for channels which do not have namespace. // Generally, we recommend always use channel namespaces but this option can be useful for simple setups. WithoutNamespace ChannelOptions `` /* 137-byte string literal not displayed */ // Namespaces is a list of channel namespaces. Each channel namespace can have its own set of rules. Namespaces ChannelNamespaces `mapstructure:"namespaces" default:"[]" json:"namespaces" envconfig:"namespaces" yaml:"namespaces" toml:"namespaces"` // HistoryMetaTTL is a time how long to keep history meta information. This is a global option for all channels, // but it can be overridden in channel namespace. HistoryMetaTTL Duration `` /* 147-byte string literal not displayed */ // MaxLength is a maximum length of a channel name. This is a global option for all channels. MaxLength int `mapstructure:"max_length" json:"max_length" envconfig:"max_length" default:"255" yaml:"max_length" toml:"max_length"` // PrivatePrefix is a prefix for private channels. Private channels can't be subscribed without // token even if namespace options allows it. This is mostly kept for historic reasons. PrivatePrefix string `` /* 134-byte string literal not displayed */ // NamespaceBoundary defines a boundary for channel namespaces. NamespaceBoundary string `` /* 154-byte string literal not displayed */ // UserBoundary defines a boundary for user part in channel name. UserBoundary string `` /* 129-byte string literal not displayed */ // UserSeparator is used for passing several users in user part of channel name. UserSeparator string `` /* 134-byte string literal not displayed */ }
type ChannelNamespace ¶
type ChannelNamespace struct { // Name is a unique namespace name. Name string `mapstructure:"name" json:"name" envconfig:"name" yaml:"name" toml:"name"` // Options for namespace determine channel options for channels // belonging to this namespace. ChannelOptions `mapstructure:",squash" yaml:",inline"` }
ChannelNamespace allows creating channels with different channel options.
type ChannelNamespaces ¶
type ChannelNamespaces []ChannelNamespace
func (*ChannelNamespaces) Decode ¶
func (d *ChannelNamespaces) Decode(value string) error
Decode to implement the envconfig.Decoder interface
type ChannelOptions ¶
type ChannelOptions struct { // Presence turns on presence information for channel. Presence has // information about all clients currently subscribed to a channel. Presence bool `mapstructure:"presence" json:"presence" envconfig:"presence" yaml:"presence" toml:"presence"` // JoinLeave turns on join/leave messages for a channel. // When client subscribes on a channel join message sent to all // subscribers in this channel (including current client). When client // leaves channel (unsubscribes) leave message sent. This option does // not fit well for channels with many subscribers because every // subscribe/unsubscribe event results into join/leave event broadcast // to all other active subscribers thus overloads server with tons of // messages. Use accurately for channels with small number of active // subscribers. JoinLeave bool `mapstructure:"join_leave" json:"join_leave" envconfig:"join_leave" yaml:"join_leave" toml:"join_leave"` // ForcePushJoinLeave forces sending join/leave messages towards subscribers. ForcePushJoinLeave bool `` /* 157-byte string literal not displayed */ // HistorySize determines max amount of history messages for a channel, // Zero value means no history for channel. Centrifuge history has an // auxiliary role with current Engines – it can not replace your backend // persistent storage. HistorySize int `mapstructure:"history_size" json:"history_size" envconfig:"history_size" yaml:"history_size" toml:"history_size"` // HistoryTTL is a time to live for history cache. Server maintains a window of // messages in memory (or in Redis with Redis engine), to prevent infinite memory // grows it's important to remove history for inactive channels. HistoryTTL Duration `mapstructure:"history_ttl" json:"history_ttl" envconfig:"history_ttl" yaml:"history_ttl" toml:"history_ttl"` // HistoryMetaTTL is a time to live for history stream meta information. Must be // much larger than HistoryTTL in common scenario. If zero, then we use global value // set over default_history_meta_ttl on configuration top level. HistoryMetaTTL Duration `` /* 132-byte string literal not displayed */ // ForcePositioning enables client positioning. This means that StreamPosition // will be exposed to the client and server will look that no messages from // PUB/SUB layer lost. In the loss found – client is disconnected (or unsubscribed) // with reconnect (resubscribe) code. ForcePositioning bool `` /* 137-byte string literal not displayed */ // AllowPositioning allows positioning when client asks about it. AllowPositioning bool `` /* 137-byte string literal not displayed */ // ForceRecovery enables recovery mechanism for channels. This means that // server will try to recover missed messages for resubscribing client. // This option uses publications from history and must be used with reasonable // HistorySize and HistoryTTL configuration. ForceRecovery bool `mapstructure:"force_recovery" json:"force_recovery" envconfig:"force_recovery" yaml:"force_recovery" toml:"force_recovery"` // AllowRecovery allows recovery when client asks about it. AllowRecovery bool `mapstructure:"allow_recovery" json:"allow_recovery" envconfig:"allow_recovery" yaml:"allow_recovery" toml:"allow_recovery"` // ForceRecoveryMode can set the recovery mode for all channel subscribers in the namespace which use recovery. ForceRecoveryMode string `` /* 147-byte string literal not displayed */ // AllowedDeltaTypes is non-empty contains slice of allowed delta types for subscribers to use. AllowedDeltaTypes []centrifuge.DeltaType `` /* 147-byte string literal not displayed */ // DeltaPublish enables delta publish mechanism for all messages published in namespace channels // without explicit flag usage in publish API request. Setting this option does not guarantee that // publication will be compressed when going towards subscribers – it still depends on subscriber // connection options and whether Centrifugo Node is able to find previous publication in channel. DeltaPublish bool `mapstructure:"delta_publish" json:"delta_publish" envconfig:"delta_publish" yaml:"delta_publish" toml:"delta_publish"` // SubscribeForAnonymous allows anonymous clients to subscribe on channels in namespace. SubscribeForAnonymous bool `` /* 197-byte string literal not displayed */ // SubscribeForClient allows authenticated clients to subscribe on channels in namespace. SubscribeForClient bool `` /* 182-byte string literal not displayed */ // PublishForAnonymous allows anonymous clients to publish messages into channels in namespace. PublishForAnonymous bool `` /* 187-byte string literal not displayed */ // PublishForSubscriber allows clients subscribed on channel to publish messages into it. PublishForSubscriber bool `` /* 192-byte string literal not displayed */ // PublishForClient allows authenticated clients to publish messages into channels in namespace. PublishForClient bool `` /* 172-byte string literal not displayed */ // PresenceForAnonymous allows anonymous clients to get presence information for channels in namespace. PresenceForAnonymous bool `` /* 192-byte string literal not displayed */ // PresenceForSubscriber allows clients subscribed on channel to get presence information for it. PresenceForSubscriber bool `` /* 197-byte string literal not displayed */ // PresenceForClient allows authenticated clients to get presence information for channels in namespace. PresenceForClient bool `` /* 177-byte string literal not displayed */ // HistoryForAnonymous allows anonymous clients to get history information for channels in namespace. HistoryForAnonymous bool `` /* 187-byte string literal not displayed */ // HistoryForSubscriber allows clients subscribed on channel to get history information for it. HistoryForSubscriber bool `` /* 192-byte string literal not displayed */ // HistoryForClient allows authenticated clients to get history information for channels in namespace. HistoryForClient bool `` /* 172-byte string literal not displayed */ // UserLimitedChannels allows to limit number of channels user can subscribe to in namespace. UserLimitedChannels bool `` /* 187-byte string literal not displayed */ // ChannelRegex sets a regular expression to check channel name against. ChannelRegex string `mapstructure:"channel_regex" json:"channel_regex" envconfig:"channel_regex" yaml:"channel_regex" toml:"channel_regex"` // SubscribeProxyEnabled turns on using proxy for subscribe operations in namespace. SubscribeProxyEnabled bool `` /* 167-byte string literal not displayed */ // SubscribeProxyName of proxy to use for subscribe operations in namespace. SubscribeProxyName string `` /* 170-byte string literal not displayed */ // PublishProxyEnabled turns on using proxy for publish operations in namespace. PublishProxyEnabled bool `` /* 157-byte string literal not displayed */ // PublishProxyName of proxy to use for publish operations in namespace. PublishProxyName string `` /* 160-byte string literal not displayed */ // SubRefreshProxyEnabled turns on using proxy for sub refresh operations in namespace. SubRefreshProxyEnabled bool `` /* 177-byte string literal not displayed */ // SubRefreshProxyName of proxy to use for sub refresh operations in namespace. SubRefreshProxyName string `` /* 180-byte string literal not displayed */ // SubscribeStreamProxyEnabled turns on using proxy for subscribe stream operations in namespace. SubscribeStreamProxyEnabled bool `` /* 202-byte string literal not displayed */ // SubscribeStreamProxyName of proxy to use for subscribe stream operations in namespace. SubscribeStreamProxyName string `` /* 205-byte string literal not displayed */ // SubscribeStreamBidirectional enables using bidirectional stream proxy for the namespace. SubscribeStreamBidirectional bool `` /* 232-byte string literal not displayed */ Compiled `json:"-" yaml:"-" toml:"-"` }
ChannelOptions represent channel specific configuration for namespace or global channel options if set on top level of configuration.
func (ChannelOptions) GetRecoveryMode ¶
func (o ChannelOptions) GetRecoveryMode() centrifuge.RecoveryMode
type ChannelProxyContainer ¶
type ChannelProxyContainer struct { // Subscribe proxy configuration. Subscribe Proxy `mapstructure:"subscribe" json:"subscribe" envconfig:"subscribe" yaml:"subscribe" toml:"subscribe"` // Publish proxy configuration. Publish Proxy `mapstructure:"publish" json:"publish" envconfig:"publish" yaml:"publish" toml:"publish"` // SubRefresh proxy configuration. SubRefresh Proxy `mapstructure:"sub_refresh" json:"sub_refresh" envconfig:"sub_refresh" yaml:"sub_refresh" toml:"sub_refresh"` // SubscribeStream proxy configuration. SubscribeStream Proxy `` /* 132-byte string literal not displayed */ }
type Client ¶
type Client struct { // Proxy is a configuration for client connection-wide proxies. Proxy ClientProxyContainer `mapstructure:"proxy" json:"proxy" envconfig:"proxy" toml:"proxy" yaml:"proxy"` // AllowedOrigins is a list of allowed origins for client connections. AllowedOrigins []string `` /* 127-byte string literal not displayed */ // Token is a configuration for token generation and verification. When enabled, this configuration // is used for both connection and subscription tokens. See also SubscriptionToken to use a separate // configuration for subscription tokens. Token Token `mapstructure:"token" json:"token" envconfig:"token" yaml:"token" toml:"token"` // SubscriptionToken is a configuration for subscription token generation and verification. When enabled, // Centrifugo will use this configuration for subscription tokens only. Configuration in Token is then only // used for connection tokens. SubscriptionToken SubscriptionToken `` /* 142-byte string literal not displayed */ // AllowAnonymousConnectWithoutToken allows to connect to Centrifugo without a token. In this case connection will // be accepted but client will be anonymous (i.e. will have empty user ID). AllowAnonymousConnectWithoutToken bool `` /* 237-byte string literal not displayed */ // DisallowAnonymousConnectionTokens disallows anonymous connection tokens. When enabled, Centrifugo will not // accept connection tokens with empty user ID. DisallowAnonymousConnectionTokens bool `` /* 232-byte string literal not displayed */ // PingPong allows configuring application level ping-pong behavior for client connections. PingPong `mapstructure:",squash" yaml:",inline"` // ExpiredConnectionCloseDelay is a delay before closing connection after it becomes expired. ExpiredCloseDelay Duration `` /* 161-byte string literal not displayed */ // ExpiredSubCloseDelay is a delay before closing subscription after it becomes expired. ExpiredSubCloseDelay Duration `` /* 181-byte string literal not displayed */ // StaleConnectionCloseDelay is a delay before closing stale connection (which does not authenticate after connecting). StaleCloseDelay Duration `` /* 151-byte string literal not displayed */ // ChannelLimit is a maximum number of channels client can subscribe to. ChannelLimit int `` /* 131-byte string literal not displayed */ // QueueMaxSize is a maximum size of message queue for client connection in bytes. QueueMaxSize int `` /* 140-byte string literal not displayed */ // PresenceUpdateInterval is a period of time how often to update presence info for subscriptions of connected client. PresenceUpdateInterval Duration `` /* 186-byte string literal not displayed */ // Concurrency is a maximum number of concurrent operations for client connection. If not set only one operation can be processed at a time. Concurrency int `mapstructure:"concurrency" json:"concurrency" envconfig:"concurrency" yaml:"concurrency" toml:"concurrency"` // ChannelPositionCheckDelay is a delay between channel position checks for client subscriptions. ChannelPositionCheckDelay Duration `` /* 206-byte string literal not displayed */ // ChannelPositionMaxTimeLag is a maximum allowed time lag for publications for subscribers with positioning on. When // exceeded we mark connection with insufficient state. By default, not used - i.e. Centrifugo does not take lag into // account for positioning. See pub_sub_time_lag_seconds as a helpful Prometheus metric. ChannelPositionMaxTimeLag Duration `` /* 197-byte string literal not displayed */ // ConnectionLimit is a maximum number of connections Centrifugo node can accept. ConnectionLimit int `` /* 132-byte string literal not displayed */ // UserConnectionLimit is a maximum number of connections Centrifugo node can accept from a single user. UserConnectionLimit int `` /* 157-byte string literal not displayed */ // ConnectionRateLimit is a maximum number of connections per second Centrifugo node can accept. ConnectionRateLimit int `` /* 157-byte string literal not displayed */ // ConnectIncludeServerTime allows to include server time in connect reply of client protocol. ConnectIncludeServerTime bool `` /* 187-byte string literal not displayed */ // HistoryMaxPublicationLimit is a maximum number of publications Centrifugo returns in client history requests. HistoryMaxPublicationLimit int `` /* 211-byte string literal not displayed */ // RecoveryMaxPublicationLimit is a maximum number of publications Centrifugo returns during client recovery. RecoveryMaxPublicationLimit int `` /* 216-byte string literal not displayed */ // InsecureSkipTokenSignatureVerify allows to skip token signature verification. This can be useful for testing purposes. InsecureSkipTokenSignatureVerify bool `` /* 232-byte string literal not displayed */ // UserIDHTTPHeader is a name of HTTP header to extract user ID from. If set Centrifugo will try to extract user ID from this header. UserIDHTTPHeader string `` /* 147-byte string literal not displayed */ // Insecure allows to disable auth features in client protocol. Obviously - must not be used in production until you know what you do. Insecure bool `mapstructure:"insecure" json:"insecure" envconfig:"insecure" yaml:"insecure" toml:"insecure"` // SubscribeToUserPersonalChannel is a configuration for a feature to automatically subscribe user to a personal channel // using server-side subscription. SubscribeToUserPersonalChannel SubscribeToUserPersonalChannel `` /* 222-byte string literal not displayed */ // ConnectCodeToUnidirectionalDisconnect is a configuration for a feature to transform connect error codes to the disconnect code // for unidirectional transports. ConnectCodeToUnidirectionalDisconnect ConnectCodeToUnidirectionalDisconnect `` /* 257-byte string literal not displayed */ }
type ClientProxyContainer ¶
type ClientProxyContainer struct { // Connect proxy when enabled is used to proxy connect requests from client to the application backend. // Only requests without JWT token are proxied at this point. Connect ConnectProxy `mapstructure:"connect" json:"connect" envconfig:"connect" yaml:"connect" toml:"connect"` // Refresh proxy when enabled is used to proxy client connection refresh decisions to the application backend. Refresh RefreshProxy `mapstructure:"refresh" json:"refresh" envconfig:"refresh" yaml:"refresh" toml:"refresh"` }
type ConnectCodeToHTTPResponse ¶
type ConnectCodeToHTTPResponse struct { Enabled bool `mapstructure:"enabled" json:"enabled" envconfig:"enabled" yaml:"enabled" toml:"enabled"` Transforms ConnectCodeToHTTPResponseTransforms `mapstructure:"transforms" default:"[]" json:"transforms" envconfig:"transforms" yaml:"transforms" toml:"transforms"` }
type ConnectCodeToHTTPResponseTransform ¶
type ConnectCodeToHTTPResponseTransform struct { Code uint32 `mapstructure:"code" json:"code" envconfig:"code" yaml:"code" toml:"code"` To TransformedConnectErrorHttpResponse `mapstructure:"to" json:"to" envconfig:"to" yaml:"to" toml:"to"` }
type ConnectCodeToHTTPResponseTransforms ¶
type ConnectCodeToHTTPResponseTransforms []ConnectCodeToHTTPResponseTransform
func (*ConnectCodeToHTTPResponseTransforms) Decode ¶
func (d *ConnectCodeToHTTPResponseTransforms) Decode(value string) error
Decode to implement the envconfig.Decoder interface
type ConnectCodeToUnidirectionalDisconnect ¶
type ConnectCodeToUnidirectionalDisconnect struct { // Enabled allows to enable the feature. Enabled bool `mapstructure:"enabled" json:"enabled" envconfig:"enabled" yaml:"enabled" toml:"enabled"` // Transforms is a list of connect error code to disconnect code transforms. Transforms UniConnectCodeToDisconnectTransforms `mapstructure:"transforms" default:"[]" json:"transforms" envconfig:"transforms" yaml:"transforms" toml:"transforms"` }
type ConnectProxy ¶
type Consumer ¶
type Consumer struct { // Name is a unique name required for each consumer. Name string `mapstructure:"name" json:"name" envconfig:"name" yaml:"name" toml:"name"` // Enabled must be true to tell Centrifugo to run configured consumer. Enabled bool `mapstructure:"enabled" json:"enabled" envconfig:"enabled" yaml:"enabled" toml:"enabled"` // Type describes the type of consumer. Supported types are: `postgresql`, `kafka`, `nats_jetstream`, // `redis_stream`, `google_pub_sub`, `aws_sqs`, `azure_service_bus`. Type string `mapstructure:"type" json:"type" envconfig:"type" yaml:"type" toml:"type"` // Postgres allows defining options for consumer of postgresql type. Postgres PostgresConsumerConfig `mapstructure:"postgresql" json:"postgresql" envconfig:"postgresql" yaml:"postgresql" toml:"postgresql"` // Kafka allows defining options for consumer of kafka type. Kafka KafkaConsumerConfig `mapstructure:"kafka" json:"kafka" envconfig:"kafka" yaml:"kafka" toml:"kafka"` // NatsJetStream allows defining options for consumer of nats_jetstream type. NatsJetStream NatsJetStreamConsumerConfig `mapstructure:"nats_jetstream" json:"nats_jetstream" envconfig:"nats_jetstream" yaml:"nats_jetstream" toml:"nats_jetstream"` // RedisStream allows defining options for consumer of redis_stream type. RedisStream RedisStreamConsumerConfig `mapstructure:"redis_stream" json:"redis_stream" envconfig:"redis_stream" yaml:"redis_stream" toml:"redis_stream"` // GooglePubSub allows defining options for consumer of google_pub_sub type. GooglePubSub GooglePubSubConsumerConfig `mapstructure:"google_pub_sub" json:"google_pub_sub" envconfig:"google_pub_sub" yaml:"google_pub_sub" toml:"google_pub_sub"` // AwsSqs allows defining options for consumer of aws_sqs type. AwsSqs AwsSqsConsumerConfig `mapstructure:"aws_sqs" json:"aws_sqs" envconfig:"aws_sqs" yaml:"aws_sqs" toml:"aws_sqs"` // AzureServiceBus allows defining options for consumer of azure_service_bus type. AzureServiceBus AzureServiceBusConsumerConfig `` /* 137-byte string literal not displayed */ }
type Duration ¶
func (Duration) MarshalJSON ¶
MarshalJSON for JSON encoding.
func (Duration) MarshalText ¶
MarshalText for TOML encoding.
func (Duration) MarshalYAML ¶
MarshalYAML for YAML encoding.
func (Duration) ToDuration ¶
ToDuration converts the Duration type to time.Duration.
func (*Duration) UnmarshalJSON ¶ added in v6.2.0
UnmarshalJSON interprets numeric values as nanoseconds (default behavior), and strings using time.ParseDuration.
type Engine ¶
type Engine struct { // Type of broker to use. Can be `memory` or `redis` at this point. Type string `mapstructure:"type" default:"memory" json:"type" envconfig:"type" yaml:"type" toml:"type"` // Redis is a configuration for `redis` broker. Redis RedisEngine `mapstructure:"redis" json:"redis" envconfig:"redis" toml:"redis" yaml:"redis"` }
type EngineRedisBroker ¶
type EngineRedisBroker struct {
RedisBrokerCommon `mapstructure:",squash" yaml:",inline"`
}
type EngineRedisPresenceManager ¶
type EngineRedisPresenceManager struct {
RedisPresenceManagerCommon `mapstructure:",squash" yaml:",inline"`
}
type GooglePubSubConsumerConfig ¶ added in v6.2.0
type GooglePubSubConsumerConfig struct { // Google Cloud project ID. ProjectID string `mapstructure:"project_id" json:"project_id" envconfig:"project_id" yaml:"project_id" toml:"project_id"` // Subscriptions is the list of Pub/Sub subscription ids to consume from. Subscriptions []string `mapstructure:"subscriptions" json:"subscriptions" envconfig:"subscriptions" yaml:"subscriptions" toml:"subscriptions"` // MaxOutstandingMessages controls the maximum number of unprocessed messages. MaxOutstandingMessages int `` /* 186-byte string literal not displayed */ // MaxOutstandingBytes controls the maximum number of unprocessed bytes. MaxOutstandingBytes int `` /* 175-byte string literal not displayed */ // AuthMechanism specifies which authentication mechanism to use: // "default", "service_account". AuthMechanism string `mapstructure:"auth_mechanism" json:"auth_mechanism" envconfig:"auth_mechanism" yaml:"auth_mechanism" toml:"auth_mechanism"` // CredentialsFile is the path to the service account JSON file if required. CredentialsFile string `` /* 132-byte string literal not displayed */ // MethodAttribute is an attribute name to extract a method name from the message. // If provided in message, then payload must be just a serialized API request object. MethodAttribute string `` /* 160-byte string literal not displayed */ // PublicationDataMode holds settings for the mode where message payload already contains data // ready to publish into channels. PublicationDataMode GooglePubSubPublicationDataModeConfig `` /* 157-byte string literal not displayed */ }
GooglePubSubConsumerConfig is a configuration for the Google Pub/Sub consumer.
func (GooglePubSubConsumerConfig) Validate ¶ added in v6.2.0
func (c GooglePubSubConsumerConfig) Validate() error
Validate ensures required fields are set.
type GooglePubSubPublicationDataModeConfig ¶ added in v6.2.0
type GooglePubSubPublicationDataModeConfig struct { // Enabled enables publication data mode. Enabled bool `mapstructure:"enabled" json:"enabled" envconfig:"enabled" yaml:"enabled" toml:"enabled"` // ChannelsAttribute is the attribute name containing comma-separated channel names. ChannelsAttribute string `` /* 172-byte string literal not displayed */ // IdempotencyKeyAttribute is the attribute name for an idempotency key. IdempotencyKeyAttribute string `` /* 214-byte string literal not displayed */ // DeltaAttribute is the attribute name for a delta flag. DeltaAttribute string `` /* 154-byte string literal not displayed */ // VersionAttribute is the attribute name for a version. VersionAttribute string `` /* 166-byte string literal not displayed */ // VersionEpochAttribute is the attribute name for a version epoch. VersionEpochAttribute string `` /* 202-byte string literal not displayed */ // TagsAttributePrefix is the prefix for attributes containing tags. TagsAttributePrefix string `` /* 183-byte string literal not displayed */ }
GooglePubSubPublicationDataModeConfig is the configuration for the publication data mode.
type Graphite ¶
type Graphite struct { Enabled bool `mapstructure:"enabled" json:"enabled" envconfig:"enabled" yaml:"enabled" toml:"enabled"` Host string `mapstructure:"host" json:"host" envconfig:"host" default:"localhost" yaml:"host" toml:"host"` Port int `mapstructure:"port" json:"port" envconfig:"port" default:"2003" yaml:"port" toml:"port"` Prefix string `mapstructure:"prefix" json:"prefix" envconfig:"prefix" default:"centrifugo" yaml:"prefix" toml:"prefix"` Interval Duration `mapstructure:"interval" json:"interval" envconfig:"interval" default:"10s" yaml:"interval" toml:"interval"` Tags bool `mapstructure:"tags" json:"tags" envconfig:"tags" yaml:"tags" toml:"tags"` }
type GrpcAPI ¶
type GrpcAPI struct { Enabled bool `mapstructure:"enabled" json:"enabled" envconfig:"enabled" yaml:"enabled" toml:"enabled"` ErrorMode string `mapstructure:"error_mode" json:"error_mode" envconfig:"error_mode" yaml:"error_mode" toml:"error_mode"` Address string `mapstructure:"address" json:"address" envconfig:"address" yaml:"address" toml:"address"` Port int `mapstructure:"port" json:"port" envconfig:"port" default:"10000" yaml:"port" toml:"port"` Key string `mapstructure:"key" json:"key" envconfig:"key" yaml:"key" toml:"key"` TLS TLSConfig `mapstructure:"tls" json:"tls" envconfig:"tls" yaml:"tls" toml:"tls"` Reflection bool `mapstructure:"reflection" json:"reflection" envconfig:"reflection" yaml:"reflection" toml:"reflection"` MaxReceiveMessageSize int `` /* 172-byte string literal not displayed */ }
type HTTP3 ¶
type HTTP3 struct {
Enabled bool `mapstructure:"enabled" json:"enabled" envconfig:"enabled" yaml:"enabled" toml:"enabled"`
}
HTTP3 is EXPERIMENTAL.
type HTTPServer ¶
type HTTPServer struct { // Address to bind HTTP server to. Address string `mapstructure:"address" json:"address" envconfig:"address" toml:"address" yaml:"address"` // Port to bind HTTP server to. Port int `mapstructure:"port" json:"port" envconfig:"port" default:"8000" toml:"port" yaml:"port"` // InternalAddress to bind internal HTTP server to. Internal server is used to serve endpoints // which are normally should not be exposed to the outside world. InternalAddress string `` /* 132-byte string literal not displayed */ // InternalPort to bind internal HTTP server to. InternalPort string `mapstructure:"internal_port" json:"internal_port" envconfig:"internal_port" toml:"internal_port" yaml:"internal_port"` // TLS configuration for HTTP server. TLS TLSConfig `mapstructure:"tls" json:"tls" envconfig:"tls" toml:"tls" yaml:"tls"` // TLSAutocert for automatic TLS certificates from ACME provider (ex. Let's Encrypt). TLSAutocert TLSAutocert `mapstructure:"tls_autocert" json:"tls_autocert" envconfig:"tls_autocert" toml:"tls_autocert" yaml:"tls_autocert"` // TLSExternal enables TLS only for external HTTP endpoints. TLSExternal bool `mapstructure:"tls_external" json:"tls_external" envconfig:"tls_external" toml:"tls_external" yaml:"tls_external"` // InternalTLS is a custom configuration for internal HTTP endpoints. If not set InternalTLS will be the same as TLS. InternalTLS TLSConfig `mapstructure:"internal_tls" json:"internal_tls" envconfig:"internal_tls" toml:"internal_tls" yaml:"internal_tls"` // HTTP3 allows enabling HTTP/3 support. EXPERIMENTAL. HTTP3 HTTP3 `mapstructure:"http3" json:"http3" envconfig:"http3" toml:"http3" yaml:"http3"` }
HTTPServer configuration.
type HTTPStream ¶
type HTTPStream struct { Enabled bool `mapstructure:"enabled" json:"enabled" envconfig:"enabled" yaml:"enabled" toml:"enabled"` HandlerPrefix string `` /* 156-byte string literal not displayed */ MaxRequestBodySize int `` /* 173-byte string literal not displayed */ }
HTTPStream client real-time transport configuration.
type HttpAPI ¶
type HttpAPI struct { Disabled bool `mapstructure:"disabled" json:"disabled" envconfig:"disabled" yaml:"disabled" toml:"disabled"` HandlerPrefix string `` /* 137-byte string literal not displayed */ Key string `mapstructure:"key" json:"key" envconfig:"key" yaml:"key" toml:"key"` ErrorMode string `mapstructure:"error_mode" json:"error_mode" envconfig:"error_mode" yaml:"error_mode" toml:"error_mode"` External bool `mapstructure:"external" json:"external" envconfig:"external" yaml:"external" toml:"external"` Insecure bool `mapstructure:"insecure" json:"insecure" envconfig:"insecure" yaml:"insecure" toml:"insecure"` }
type HttpStatusToCodeTransform ¶
type HttpStatusToCodeTransform struct { // StatusCode is an HTTP status code to transform. StatusCode int `mapstructure:"status_code" json:"status_code" envconfig:"status_code" yaml:"status_code" toml:"status_code"` // ToError is a transform to protocol error. ToError TransformError `mapstructure:"to_error" json:"to_error" envconfig:"to_error" yaml:"to_error" toml:"to_error"` // ToDisconnect is a transform to protocol disconnect. ToDisconnect TransformDisconnect `mapstructure:"to_disconnect" json:"to_disconnect" envconfig:"to_disconnect" yaml:"to_disconnect" toml:"to_disconnect"` }
type HttpStatusToCodeTransforms ¶
type HttpStatusToCodeTransforms []HttpStatusToCodeTransform
func (*HttpStatusToCodeTransforms) Decode ¶
func (d *HttpStatusToCodeTransforms) Decode(value string) error
Decode to implement the envconfig.Decoder interface
type KafkaConsumerConfig ¶
type KafkaConsumerConfig struct { Brokers []string `mapstructure:"brokers" json:"brokers" envconfig:"brokers" yaml:"brokers" toml:"brokers"` Topics []string `mapstructure:"topics" json:"topics" envconfig:"topics" yaml:"topics" toml:"topics"` ConsumerGroup string `mapstructure:"consumer_group" json:"consumer_group" envconfig:"consumer_group" yaml:"consumer_group" toml:"consumer_group"` MaxPollRecords int `` /* 146-byte string literal not displayed */ // FetchMaxBytes is the maximum number of bytes to fetch from Kafka in a single request. // If not set the default 50MB is used. FetchMaxBytes int32 `` /* 127-byte string literal not displayed */ // FetchMaxWait is the maximum time to wait for records when polling. // If not set, defaults to 500ms. FetchMaxWait Duration `` /* 138-byte string literal not displayed */ // FetchReadUncommitted is a flag to enable reading uncommitted messages from Kafka. By default, this is false and Centrifugo uses ReadCommitted mode. FetchReadUncommitted bool `` /* 178-byte string literal not displayed */ // PartitionQueueMaxSize is the maximum number of items in partition queue before pausing consuming from a partition. // The actual queue size may exceed this value on `max_poll_records`, so this acts more like a threshold. // If -1, pausing is done on every poll. If set, pausing only happens when queue size exceeds this threshold. PartitionQueueMaxSize int `` /* 187-byte string literal not displayed */ // TLS for the connection to Kafka. TLS TLSConfig `mapstructure:"tls" json:"tls" envconfig:"tls" yaml:"tls" toml:"tls"` // SASLMechanism when not empty enables SASL auth. SASLMechanism string `mapstructure:"sasl_mechanism" json:"sasl_mechanism" envconfig:"sasl_mechanism" yaml:"sasl_mechanism" toml:"sasl_mechanism"` SASLUser string `mapstructure:"sasl_user" json:"sasl_user" envconfig:"sasl_user" yaml:"sasl_user" toml:"sasl_user"` SASLPassword string `mapstructure:"sasl_password" json:"sasl_password" envconfig:"sasl_password" yaml:"sasl_password" toml:"sasl_password"` // MethodHeader is a header name to extract method name from Kafka message. // If provided in message, then payload must be just a serialized API request object. MethodHeader string `` /* 145-byte string literal not displayed */ // PublicationDataMode is a configuration for the mode where message payload already // contains data ready to publish into channels, instead of API command. PublicationDataMode KafkaPublicationDataModeConfig `` /* 157-byte string literal not displayed */ }
KafkaConsumerConfig is a configuration for Kafka async consumer.
func (KafkaConsumerConfig) Validate ¶
func (c KafkaConsumerConfig) Validate() error
type KafkaPublicationDataModeConfig ¶
type KafkaPublicationDataModeConfig struct { // Enabled enables Kafka publication data mode for the Kafka consumer. Enabled bool `mapstructure:"enabled" json:"enabled" envconfig:"enabled" yaml:"enabled" toml:"enabled"` // ChannelsHeader is a header name to extract channels to publish data into // (channels must be comma-separated). Ex. of value: "channel1,channel2". ChannelsHeader string `` /* 157-byte string literal not displayed */ // IdempotencyKeyHeader is a header name to extract Publication idempotency key from // Kafka message. See https://centrifugal.dev/docs/server/server_api#publishrequest. IdempotencyKeyHeader string `` /* 199-byte string literal not displayed */ // DeltaHeader is a header name to extract Publication delta flag from Kafka message // which tells Centrifugo whether to use delta compression for message or not. // See https://centrifugal.dev/docs/server/delta_compression and // https://centrifugal.dev/docs/server/server_api#publishrequest. DeltaHeader string `` /* 139-byte string literal not displayed */ // VersionHeader is a header name to extract Publication version from Kafka message. VersionHeader string `` /* 151-byte string literal not displayed */ // VersionEpochHeader is a header name to extract Publication version epoch from Kafka message. VersionEpochHeader string `` /* 187-byte string literal not displayed */ // TagsHeaderPrefix is a prefix for headers that contain tags to attach to Publication. TagsHeaderPrefix string `` /* 168-byte string literal not displayed */ }
KafkaPublicationDataModeConfig is a configuration for Kafka publication data mode. In this mode we expect Kafka message payload to contain data ready to publish into channels, instead of API command. All other fields used to build channel Publication can be passed in Kafka message headers – thus it's possible to integrate existing topics with Centrifugo.
type Log ¶
type Log struct { // Level is a log level for Centrifugo logger. Supported values: `none`, `trace`, `debug`, `info`, `warn`, `error`. Level string `mapstructure:"level" default:"info" json:"level" envconfig:"level" toml:"level" yaml:"level"` // File is a path to log file. If not set logs go to stdout. File string `mapstructure:"file" json:"file" envconfig:"file" toml:"file" yaml:"file"` }
Log configuration.
type MapStringString ¶
func (*MapStringString) Decode ¶
func (s *MapStringString) Decode(value string) error
type NamedProxies ¶
type NamedProxies []NamedProxy
func (*NamedProxies) Decode ¶
func (d *NamedProxies) Decode(value string) error
Decode to implement the envconfig.Decoder interface
type NamedProxy ¶
type NatsBroker ¶
type NatsBroker struct { NatsPrefixed `mapstructure:",squash" yaml:",inline"` // AllowWildcards allows to enable wildcard subscriptions. By default, wildcard subscriptions // are not allowed. Using wildcard subscriptions can't be combined with join/leave events and presence // because subscriptions do not belong to a concrete channel after with wildcards, while join/leave events // require concrete channel to be published. And presence does not make a lot of sense for wildcard // subscriptions - there could be subscribers which use different mask, but still receive subset of updates. // It's required to use channels without wildcards to for mentioned features to work properly. When // using wildcard subscriptions a special care is needed regarding security - pay additional // attention to a proper permission management. AllowWildcards bool `` /* 127-byte string literal not displayed */ // RawMode allows enabling raw communication with Nats. When on, Centrifugo subscribes to channels // without adding any prefixes to channel name. Proper prefixes must be managed by the application in this // case. Data consumed from Nats is sent directly to subscribers without any processing. When publishing // to Nats Centrifugo does not add any prefixes to channel names also. Centrifugo features like Publication // tags, Publication ClientInfo, join/leave events are not supported in raw mode. RawMode RawModeConfig `mapstructure:"raw_mode" json:"raw_mode" envconfig:"raw_mode" yaml:"raw_mode" toml:"raw_mode"` }
NatsBroker configuration.
type NatsCommon ¶ added in v6.2.3
type NatsCommon struct { // URL is a Nats server URL. URL string `mapstructure:"url" json:"url" envconfig:"url" yaml:"url" toml:"url" default:"nats://localhost:4222"` // DialTimeout is a timeout for establishing connection to Nats. DialTimeout Duration `mapstructure:"dial_timeout" default:"1s" json:"dial_timeout" envconfig:"dial_timeout" yaml:"dial_timeout" toml:"dial_timeout"` // WriteTimeout is a timeout for write operation to Nats. WriteTimeout Duration `` /* 130-byte string literal not displayed */ // TLS for the Nats connection. TLS is not used if nil. TLS TLSConfig `mapstructure:"tls" json:"tls" envconfig:"tls" yaml:"tls" toml:"tls"` }
type NatsJetStreamConsumerConfig ¶ added in v6.2.0
type NatsJetStreamConsumerConfig struct { // URL is the address of the NATS server. URL string `mapstructure:"url" default:"nats://127.0.0.1:4222" json:"url" toml:"url" yaml:"url"` // CredentialsFile is the path to a NATS credentials file used for authentication (nats.UserCredentials). // If provided, it overrides username/password and token. CredentialsFile string `mapstructure:"credentials_file" json:"credentials_file" toml:"credentials_file" yaml:"credentials_file"` // Username is used for basic authentication (along with Password) if CredentialsFile is not provided. Username string `mapstructure:"username" json:"username" toml:"username" yaml:"username"` // Password is used with Username for basic authentication. Password string `mapstructure:"password" json:"password" toml:"password" yaml:"password"` // Token is an alternative authentication mechanism if CredentialsFile and Username are not provided. Token string `mapstructure:"token" json:"token" toml:"token" yaml:"token"` // StreamName is the name of the NATS JetStream stream to use. StreamName string `mapstructure:"stream_name" json:"stream_name" toml:"stream_name" yaml:"stream_name"` // Subjects is the list of NATS subjects (topics) to filter. Subjects []string `mapstructure:"subjects" json:"subjects" toml:"subjects" yaml:"subjects"` // DurableConsumerName sets the name of the durable JetStream consumer to use. DurableConsumerName string `mapstructure:"durable_consumer_name" json:"durable_consumer_name" toml:"durable_consumer_name" yaml:"durable_consumer_name"` // DeliverPolicy is the NATS JetStream delivery policy for the consumer. By default, it is set to "new". Possible values: `new`, `all`. DeliverPolicy string `mapstructure:"deliver_policy" default:"new" json:"deliver_policy" toml:"deliver_policy" yaml:"deliver_policy"` // MaxAckPending is the maximum number of unacknowledged messages that can be pending for the consumer. MaxAckPending int `mapstructure:"max_ack_pending" default:"100" json:"max_ack_pending" toml:"max_ack_pending" yaml:"max_ack_pending"` // MethodHeader is the NATS message header used to extract the method name for dispatching commands. // If provided in message, then payload must be just a serialized API request object. MethodHeader string `mapstructure:"method_header" default:"centrifugo-method" json:"method_header" toml:"method_header" yaml:"method_header"` // PublicationDataMode configures extraction of pre-formatted publication data from message headers. PublicationDataMode NatsJetStreamPublicationDataModeConfig `mapstructure:"publication_data_mode" json:"publication_data_mode" toml:"publication_data_mode" yaml:"publication_data_mode"` // TLS is the configuration for TLS. TLS TLSConfig `mapstructure:"tls" json:"tls" toml:"tls" yaml:"tls"` }
NatsJetStreamConsumerConfig holds configuration for the NATS JetStream consumer.
func (NatsJetStreamConsumerConfig) Validate ¶ added in v6.2.0
func (cfg NatsJetStreamConsumerConfig) Validate() error
Validate validates the required fields.
type NatsJetStreamPublicationDataModeConfig ¶ added in v6.2.0
type NatsJetStreamPublicationDataModeConfig struct { // Enabled toggles publication data mode. Enabled bool `mapstructure:"enabled" json:"enabled" toml:"enabled" yaml:"enabled"` // ChannelsHeader is the name of the header that contains comma-separated channel names. ChannelsHeader string `` /* 129-byte string literal not displayed */ // IdempotencyKeyHeader is the name of the header that contains an idempotency key for deduplication. IdempotencyKeyHeader string `` /* 165-byte string literal not displayed */ // DeltaHeader is the name of the header indicating whether the message represents a delta (partial update). DeltaHeader string `mapstructure:"delta_header" default:"centrifugo-delta" json:"delta_header" toml:"delta_header" yaml:"delta_header"` // VersionHeader is the name of the header that contains the version of the message. VersionHeader string `mapstructure:"version_header" default:"centrifugo-version" json:"version_header" toml:"version_header" yaml:"version_header"` // VersionEpochHeader is the name of the header that contains the version epoch of the message. VersionEpochHeader string `` /* 154-byte string literal not displayed */ // TagsHeaderPrefix is the prefix used to extract dynamic tags from message headers. TagsHeaderPrefix string `` /* 137-byte string literal not displayed */ }
NatsJetStreamPublicationDataModeConfig holds settings for publication data mode.
type NatsPrefixed ¶ added in v6.2.3
type NatsPrefixed struct { // Prefix allows customizing channel prefix in Nats to work with a single Nats from different // unrelated Centrifugo setups. Prefix string `mapstructure:"prefix" default:"centrifugo" json:"prefix" envconfig:"prefix" yaml:"prefix" toml:"prefix"` // NatsCommon contains common Nats configuration. NatsCommon `mapstructure:",squash" yaml:",inline"` }
type Node ¶
type Node struct { // Name is a human-readable name of Centrifugo node in cluster. This must be unique for each running node // in a cluster. By default, Centrifugo constructs name from the hostname and port. Name is shown in admin web // interface. For communication between nodes in a cluster, Centrifugo uses another identifier – unique ID // generated on node start, so node name plays just a human-readable identifier role. Name string `mapstructure:"name" json:"name" envconfig:"name" yaml:"name" toml:"name"` // InfoMetricsAggregateInterval is a time interval to aggregate node info metrics. InfoMetricsAggregateInterval Duration `` /* 221-byte string literal not displayed */ }
type OpenTelemetry ¶
type OpenTelemetry struct { Enabled bool `mapstructure:"enabled" json:"enabled" envconfig:"enabled" yaml:"enabled" toml:"enabled"` API bool `mapstructure:"api" json:"api" envconfig:"api" yaml:"api" toml:"api"` Consuming bool `mapstructure:"consuming" json:"consuming" envconfig:"consuming" yaml:"consuming" toml:"consuming"` }
type PEMData ¶
type PEMData string
PEMData represents a flexible PEM-encoded source. The order sources checked is the following: 1. Raw PEM content 2. Base64 encoded PEM content 3. Path to file with PEM content
func (PEMData) Load ¶
func (p PEMData) Load(statFile StatFileFunc, readFile ReadFileFunc) ([]byte, string, error)
Load detects if PEMData is a file path, base64 string, or raw PEM string and loads the content.
func (PEMData) MarshalJSON ¶
MarshalJSON converts PEMData to JSON.
func (PEMData) MarshalText ¶
MarshalText converts PEMData to text for TOML.
func (PEMData) MarshalYAML ¶
MarshalYAML converts PEMData to a YAML-compatible format.
func (*PEMData) UnmarshalJSON ¶
UnmarshalJSON parses PEMData from JSON.
func (*PEMData) UnmarshalText ¶
UnmarshalText parses PEMData from text (used in TOML).
func (*PEMData) UnmarshalYAML ¶
UnmarshalYAML parses PEMData from YAML.
type PingPong ¶
type PingPong struct { // PingInterval tells how often to issue server-to-client pings. // To disable sending app-level pings use -1. PingInterval Duration `` /* 131-byte string literal not displayed */ // PongTimeout sets time for pong check after issuing a ping. To disable pong checks use -1. // PongTimeout must be less than PingInterval in current implementation. PongTimeout Duration `mapstructure:"pong_timeout" json:"pong_timeout" envconfig:"pong_timeout" default:"8s" yaml:"pong_timeout" toml:"pong_timeout"` }
PingPong allows configuring application level ping-pong behavior. Note that in current implementation PingPongConfig.PingInterval must be greater than PingPongConfig.PongTimeout.
type PostgresConsumerConfig ¶
type PostgresConsumerConfig struct { DSN string `mapstructure:"dsn" json:"dsn" envconfig:"dsn" yaml:"dsn" toml:"dsn"` OutboxTableName string `` /* 137-byte string literal not displayed */ NumPartitions int `` /* 134-byte string literal not displayed */ PartitionSelectLimit int `` /* 176-byte string literal not displayed */ PartitionPollInterval Duration `` /* 183-byte string literal not displayed */ PartitionNotificationChannel string `` /* 202-byte string literal not displayed */ TLS TLSConfig `mapstructure:"tls" json:"tls" envconfig:"tls" yaml:"tls" toml:"tls"` // UseTryLock when enabled tells Centrifugo to use pg_try_advisory_xact_lock instead of pg_advisory_xact_lock. UseTryLock bool `` /* 128-byte string literal not displayed */ }
PostgresConsumerConfig is a configuration for Postgres async outbox table consumer.
func (PostgresConsumerConfig) Validate ¶
func (c PostgresConsumerConfig) Validate() error
type PresenceManager ¶
type PresenceManager struct { Enabled bool `mapstructure:"enabled" json:"enabled" envconfig:"enabled" yaml:"enabled" toml:"enabled"` // Type of presence manager to use. Can be "memory" or "redis" at this point. Type string `mapstructure:"type" default:"memory" json:"type" envconfig:"type" yaml:"type" toml:"type"` // Redis is a configuration for "redis" broker. Redis RedisPresenceManager `mapstructure:"redis" json:"redis" envconfig:"redis" toml:"redis" yaml:"redis"` }
type Prometheus ¶
type Prometheus struct { Enabled bool `mapstructure:"enabled" json:"enabled" envconfig:"enabled" yaml:"enabled" toml:"enabled"` HandlerPrefix string `` /* 141-byte string literal not displayed */ // InstrumentHTTPHandlers enables additional instrumentation of HTTP handlers // (extra middleware to track status codes). Optional since adds some overhead. InstrumentHTTPHandlers bool `` /* 172-byte string literal not displayed */ // RecoveredPublicationsHistogram enables a histogram to track the distribution of recovered publications number. RecoveredPublicationsHistogram bool `` /* 212-byte string literal not displayed */ }
type Proxy ¶
type Proxy struct { // Endpoint - HTTP address or GRPC service endpoint. Endpoint string `mapstructure:"endpoint" json:"endpoint" envconfig:"endpoint" yaml:"endpoint" toml:"endpoint"` // Timeout for proxy request. Timeout Duration `mapstructure:"timeout" default:"1s" json:"timeout" envconfig:"timeout" yaml:"timeout" toml:"timeout"` ProxyCommon `mapstructure:",squash" yaml:",inline"` TestGrpcDialer func(context.Context, string) (net.Conn, error) `json:"-" yaml:"-" toml:"-" envconfig:"-"` }
Proxy configuration.
type ProxyCommon ¶
type ProxyCommon struct { // HttpHeaders is a list of HTTP headers to proxy. No headers used by proxy by default. // If GRPC proxy is used then request HTTP headers set to outgoing request metadata. HttpHeaders []string `mapstructure:"http_headers" json:"http_headers" envconfig:"http_headers" yaml:"http_headers" toml:"http_headers"` // GrpcMetadata is a list of GRPC metadata keys to proxy. No meta keys used by proxy by // default. If HTTP proxy is used then these keys become outgoing request HTTP headers. GrpcMetadata []string `mapstructure:"grpc_metadata" json:"grpc_metadata" envconfig:"grpc_metadata" yaml:"grpc_metadata" toml:"grpc_metadata"` // BinaryEncoding makes proxy send data as base64 string (assuming it contains custom // non-JSON payload). BinaryEncoding bool `` /* 127-byte string literal not displayed */ // IncludeConnectionMeta to each proxy request (except connect proxy where it's obtained). IncludeConnectionMeta bool `` /* 167-byte string literal not displayed */ HTTP ProxyCommonHTTP `mapstructure:"http" json:"http" envconfig:"http" yaml:"http" toml:"http"` GRPC ProxyCommonGRPC `mapstructure:"grpc" json:"grpc" envconfig:"grpc" yaml:"grpc" toml:"grpc"` }
type ProxyCommonGRPC ¶
type ProxyCommonGRPC struct { // TLS is a common configuration for GRPC client TLS. TLS TLSConfig `mapstructure:"tls" json:"tls" envconfig:"tls" yaml:"tls" toml:"tls"` // CredentialsKey is a custom key to add into per-RPC credentials. CredentialsKey string `` /* 127-byte string literal not displayed */ // CredentialsValue is a custom value for GrpcCredentialsKey. CredentialsValue string `` /* 137-byte string literal not displayed */ // Compression enables compression for outgoing calls (gzip). Compression bool `mapstructure:"compression" json:"compression" envconfig:"compression" yaml:"compression" toml:"compression"` }
type ProxyCommonHTTP ¶
type ProxyCommonHTTP struct { // TLS for HTTP client. TLS TLSConfig `mapstructure:"tls" json:"tls" envconfig:"tls" yaml:"tls" toml:"tls"` // StaticHeaders is a static set of key/value pairs to attach to HTTP proxy request as // headers. Headers received from HTTP client request or metadata from GRPC client request // both have priority over values set in StaticHttpHeaders map. StaticHeaders MapStringString `` /* 135-byte string literal not displayed */ // StatusToCodeTransforms allow to map HTTP status codes from proxy to Disconnect or Error messages. StatusToCodeTransforms HttpStatusToCodeTransforms `` /* 190-byte string literal not displayed */ }
type RPC ¶
type RPC struct { // Proxy configuration for rpc-related events. Can be referenced by the name "default". Proxy Proxy `mapstructure:"proxy" json:"proxy" envconfig:"proxy" toml:"proxy" yaml:"proxy"` // WithoutNamespace is a configuration of RpcOptions for rpc methods without rpc namespace. Generally, // we recommend always use rpc namespaces but this option can be useful for simple setups. WithoutNamespace RpcOptions `` /* 137-byte string literal not displayed */ // RPCNamespaces is a list of rpc namespaces. Each rpc namespace can have its own set of rules. Namespaces RPCNamespaces `mapstructure:"namespaces" default:"[]" json:"namespaces" envconfig:"namespaces" yaml:"namespaces" toml:"namespaces"` // Ping is a configuration for RPC ping method. Ping RPCPing `mapstructure:"ping" json:"ping" envconfig:"ping" yaml:"ping" toml:"ping"` // NamespaceBoundary allows to set a custom boundary for rpc namespaces. NamespaceBoundary string `` /* 154-byte string literal not displayed */ }
type RPCNamespaces ¶
type RPCNamespaces []RpcNamespace
func (*RPCNamespaces) Decode ¶
func (d *RPCNamespaces) Decode(value string) error
Decode to implement the envconfig.Decoder interface
type RPCPing ¶
type RPCPing struct { // Enabled allows to enable ping method. Enabled bool `mapstructure:"enabled" json:"enabled" envconfig:"enabled" yaml:"enabled" toml:"enabled"` // Method can be used to override the name of ping method to use. Method string `mapstructure:"method" json:"method" envconfig:"method" default:"ping" yaml:"method" toml:"method"` }
type RawModeConfig ¶
type RawModeConfig struct { // Enabled enables raw mode when true. Enabled bool `mapstructure:"enabled" json:"enabled" envconfig:"enabled" yaml:"enabled" toml:"enabled"` // ChannelReplacements is a map where keys are strings to replace and values are replacements. // For example, you have Centrifugo namespace "chat" and using channel "chat:index", but you want to // use channel "chat.index" in Nats. Then you can define SymbolReplacements map like this: `{":": "."}`. // In this case Centrifugo will replace all ":" symbols in channel name with "." before sending to Nats. // Broker keeps reverse mapping to the original channel to broadcast to proper channels when processing // messages received from Nats. ChannelReplacements MapStringString `` /* 165-byte string literal not displayed */ // Prefix is a string that will be added to all channels when publishing messages to Nats, subscribing // to channels in Nats. It's also stripped from channel name when processing messages received from Nats. // By default, no prefix is used. Prefix string `mapstructure:"prefix" json:"prefix" envconfig:"prefix" yaml:"prefix" toml:"prefix"` }
type ReadFileFunc ¶
ReadFileFunc is like os.ReadFile but helps in testing.
type Redis ¶
type Redis struct { // Address is a list of Redis shard addresses. In most cases a single shard is used. But when many // addresses provided Centrifugo will distribute keys between shards using consistent hashing. Address []string `mapstructure:"address" json:"address" envconfig:"address" default:"redis://127.0.0.1:6379" yaml:"address" toml:"address"` // ConnectTimeout is a timeout for establishing connection to Redis. ConnectTimeout Duration `` /* 140-byte string literal not displayed */ // IOTimeout is a timeout for all read/write operations against Redis (can be considered as a request timeout). IOTimeout Duration `mapstructure:"io_timeout" json:"io_timeout" envconfig:"io_timeout" default:"4s" yaml:"io_timeout" toml:"io_timeout"` // DB is a Redis database to use. Generally it's not recommended to use non-zero DB. Note, that Redis // PUB/SUB is global for all databases in a single Redis instance. So when using non-zero DB make sure // that different Centrifugo setups use different prefixes. DB int `mapstructure:"db" json:"db" envconfig:"db" default:"0" yaml:"db" toml:"db"` // User is a Redis user. User string `mapstructure:"user" json:"user" envconfig:"user" yaml:"user" toml:"user"` // Password is a Redis password. Password string `mapstructure:"password" json:"password" envconfig:"password" yaml:"password" toml:"password"` // ClientName allows changing a Redis client name used when connecting. ClientName string `mapstructure:"client_name" json:"client_name" envconfig:"client_name" yaml:"client_name" toml:"client_name"` // ForceResp2 forces use of Redis Resp2 protocol for communication. ForceResp2 bool `mapstructure:"force_resp2" json:"force_resp2" envconfig:"force_resp2" yaml:"force_resp2" toml:"force_resp2"` // ClusterAddress is a list of Redis cluster addresses. When several provided - data will be sharded // between them using consistent hashing. Several Cluster addresses within one shard may be passed // comma-separated. ClusterAddress []string `` /* 127-byte string literal not displayed */ // TLS is a configuration for Redis TLS support. TLS TLSConfig `mapstructure:"tls" json:"tls" envconfig:"tls" yaml:"tls" toml:"tls"` // SentinelAddress allows setting Redis Sentinel addresses. When provided - Sentinel will be used. // When multiple addresses provided - data will be sharded between them using consistent hashing. // Several Sentinel addresses within one shard may be passed comma-separated. SentinelAddress []string `` /* 132-byte string literal not displayed */ // SentinelUser is a Redis Sentinel user. SentinelUser string `mapstructure:"sentinel_user" json:"sentinel_user" envconfig:"sentinel_user" yaml:"sentinel_user" toml:"sentinel_user"` // SentinelPassword is a Redis Sentinel password. SentinelPassword string `` /* 137-byte string literal not displayed */ // SentinelMasterName is a Redis master name in Sentinel setup. SentinelMasterName string `` /* 152-byte string literal not displayed */ // SentinelClientName is a Redis Sentinel client name used when connecting. SentinelClientName string `` /* 152-byte string literal not displayed */ // SentinelTLS is a configuration for Redis Sentinel TLS support. SentinelTLS TLSConfig `mapstructure:"sentinel_tls" json:"sentinel_tls" envconfig:"sentinel_tls" yaml:"sentinel_tls" toml:"sentinel_tls"` // ReplicaClient is a configuration fot Redis replica client. ReplicaClient RedisReplicaClient `mapstructure:"replica_client" json:"replica_client" envconfig:"replica_client" yaml:"replica_client" toml:"replica_client"` }
type RedisBroker ¶
type RedisBroker struct { RedisPrefixed `mapstructure:",squash" yaml:",inline"` RedisBrokerCommon `mapstructure:",squash" yaml:",inline"` }
type RedisBrokerCommon ¶
type RedisBrokerCommon struct { // UseLists enables usage of Redis Lists for history storage. Lists do not support pagination, // idempotent publish and reverse order history retrieval. UseLists bool `` /* 137-byte string literal not displayed */ }
type RedisEngine ¶
type RedisEngine struct { RedisPrefixed `mapstructure:",squash" yaml:",inline"` EngineRedisBroker `mapstructure:",squash" yaml:",inline"` EngineRedisPresenceManager `mapstructure:",squash" yaml:",inline"` }
RedisEngine configuration.
type RedisNatsBroker ¶
type RedisNatsBroker struct { Redis RedisBroker `mapstructure:"redis" json:"redis" envconfig:"redis" toml:"redis" yaml:"redis"` Nats NatsBroker `mapstructure:"nats" json:"nats" envconfig:"nats" toml:"nats" yaml:"nats"` }
RedisNatsBroker configuration.
type RedisPrefixed ¶ added in v6.2.0
type RedisPresenceManager ¶
type RedisPresenceManager struct { RedisPrefixed `mapstructure:",squash" yaml:",inline"` RedisPresenceManagerCommon `mapstructure:",squash" yaml:",inline"` }
type RedisPresenceManagerCommon ¶
type RedisPresenceManagerCommon struct { // PresenceTTL is a period of time while presence information is considered valid. PresenceTTL Duration `` /* 126-byte string literal not displayed */ // PresenceHashFieldTTL enables using hash per-field expiration for presence. PresenceHashFieldTTL bool `` /* 167-byte string literal not displayed */ // PresenceUserMapping enables optimization for presence stats keeping a separate hash of subscribed users in Redis. PresenceUserMapping bool `` /* 157-byte string literal not displayed */ }
type RedisReplicaClient ¶ added in v6.2.0
type RedisReplicaClient struct { // Enabled enables replica client. Enabled bool `mapstructure:"enabled" json:"enabled" envconfig:"enabled" yaml:"enabled" toml:"enabled"` }
RedisReplicaClient allows configuring Redis replica options.
type RedisStreamConsumerConfig ¶ added in v6.2.0
type RedisStreamConsumerConfig struct { Redis `mapstructure:",squash" yaml:",inline"` // Streams to consume. Streams []string `mapstructure:"streams" json:"streams" yaml:"streams" toml:"streams"` // ConsumerGroup name to use. ConsumerGroup string `mapstructure:"consumer_group" json:"consumer_group" yaml:"consumer_group" toml:"consumer_group"` // VisibilityTimeout is the time to wait for a message to be processed before it is re-queued. VisibilityTimeout Duration `mapstructure:"visibility_timeout" default:"30s" json:"visibility_timeout" yaml:"visibility_timeout" toml:"visibility_timeout"` // NumWorkers is the number of message workers to use for processing for each stream. NumWorkers int `mapstructure:"num_workers" default:"1" json:"num_workers" yaml:"num_workers" toml:"num_workers"` // PayloadValue is used to extract data from Redis Stream message. PayloadValue string `mapstructure:"payload_value" default:"payload" json:"payload_value" yaml:"payload_value" toml:"payload_value"` // MethodValue is used to extract a method for command messages. // If provided in message, then payload must be just a serialized API request object. MethodValue string `mapstructure:"method_value" default:"method" json:"method_value" yaml:"method_value" toml:"method_value"` // PublicationDataMode configures publication data mode. PublicationDataMode RedisStreamPublicationDataModeConfig `mapstructure:"publication_data_mode" json:"publication_data_mode" yaml:"publication_data_mode" toml:"publication_data_mode"` }
RedisStreamConsumerConfig holds configuration for the Redis Streams consumer.
func (RedisStreamConsumerConfig) Validate ¶ added in v6.2.0
func (c RedisStreamConsumerConfig) Validate() error
Validate validates required fields in the config.
type RedisStreamPublicationDataModeConfig ¶ added in v6.2.0
type RedisStreamPublicationDataModeConfig struct { // Enabled toggles publication data mode. Enabled bool `mapstructure:"enabled" json:"enabled" yaml:"enabled" toml:"enabled"` // ChannelsValue is used to extract channels to publish data into (channels must be comma-separated). ChannelsValue string `mapstructure:"channels_value" default:"centrifugo-channels" json:"channels_value" yaml:"channels_value" toml:"channels_value"` // IdempotencyKeyValue is used to extract Publication idempotency key from Redis Stream message. IdempotencyKeyValue string `` /* 160-byte string literal not displayed */ // DeltaValue is used to extract Publication delta flag from Redis Stream message. DeltaValue string `mapstructure:"delta_value" json:"delta_value" default:"centrifugo-delta" yaml:"delta_value" toml:"delta_value"` // VersionValue is used to extract Publication version from Redis Stream message. VersionValue string `mapstructure:"version_value" default:"centrifugo-version" json:"version_value" yaml:"version_value" toml:"version_value"` // VersionEpochValue is used to extract Publication version epoch from Redis Stream message. VersionEpochValue string `` /* 150-byte string literal not displayed */ // TagsValuePrefix is used to extract Publication tags from Redis Stream message. TagsValuePrefix string `` /* 133-byte string literal not displayed */ }
RedisStreamPublicationDataModeConfig holds configuration for publication data mode.
type RefreshProxy ¶
type RpcNamespace ¶
type RpcNamespace struct { // Name is a unique rpc namespace name. Name string `mapstructure:"name" json:"name" envconfig:"name" yaml:"name" toml:"name"` // Options for rpc namespace. RpcOptions `mapstructure:",squash" yaml:",inline"` }
RpcNamespace allows creating rules for different rpc.
type RpcOptions ¶
type RpcOptions struct { // ProxyEnabled allows to enable using RPC proxy for this namespace. ProxyEnabled bool `mapstructure:"proxy_enabled" json:"proxy_enabled" envconfig:"proxy_enabled" yaml:"proxy_enabled" toml:"proxy_enabled"` // ProxyName which should be used for RPC namespace. ProxyName string `mapstructure:"proxy_name" default:"default" json:"proxy_name" envconfig:"proxy_name" yaml:"proxy_name" toml:"proxy_name"` }
RpcOptions can set a custom behaviour for rpc namespace.
type SSE ¶
type SSE struct { Enabled bool `mapstructure:"enabled" json:"enabled" envconfig:"enabled" yaml:"enabled" toml:"enabled"` HandlerPrefix string `` /* 148-byte string literal not displayed */ MaxRequestBodySize int `` /* 173-byte string literal not displayed */ }
SSE client real-time transport configuration.
type Shutdown ¶
type Shutdown struct {
Timeout Duration `mapstructure:"timeout" json:"timeout" envconfig:"timeout" default:"30s" yaml:"timeout" toml:"timeout"`
}
type StatFileFunc ¶
StatFileFunc is like os.Stat but helps in testing.
type SubscribeToUserPersonalChannel ¶
type SubscribeToUserPersonalChannel struct { // Enabled allows to enable the feature. Enabled bool `mapstructure:"enabled" json:"enabled" envconfig:"enabled" yaml:"enabled" toml:"enabled"` // PersonalChannelNamespace is a namespace for personal channels. PersonalChannelNamespace string `` /* 182-byte string literal not displayed */ // SingleConnection allows enabling a mode when Centrifugo will try to maintain a single connection from user. SingleConnection bool `` /* 137-byte string literal not displayed */ }
type SubscriptionToken ¶
type SubscriptionToken struct { // Enabled allows enabling separate configuration for subscription tokens. Enabled bool `mapstructure:"enabled" json:"enabled" envconfig:"enabled" yaml:"enabled" toml:"enabled"` Token `mapstructure:",squash" yaml:",inline"` }
SubscriptionToken can be used to set custom configuration for subscription tokens.
type TLSAutocert ¶
type TLSAutocert struct { Enabled bool `mapstructure:"enabled" json:"enabled" envconfig:"enabled" yaml:"enabled" toml:"enabled"` HostWhitelist []string `mapstructure:"host_whitelist" json:"host_whitelist" envconfig:"host_whitelist" yaml:"host_whitelist" toml:"host_whitelist"` CacheDir string `mapstructure:"cache_dir" json:"cache_dir" envconfig:"cache_dir" yaml:"cache_dir" toml:"cache_dir"` Email string `mapstructure:"email" json:"email" envconfig:"email" yaml:"email" toml:"email"` ServerName string `mapstructure:"server_name" json:"server_name" envconfig:"server_name" yaml:"server_name" toml:"server_name"` HTTP bool `mapstructure:"http" json:"http" envconfig:"http" yaml:"http" toml:"http"` HTTPAddr string `mapstructure:"http_addr" json:"http_addr" envconfig:"http_addr" default:":80" yaml:"http_addr" toml:"http_addr"` }
type TLSConfig ¶
type TLSConfig struct { // Enabled turns on using TLS. Enabled bool `mapstructure:"enabled" json:"enabled" yaml:"enabled" toml:"enabled" envconfig:"enabled"` // CertPem is a PEM certificate. CertPem PEMData `mapstructure:"cert_pem" json:"cert_pem" envconfig:"cert_pem" yaml:"cert_pem" toml:"cert_pem"` // KeyPem is a path to a file with key in PEM format. KeyPem PEMData `mapstructure:"key_pem" json:"key_pem" envconfig:"key_pem" yaml:"key_pem" toml:"key_pem"` // ServerCAPem is a server root CA certificate in PEM format. // The client uses this certificate to verify the server's certificate during the TLS handshake. ServerCAPem PEMData `mapstructure:"server_ca_pem" json:"server_ca_pem" envconfig:"server_ca_pem" yaml:"server_ca_pem" toml:"server_ca_pem"` // ClientCAPem is a client CA certificate in PEM format. // The server uses this certificate to verify the client's certificate during the TLS handshake. ClientCAPem PEMData `mapstructure:"client_ca_pem" json:"client_ca_pem" envconfig:"client_ca_pem" yaml:"client_ca_pem" toml:"client_ca_pem"` // InsecureSkipVerify turns off server certificate verification. InsecureSkipVerify bool `` /* 152-byte string literal not displayed */ // ServerName is used to verify the hostname on the returned certificates. ServerName string `mapstructure:"server_name" json:"server_name" envconfig:"server_name" yaml:"server_name" toml:"server_name"` }
TLSConfig is a common configuration for TLS.
type Token ¶
type Token struct { HMACSecretKey string `` /* 127-byte string literal not displayed */ RSAPublicKey string `mapstructure:"rsa_public_key" json:"rsa_public_key" envconfig:"rsa_public_key" yaml:"rsa_public_key" toml:"rsa_public_key"` ECDSAPublicKey string `` /* 132-byte string literal not displayed */ JWKSPublicEndpoint string `` /* 152-byte string literal not displayed */ Audience string `mapstructure:"audience" json:"audience" envconfig:"audience" yaml:"audience" toml:"audience"` AudienceRegex string `mapstructure:"audience_regex" json:"audience_regex" envconfig:"audience_regex" yaml:"audience_regex" toml:"audience_regex"` Issuer string `mapstructure:"issuer" json:"issuer" envconfig:"issuer" yaml:"issuer" toml:"issuer"` IssuerRegex string `mapstructure:"issuer_regex" json:"issuer_regex" envconfig:"issuer_regex" yaml:"issuer_regex" toml:"issuer_regex"` UserIDClaim string `mapstructure:"user_id_claim" json:"user_id_claim" envconfig:"user_id_claim" yaml:"user_id_claim" toml:"user_id_claim"` }
Token common configuration.
type TransformDisconnect ¶
type TransformError ¶
type TransformError struct { // Code of error. Code uint32 `mapstructure:"code" json:"code" envconfig:"code" yaml:"code" toml:"code"` // Message is a human-readable message of error. Message string `mapstructure:"message" json:"message" envconfig:"message" yaml:"message" toml:"message"` // Temporary is a flag to mark error as temporary. Temporary bool `mapstructure:"temporary" json:"temporary" envconfig:"temporary" yaml:"temporary" toml:"temporary"` }
type UniConnectCodeToDisconnectTransform ¶
type UniConnectCodeToDisconnectTransform struct { // Code is a connect error code. Code uint32 `mapstructure:"code" json:"code" envconfig:"code" yaml:"code" toml:"code"` // To is a disconnect to transform the code to. To TransformDisconnect `mapstructure:"to" json:"to" envconfig:"to" yaml:"to" toml:"to"` }
type UniConnectCodeToDisconnectTransforms ¶
type UniConnectCodeToDisconnectTransforms []UniConnectCodeToDisconnectTransform
func (*UniConnectCodeToDisconnectTransforms) Decode ¶
func (d *UniConnectCodeToDisconnectTransforms) Decode(value string) error
Decode to implement the envconfig.Decoder interface
type UniGRPC ¶
type UniGRPC struct { Enabled bool `mapstructure:"enabled" json:"enabled" envconfig:"enabled" yaml:"enabled" toml:"enabled"` Address string `mapstructure:"address" json:"address" envconfig:"address" yaml:"address" toml:"address"` Port int `mapstructure:"port" json:"port" envconfig:"port" default:"11000" yaml:"port" toml:"port"` MaxReceiveMessageSize int `` /* 172-byte string literal not displayed */ TLS TLSConfig `mapstructure:"tls" json:"tls" envconfig:"tls" yaml:"tls" toml:"tls"` }
UniGRPC client real-time transport configuration.
type UniHTTPStream ¶
type UniHTTPStream struct { Enabled bool `mapstructure:"enabled" json:"enabled" envconfig:"enabled" yaml:"enabled" toml:"enabled"` HandlerPrefix string `` /* 160-byte string literal not displayed */ MaxRequestBodySize int `` /* 173-byte string literal not displayed */ ConnectCodeToHTTPResponse ConnectCodeToHTTPResponse `` /* 197-byte string literal not displayed */ }
UniHTTPStream client real-time transport configuration.
type UniSSE ¶
type UniSSE struct { Enabled bool `mapstructure:"enabled" json:"enabled" envconfig:"enabled" yaml:"enabled" toml:"enabled"` HandlerPrefix string `` /* 152-byte string literal not displayed */ MaxRequestBodySize int `` /* 173-byte string literal not displayed */ ConnectCodeToHTTPResponse ConnectCodeToHTTPResponse `` /* 197-byte string literal not displayed */ }
UniSSE client real-time transport configuration.
type UniWebSocket ¶
type UniWebSocket struct { Enabled bool `mapstructure:"enabled" json:"enabled" envconfig:"enabled" yaml:"enabled" toml:"enabled"` HandlerPrefix string `` /* 158-byte string literal not displayed */ Compression bool `mapstructure:"compression" json:"compression" envconfig:"compression" yaml:"compression" toml:"compression"` CompressionMinSize int `` /* 152-byte string literal not displayed */ CompressionLevel int `` /* 149-byte string literal not displayed */ ReadBufferSize int `` /* 132-byte string literal not displayed */ UseWriteBufferPool bool `` /* 157-byte string literal not displayed */ WriteBufferSize int `` /* 137-byte string literal not displayed */ WriteTimeout Duration `` /* 134-byte string literal not displayed */ MessageSizeLimit int `` /* 158-byte string literal not displayed */ // JoinPushMessages when enabled allow uni_websocket transport to join messages together into // one frame using Centrifugal client protocol delimiters: new line for JSON protocol and // length-prefixed format for Protobuf protocol. This can be useful to reduce system call // overhead when sending many small messages. The client side must be ready to handle such // joined messages coming in one WebSocket frame. JoinPushMessages bool `` /* 142-byte string literal not displayed */ }
UniWebSocket client real-time transport configuration.
type UsageStats ¶
type UsageStats struct {
Disabled bool `mapstructure:"disabled" json:"disabled" envconfig:"disabled" yaml:"disabled" toml:"disabled"`
}
type WebSocket ¶
type WebSocket struct { Disabled bool `mapstructure:"disabled" json:"disabled" envconfig:"disabled" yaml:"disabled" toml:"disabled"` HandlerPrefix string `` /* 154-byte string literal not displayed */ Compression bool `mapstructure:"compression" json:"compression" envconfig:"compression" yaml:"compression" toml:"compression"` CompressionMinSize int `` /* 152-byte string literal not displayed */ CompressionLevel int `` /* 149-byte string literal not displayed */ ReadBufferSize int `` /* 132-byte string literal not displayed */ UseWriteBufferPool bool `` /* 157-byte string literal not displayed */ WriteBufferSize int `` /* 137-byte string literal not displayed */ WriteTimeout Duration `` /* 134-byte string literal not displayed */ MessageSizeLimit int `` /* 158-byte string literal not displayed */ }
WebSocket client real-time transport configuration.
type WebTransport ¶
type WebTransport struct { Enabled bool `mapstructure:"enabled" json:"enabled" envconfig:"enabled" yaml:"enabled" toml:"enabled"` HandlerPrefix string `` /* 157-byte string literal not displayed */ MessageSizeLimit int `` /* 158-byte string literal not displayed */ }
WebTransport client real-time transport configuration.