config

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: May 18, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompressionType added in v0.0.5

type CompressionType string
const (
	// No compression
	CompressionTypeNone CompressionType = "none"
	// Zstandard compression
	CompressionTypeZstd CompressionType = "zstd"
	// Brotli compression
	CompressionTypeBrotli CompressionType = "brotli"
)

type Config

type Config interface {
	GetNNTPPool() (nntppool.UsenetConnectionPool, error)
	GetPostingConfig() PostingConfig
	GetPostCheckConfig() PostCheck
	GetPar2Config(ctx context.Context) (*Par2Config, error)
	GetWatcherConfig() WatcherConfig
	GetNzbCompressionConfig() NzbCompressionConfig
}

func Load

func Load(path string) (Config, error)

Load loads configuration from a file

type ConnectionPoolConfig added in v0.0.2

type ConnectionPoolConfig struct {
	MinConnections                      int           `yaml:"min_connections"`
	HealthCheckInterval                 time.Duration `yaml:"health_check_interval"`
	SkipProvidersVerificationOnCreation bool          `yaml:"skip_providers_verification_on_creation"`
}

type CustomHeader

type CustomHeader struct {
	Name  string `yaml:"name"`
	Value string `yaml:"value"`
}

type GroupPolicy

type GroupPolicy string
const (
	//    ALL       : everything is posted on ALL the Groups
	GroupPolicyAll GroupPolicy = "all"
	//    EACH_FILE : each File will be posted on a random Group from the list (only with Article's obfuscation)
	GroupPolicyEachFile GroupPolicy = "each_file"
)

type MessageIDFormat

type MessageIDFormat string
const (
	// NGX: the Message-ID will be formatted as https://github.com/javi11/nxg
	MessageIDFormatNGX MessageIDFormat = "ngx"
	// Random: the Message-ID will be a random string of 32 characters
	MessageIDFormatRandom MessageIDFormat = "random"
)

type NzbCompressionConfig added in v0.0.5

type NzbCompressionConfig struct {
	// Whether to enable compression. Default is false.
	Enabled bool `yaml:"enabled"`
	// Compression type to use. Default is "none".
	Type CompressionType `yaml:"type"`
	// Compression level to use. Default depends on the compression type.
	Level int `yaml:"level"`
}

NzbCompressionConfig represents the NZB compression configuration

type ObfuscationPolicy

type ObfuscationPolicy string
const (
	// Will do the following obfuscation:
	// - Subject: will be obfuscated
	// - Filename: will be obfuscated
	// - Yenc header filename: will be randomized for every article
	// - Date: will be randomized for every article within last 6 hours
	// - NGX-header: will not be added
	// - Poster: will be random for each article
	ObfuscationPolicyFull ObfuscationPolicy = "full"
	// Will do the following obfuscation:
	// - Subject: will be obfuscated
	// - Filename: will be obfuscated
	// - Yenc header filename: will be same one for all articles
	// - Date: will be the real posted date
	// - Poster: will be the same one for all articles
	ObfuscationPolicyPartial ObfuscationPolicy = "partial"
	// Nothing will be obfuscated
	ObfuscationPolicyNone ObfuscationPolicy = "none"
)

type Par2Config

type Par2Config struct {
	Enabled          *bool    `yaml:"enabled"`
	Par2Path         string   `yaml:"par2_path"`
	Redundancy       string   `yaml:"redundancy"`
	VolumeSize       int      `yaml:"volume_size"`
	MaxInputSlices   int      `yaml:"max_input_slices"`
	ExtraPar2Options []string `yaml:"extra_par2_options"`
	// contains filtered or unexported fields
}

type PostCheck

type PostCheck struct {
	// If enabled articles will be checked after being posted. Default value is `true`.
	Enabled *bool `yaml:"enabled"`
	// Delay between retries. Default value is `10s`.
	RetryDelay time.Duration `yaml:"delay"`
	// The maximum number of re-posts if article check fails. Default value is `1`.
	MaxRePost uint `yaml:"max_reposts"`
}

type PostHeaders

type PostHeaders struct {
	// Whether to add the X-NXG header to the uploaded articles (You will still see this header in the generated NZB). Default value is `true`.
	// If obfuscation policy is `FULL` this header will not be added.
	// If message_id_format is not `ngx` this header will not be added.
	AddNGXHeader bool `yaml:"add_ngx_header"`
	// The default from header for the uploaded articles. By default a random poster will be used for each article. This will override GenerateFromByArticle
	DefaultFrom string `yaml:"default_from"`
	// Add custom headers to the uploaded articles. Subject, From, Newsgroups, Message-ID and Date can not be override.
	CustomHeaders []CustomHeader `yaml:"custom_headers"`
}

type PostingConfig

type PostingConfig struct {
	WaitForPar2        *bool           `yaml:"wait_for_par2"`
	MaxRetries         int             `yaml:"max_retries"`
	RetryDelay         time.Duration   `yaml:"retry_delay"`
	ArticleSizeInBytes uint64          `yaml:"article_size_in_bytes"`
	Groups             []string        `yaml:"groups"`
	ThrottleRate       int64           `yaml:"throttle_rate"` // bytes per second
	MaxWorkers         int             `yaml:"max_workers"`
	MessageIDFormat    MessageIDFormat `yaml:"message_id_format"`
	PostHeaders        PostHeaders     `yaml:"post_headers"`
	// If true the uploaded subject and filename will be obfuscated. Default value is `true`.
	ObfuscationPolicy     ObfuscationPolicy `yaml:"obfuscation_policy"`
	Par2ObfuscationPolicy ObfuscationPolicy `yaml:"par2_obfuscation_policy"`
	//  If you give several Groups you've 3 policy when posting
	GroupPolicy GroupPolicy `yaml:"group_policy"`
}

PostingConfig represents posting configuration

type ScheduleConfig added in v0.0.2

type ScheduleConfig struct {
	StartTime string `yaml:"start_time"`
	EndTime   string `yaml:"end_time"`
}

type ServerConfig

type ServerConfig struct {
	Host                           string `yaml:"host"`
	Port                           int    `yaml:"port"`
	Username                       string `yaml:"username"`
	Password                       string `yaml:"password"`
	SSL                            bool   `yaml:"ssl"`
	MaxConnections                 int    `yaml:"max_connections"`
	MaxConnectionIdleTimeInSeconds int    `yaml:"max_connection_idle_time_in_seconds"`
	MaxConnectionTTLInSeconds      int    `yaml:"max_connection_ttl_in_seconds"`
	InsecureSSL                    bool   `yaml:"insecure_ssl"`
}

ServerConfig represents a Usenet server configuration

type WatcherConfig added in v0.0.2

type WatcherConfig struct {
	SizeThreshold  int64          `yaml:"size_threshold"`
	Schedule       ScheduleConfig `yaml:"schedule"`
	IgnorePatterns []string       `yaml:"ignore_patterns"`
	MinFileSize    int64          `yaml:"min_file_size"`
	CheckInterval  time.Duration  `yaml:"check_interval"`
}

Jump to

Keyboard shortcuts

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