Documentation
¶
Index ¶
- func DefaultServerConfigMap() map[string]any
- type BoltSessionConfig
- type CacheConfig
- type CheckCmdConfig
- type ConfigLoader
- type DBConfig
- type DBLoggingConfig
- type DBPool
- type EventConfig
- type HTTPLoggingConfig
- type JWTConfig
- type JobsConfig
- type LoggingConfig
- type QueueConfig
- type RedisConfig
- type ServerCmdConfig
- type ServerConfig
- type SessionStorageConfig
- type SyncRunJobConfig
- type SyncTransferJobConfig
- type TGConfig
- type TGLoggingConfig
- type TGMTProxy
- type TGStream
- type TGUpload
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultServerConfigMap ¶
Types ¶
type BoltSessionConfig ¶
type CacheConfig ¶
type CacheConfig struct {
MaxSize int `default:"10485760" description:"Maximum cache size in bytes (used for memory cache)"`
}
type CheckCmdConfig ¶
type CheckCmdConfig struct {
Log LoggingConfig `skipPflag:"true"`
DB DBConfig `skipPflag:"true"`
TG TGConfig `skipPflag:"true"`
ExportFile string `default:"results.json" description:"Path for exported JSON file"`
DryRun bool `default:"false" description:"Simulate check/clean process without making changes"`
User string `default:"" description:"Telegram username to check (prompts if not specified)"`
Concurrent int `default:"4" description:"Number of concurrent channel processing"`
}
type ConfigLoader ¶
type ConfigLoader struct {
// contains filtered or unexported fields
}
func NewConfigLoader ¶
func NewConfigLoader() *ConfigLoader
func (*ConfigLoader) RegisterFlags ¶
func (cl *ConfigLoader) RegisterFlags(flags *pflag.FlagSet, t reflect.Type)
func (*ConfigLoader) Validate ¶
func (cl *ConfigLoader) Validate(cfg any) error
type DBLoggingConfig ¶
type DBLoggingConfig struct {
Level string `default:"error" description:"Database logging level (silent, error, warn, info, debug)"`
SlowThreshold time.Duration `default:"1s" description:"Log queries slower than this threshold"`
LogSQL bool `default:"false" description:"LogSQL"`
}
DBLoggingConfig holds database query logging configuration
type DBPool ¶
type DBPool struct {
Enable bool `default:"true" description:"Enable connection pooling"`
MaxOpenConnections int `default:"25" description:"Maximum number of open connections"`
MaxIdleConnections int `default:"25" description:"Maximum number of idle connections"`
MaxLifetime time.Duration `default:"10m" description:"Maximum connection lifetime"`
}
type EventConfig ¶
type EventConfig struct {
PollInterval time.Duration `default:"10s" description:"Event polling interval for single-instance mode"`
DBWorkers int `default:"10" description:"Number of DB worker goroutines for event persistence"`
DBBufferSize int `default:"1000" description:"Size of DB worker queue buffer"`
DeduplicationTTL time.Duration `default:"5s" description:"Event deduplication time-to-live"`
}
type HTTPLoggingConfig ¶
type HTTPLoggingConfig struct {
Enabled bool `default:"true" description:"Enable HTTP request logging"`
LogQueries bool `default:"false" description:"Log full query strings (use with caution)"`
SanitizeQueries bool `default:"true" description:"Remove sensitive params from query preview"`
MaxQueryLength int `default:"100" description:"Maximum length of query preview"`
LogUserAgent bool `default:"true" description:"Log user agent (truncated)"`
LogRequestBodySize bool `default:"true" description:"Log request Content-Length"`
LogResponseSize bool `default:"true" description:"Log response bytes written"`
SkipPaths []string `default:"/health,/metrics" description:"Paths to skip from logging"`
}
HTTPLoggingConfig holds HTTP request logging configuration
type JobsConfig ¶
type JobsConfig struct {
SyncRun SyncRunJobConfig
SyncTransfer SyncTransferJobConfig
}
type LoggingConfig ¶
type LoggingConfig struct {
Level string `default:"info" description:"Global logging level (debug, info, warn, error)"`
TimeFormat string `default:"2006-01-02 15:04:05" description:"Log time format"`
File string `default:"" description:"Log file path, if empty logs to stdout only"`
HTTP HTTPLoggingConfig
DB DBLoggingConfig
TG TGLoggingConfig
}
type QueueConfig ¶
type RedisConfig ¶
type RedisConfig struct {
Addr string `default:"" description:"Redis server address (empty to disable Redis)"`
Password string `default:"" description:"Redis server password"`
PoolSize int `default:"10" description:"Redis connection pool size"`
MinIdleConns int `default:"5" description:"Redis minimum idle connections"`
MaxIdleConns int `default:"10" description:"Redis maximum idle connections"`
ConnMaxIdleTime time.Duration `default:"5m" description:"Redis connection maximum idle time"`
ConnMaxLifetime time.Duration `default:"1h" description:"Redis connection maximum lifetime"`
}
type ServerCmdConfig ¶
type ServerCmdConfig struct {
Server ServerConfig
Log LoggingConfig
JWT JWTConfig
DB DBConfig
TG TGConfig
Cache CacheConfig
Redis RedisConfig
Queue QueueConfig
Jobs JobsConfig
Events EventConfig
}
type ServerConfig ¶
type ServerConfig struct {
Port int `default:"8080" description:"HTTP port for the server to listen on"`
GracefulShutdown time.Duration `default:"10s" description:"Grace period for server shutdown"`
EnablePprof bool `default:"false" description:"Enable pprof debugging endpoints"`
ReadTimeout time.Duration `default:"1h" description:"Maximum duration for reading entire request"`
WriteTimeout time.Duration `default:"1h" description:"Maximum duration for writing response"`
}
type SessionStorageConfig ¶
type SessionStorageConfig struct {
Type string `default:"postgres" description:"Session storage type: postgres, bolt, memory"`
Key string `default:"session" description:"Key prefix for session storage"`
Bolt BoltSessionConfig `koanf:"bolt"`
}
type SyncRunJobConfig ¶
type SyncRunJobConfig struct {
MaxAttempts int `default:"8" description:"Maximum retry attempts for sync.run jobs"`
}
type SyncTransferJobConfig ¶
type TGConfig ¶
type TGConfig struct {
RateLimit bool `default:"true" description:"Enable rate limiting for API calls"`
RateBurst int `default:"5" description:"Maximum burst size for rate limiting"`
Rate int `default:"100" description:"Rate limit in requests per minute"`
Ntp bool `default:"false" description:"Use NTP for time synchronization"`
NtpServer string `default:"pool.ntp.org" description:"NTP server address"`
Proxy string `default:"" description:"HTTP/SOCKS5 proxy URL"`
MTProxy TGMTProxy `koanf:"mtproxy"`
ReconnectTimeout time.Duration `default:"5m" description:"Client reconnection timeout"`
DialTimeout time.Duration `default:"10s" description:"Timeout for connecting to Telegram servers"`
PoolSize int `default:"8" description:"Session pool size"`
EnableLogging bool `default:"false" description:"Enable Telegram client logging (deprecated: use logging.tg.enabled instead)"`
AppID int `default:"2496" description:"Telegram app ID"`
AppHash string `default:"8da85b0d5bfe62527e5b244c209159c3" description:"Telegram app hash"`
DeviceModel string `default:"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/116.0" description:"Device model"`
SystemVersion string `default:"Win32" description:"System version"`
AppVersion string `default:"6.1.4 K" description:"App version"`
LangCode string `default:"en" description:"Language code"`
SystemLangCode string `default:"en-US" description:"System language code"`
LangPack string `default:"webk" description:"Language pack"`
SessionInstance string `default:"teldrive" description:"Bot session instance name for multi-instance deployments"`
AutoChannelCreate bool `default:"true" description:"Auto Create Channel"`
ChannelLimit int64 `default:"500000" description:"Channel message limit before auto channel creation"`
Uploads TGUpload
Stream TGStream
// Session storage configuration for Telegram sessions
Session SessionStorageConfig
}
type TGLoggingConfig ¶
type TGLoggingConfig struct {
Enabled bool `default:"false" description:"Enable Telegram client internal logging"`
Level string `default:"warn" description:"Telegram client logging level (debug, info, warn, error)"`
}
TGLoggingConfig holds Telegram client logging configuration
type TGStream ¶
type TGStream struct {
Concurrency int `default:"1" description:"Number of concurrent threads for concurrent reader"`
Buffers int `default:"8" description:"Number of stream buffers"`
ChunkTimeout time.Duration `default:"30s" description:"Chunk download timeout"`
BotsLimit int `default:"0" description:"Maximum number of bots for streaming (0 = use all bots)"`
}
type TGUpload ¶
type TGUpload struct {
EncryptionKey string `default:"" description:"Encryption key for uploads"`
Threads int `default:"8" description:"Number of upload threads"`
MaxRetries int `default:"10" description:"Maximum upload retry attempts"`
Retention time.Duration `default:"7d" description:"Upload retention period"`
ChunkNaming string `default:"random" description:"Upload chunk naming mode (random, deterministic)"`
}
Click to show internal directories.
Click to hide internal directories.