config

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2025 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthConfig

type AuthConfig struct {
	Enabled  bool   `yaml:"enabled"`
	RelayURL string `yaml:"relay_url"`
}

type BlacklistConfig

type BlacklistConfig struct {
	Enabled                     bool     `yaml:"enabled"`
	PermanentBanWords           []string `yaml:"permanent_ban_words"`
	TempBanWords                []string `yaml:"temp_ban_words"`
	MaxTempBans                 int      `yaml:"max_temp_bans"`
	TempBanDuration             int      `yaml:"temp_ban_duration"`
	PermanentBlacklistPubkeys   []string `yaml:"permanent_blacklist_pubkeys"`
	PermanentBlacklistNpubs     []string `yaml:"permanent_blacklist_npubs"`
	MuteListAuthors             []string `yaml:"mutelist_authors"`
	MutelistCacheRefreshMinutes int      `yaml:"mutelist_cache_refresh_minutes"`
}

type CategoryLimitConfig

type CategoryLimitConfig struct {
	Regular     LimitBurst `yaml:"regular"`
	Replaceable LimitBurst `yaml:"replaceable"`
	Addressable LimitBurst `yaml:"addressable"`
	Ephemeral   LimitBurst `yaml:"ephemeral"`
}

type EventPurgeConfig

type EventPurgeConfig struct {
	Enabled              bool            `yaml:"enabled"`
	DisableAtStartup     bool            `yaml:"disable_at_startup"`
	KeepIntervalHours    int             `yaml:"keep_interval_hours"`
	PurgeIntervalMinutes int             `yaml:"purge_interval_minutes"`
	PurgeByCategory      map[string]bool `yaml:"purge_by_category"`
	PurgeByKindEnabled   bool            `yaml:"purge_by_kind_enabled"`
	KindsToPurge         []int           `yaml:"kinds_to_purge"`
	ExcludeWhitelisted   bool            `yaml:"exclude_whitelisted"`
}

type EventTimeConstraints

type EventTimeConstraints struct {
	MinCreatedAt       int64  `yaml:"min_created_at"`        // Minimum allowed timestamp
	MinCreatedAtString string `yaml:"min_created_at_string"` // Original string value for parsing (e.g., "now-5m")
	MaxCreatedAt       int64  `yaml:"max_created_at"`        // Maximum allowed timestamp
	MaxCreatedAtString string `yaml:"max_created_at_string"` // Original string value for parsing (e.g., "now+5m")
}

type KindLimitConfig

type KindLimitConfig struct {
	Kind  int     `yaml:"kind"`
	Limit float64 `yaml:"limit"`
	Burst int     `yaml:"burst"`
}

type KindSizeLimitConfig

type KindSizeLimitConfig struct {
	Kind    int `yaml:"kind"`
	MaxSize int `yaml:"max_size"`
}

type LimitBurst

type LimitBurst struct {
	Limit float64 `yaml:"limit"`
	Burst int     `yaml:"burst"`
}

type LogConfig

type LogConfig struct {
	Level              string   `yaml:"level"`
	File               string   `yaml:"file"`
	MaxSizeMB          int      `yaml:"max_log_size_mb"`
	Structure          bool     `yaml:"structure"`
	CheckIntervalMin   int      `yaml:"check_interval_min"`  // How often the program checks the size of the current log file
	BackupCount        int      `yaml:"backup_count"`        // Number of backup logs to keep
	SuppressComponents []string `yaml:"suppress_components"` // Components to suppress INFO/DEBUG logs from
}

type RateLimitConfig

type RateLimitConfig struct {
	WsLimit        float64                    `yaml:"ws_limit"`
	WsBurst        int                        `yaml:"ws_burst"`
	EventLimit     float64                    `yaml:"event_limit"`
	EventBurst     int                        `yaml:"event_burst"`
	ReqLimit       float64                    `yaml:"req_limit"`
	ReqBurst       int                        `yaml:"req_burst"`
	MaxEventSize   int                        `yaml:"max_event_size"`
	KindSizeLimits []KindSizeLimitConfig      `yaml:"kind_size_limits"`
	CategoryLimits map[string]KindLimitConfig `yaml:"category_limits"`
	KindLimits     []KindLimitConfig          `yaml:"kind_limits"`
}

type ResourceLimits

type ResourceLimits struct {
	CPUCores   int `yaml:"cpu_cores"`
	MemoryMB   int `yaml:"memory_mb"`
	HeapSizeMB int `yaml:"heap_size_mb"`
}

type ServerConfig

type ServerConfig struct {
	Logging LogConfig `yaml:"logging"`
	MongoDB struct {
		URI      string `yaml:"uri"`
		Database string `yaml:"database"`
	} `yaml:"mongodb"`
	Server struct {
		Port                      string `yaml:"port"`
		ReadTimeout               int    `yaml:"read_timeout"`
		WriteTimeout              int    `yaml:"write_timeout"`
		IdleTimeout               int    `yaml:"idle_timeout"`
		MaxSubscriptionsPerClient int    `yaml:"max_subscriptions_per_client"`
		ImplicitReqLimit          int    `yaml:"implicit_req_limit"` // New field for implicit REQ limit
	} `yaml:"server"`
	RateLimit            RateLimitConfig      `yaml:"rate_limit"`
	Blacklist            BlacklistConfig      `yaml:"blacklist"`
	ResourceLimits       ResourceLimits       `yaml:"resource_limits"`
	Auth                 AuthConfig           `yaml:"auth"`
	EventPurge           EventPurgeConfig     `yaml:"event_purge"`
	EventTimeConstraints EventTimeConstraints `yaml:"event_time_constraints"` // Added this field
	BackupRelay          struct {
		Enabled bool   `yaml:"enabled"`
		URL     string `yaml:"url"`
	} `yaml:"backup_relay"`
	UserSync UserSyncConfig `yaml:"UserSync"`
}

type UserSyncConfig

type UserSyncConfig struct {
	UserSync              bool     `yaml:"user_sync"`               // Enable/disable syncing
	DisableAtStartup      bool     `yaml:"disable_at_startup"`      // New field
	InitialSyncRelays     []string `yaml:"initial_sync_relays"`     // Relays for initial kind10002 fetch
	Kinds                 []int    `yaml:"kinds"`                   // Kinds to sync
	Categories            string   `yaml:"categories"`              // Categories to sync
	Limit                 *int     `yaml:"limit"`                   // Limit per kind
	ExcludeNonWhitelisted bool     `yaml:"exclude_non_whitelisted"` // Sync only whitelisted users
	Interval              int      `yaml:"interval"`                // Resync interval in hours
}

type WhitelistConfig

type WhitelistConfig struct {
	PubkeyWhitelist struct {
		Enabled             bool     `yaml:"enabled"`
		Pubkeys             []string `yaml:"pubkeys"`
		Npubs               []string `yaml:"npubs"`
		CacheRefreshMinutes int      `yaml:"cache_refresh_minutes"`
	} `yaml:"pubkey_whitelist"`

	KindWhitelist struct {
		Enabled bool     `yaml:"enabled"`
		Kinds   []string `yaml:"kinds"`
	} `yaml:"kind_whitelist"`

	DomainWhitelist struct {
		Enabled             bool     `yaml:"enabled"`
		Domains             []string `yaml:"domains"`
		CacheRefreshMinutes int      `yaml:"cache_refresh_minutes"`
	} `yaml:"domain_whitelist"`
}

Jump to

Keyboard shortcuts

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