Documentation
¶
Index ¶
- func SaveConfig(configData *ConfigData, path string) error
- type CompressionType
- type Config
- type ConfigData
- func (c *ConfigData) GetMaintainOriginalExtension() bool
- func (c *ConfigData) GetNNTPPool() (nntppool.UsenetConnectionPool, error)
- func (c *ConfigData) GetNzbCompressionConfig() NzbCompressionConfig
- func (c *ConfigData) GetOutputDir() string
- func (c *ConfigData) GetPar2Config(ctx context.Context) (*Par2Config, error)
- func (c *ConfigData) GetPostCheckConfig() PostCheck
- func (c *ConfigData) GetPostUploadScriptConfig() PostUploadScriptConfig
- func (c *ConfigData) GetPostingConfig() PostingConfig
- func (c *ConfigData) GetQueueConfig() QueueConfig
- func (c *ConfigData) GetWatcherConfig() WatcherConfig
- type ConnectionPoolConfig
- type CustomHeader
- type GroupPolicy
- type MessageIDFormat
- type NzbCompressionConfig
- type ObfuscationPolicy
- type Par2Config
- type PostCheck
- type PostHeaders
- type PostUploadScriptConfig
- type PostingConfig
- type QueueConfig
- type ScheduleConfig
- type ServerConfig
- type WatcherConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SaveConfig ¶ added in v0.0.6
func SaveConfig(configData *ConfigData, path string) error
SaveConfig saves a ConfigData to a file
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
GetQueueConfig() QueueConfig
GetPostUploadScriptConfig() PostUploadScriptConfig
GetMaintainOriginalExtension() bool
}
type ConfigData ¶ added in v0.0.6
type ConfigData struct {
Servers []ServerConfig `yaml:"servers" json:"servers"`
ConnectionPool ConnectionPoolConfig `yaml:"connection_pool" json:"connection_pool"`
Posting PostingConfig `yaml:"posting" json:"posting"`
// Check uploaded article configuration. used to check if an article was successfully uploaded and propagated.
PostCheck PostCheck `yaml:"post_check" json:"post_check"`
Par2 Par2Config `yaml:"par2" json:"par2"`
Watcher WatcherConfig `yaml:"watcher" json:"watcher"`
NzbCompression NzbCompressionConfig `yaml:"nzb_compression" json:"nzb_compression"`
Queue QueueConfig `yaml:"queue" json:"queue"`
OutputDir string `yaml:"output_dir" json:"output_dir"`
MaintainOriginalExtension *bool `yaml:"maintain_original_extension" json:"maintain_original_extension"`
PostUploadScript PostUploadScriptConfig `yaml:"post_upload_script" json:"post_upload_script"`
}
config is the internal implementation of the Config interface
func GetDefaultConfig ¶ added in v0.0.6
func GetDefaultConfig() ConfigData
GetDefaultConfig returns a default configuration
func (*ConfigData) GetMaintainOriginalExtension ¶ added in v0.0.6
func (c *ConfigData) GetMaintainOriginalExtension() bool
func (*ConfigData) GetNNTPPool ¶ added in v0.0.6
func (c *ConfigData) GetNNTPPool() (nntppool.UsenetConnectionPool, error)
GetNNTPPool returns the NNTP connection pool
func (*ConfigData) GetNzbCompressionConfig ¶ added in v0.0.6
func (c *ConfigData) GetNzbCompressionConfig() NzbCompressionConfig
func (*ConfigData) GetOutputDir ¶ added in v0.0.6
func (c *ConfigData) GetOutputDir() string
func (*ConfigData) GetPar2Config ¶ added in v0.0.6
func (c *ConfigData) GetPar2Config(ctx context.Context) (*Par2Config, error)
func (*ConfigData) GetPostCheckConfig ¶ added in v0.0.6
func (c *ConfigData) GetPostCheckConfig() PostCheck
func (*ConfigData) GetPostUploadScriptConfig ¶ added in v0.0.6
func (c *ConfigData) GetPostUploadScriptConfig() PostUploadScriptConfig
func (*ConfigData) GetPostingConfig ¶ added in v0.0.6
func (c *ConfigData) GetPostingConfig() PostingConfig
func (*ConfigData) GetQueueConfig ¶ added in v0.0.6
func (c *ConfigData) GetQueueConfig() QueueConfig
func (*ConfigData) GetWatcherConfig ¶ added in v0.0.6
func (c *ConfigData) GetWatcherConfig() WatcherConfig
type ConnectionPoolConfig ¶ added in v0.0.2
type ConnectionPoolConfig struct {
MinConnections int `yaml:"min_connections" json:"min_connections"`
HealthCheckInterval time.Duration `yaml:"health_check_interval" json:"health_check_interval"`
SkipProvidersVerificationOnCreation bool `yaml:"skip_providers_verification_on_creation" json:"skip_providers_verification_on_creation"`
}
type CustomHeader ¶
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" json:"enabled"`
// Compression type to use. Default is "none".
Type CompressionType `yaml:"type" json:"type"`
// Compression level to use. Default depends on the compression type.
Level int `yaml:"level" json:"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" json:"enabled"`
Par2Path string `yaml:"par2_path" json:"par2_path"`
Redundancy string `yaml:"redundancy" json:"redundancy"`
VolumeSize int `yaml:"volume_size" json:"volume_size"`
MaxInputSlices int `yaml:"max_input_slices" json:"max_input_slices"`
ExtraPar2Options []string `yaml:"extra_par2_options" json:"extra_par2_options"`
TempDir string `yaml:"temp_dir" json:"temp_dir"`
// 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" json:"enabled"`
// Delay between retries. Default value is `10s`.
RetryDelay time.Duration `yaml:"delay" json:"delay"`
// The maximum number of re-posts if article check fails. Default value is `1`.
MaxRePost uint `yaml:"max_reposts" json:"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" json:"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" json:"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" json:"custom_headers"`
}
type PostUploadScriptConfig ¶ added in v0.0.6
type PostUploadScriptConfig struct {
// Whether to enable the post upload script execution. Default value is `false`.
Enabled bool `yaml:"enabled" json:"enabled"`
// Command to execute after NZB generation. Use {{nzb_path}} placeholder for the NZB file path
Command string `yaml:"command" json:"command"`
// Timeout for script execution. Default value is `30s`.
Timeout time.Duration `yaml:"timeout" json:"timeout"`
}
PostUploadScriptConfig represents the post upload script configuration
type PostingConfig ¶
type PostingConfig struct {
WaitForPar2 *bool `yaml:"wait_for_par2" json:"wait_for_par2"`
MaxRetries int `yaml:"max_retries" json:"max_retries"`
RetryDelay time.Duration `yaml:"retry_delay" json:"retry_delay"`
ArticleSizeInBytes uint64 `yaml:"article_size_in_bytes" json:"article_size_in_bytes"`
Groups []string `yaml:"groups" json:"groups"`
ThrottleRate int64 `yaml:"throttle_rate" json:"throttle_rate"` // bytes per second
MaxWorkers int `yaml:"max_workers" json:"max_workers"`
MessageIDFormat MessageIDFormat `yaml:"message_id_format" json:"message_id_format"`
PostHeaders PostHeaders `yaml:"post_headers" json:"post_headers"`
// If true the uploaded subject and filename will be obfuscated. Default value is `true`.
ObfuscationPolicy ObfuscationPolicy `yaml:"obfuscation_policy" json:"obfuscation_policy"`
Par2ObfuscationPolicy ObfuscationPolicy `yaml:"par2_obfuscation_policy" json:"par2_obfuscation_policy"`
// If you give several Groups you've 3 policy when posting
GroupPolicy GroupPolicy `yaml:"group_policy" json:"group_policy"`
}
PostingConfig represents posting configuration
type QueueConfig ¶ added in v0.0.6
type QueueConfig struct {
// Database type to use for the queue. Supported: "sqlite", "postgres", "mysql"
DatabaseType string `yaml:"database_type" json:"database_type"`
// Database connection string or file path
DatabasePath string `yaml:"database_path" json:"database_path"`
// Maximum concurrent uploads from queue
MaxConcurrentUploads int `yaml:"max_concurrent_uploads" json:"max_concurrent_uploads"`
}
QueueConfig represents the upload queue configuration
type ScheduleConfig ¶ added in v0.0.2
type ServerConfig ¶
type ServerConfig struct {
Host string `yaml:"host" json:"host"`
Port int `yaml:"port" json:"port"`
Username string `yaml:"username" json:"username"`
Password string `yaml:"password" json:"password"`
SSL bool `yaml:"ssl" json:"ssl"`
MaxConnections int `yaml:"max_connections" json:"max_connections"`
MaxConnectionIdleTimeInSeconds int `yaml:"max_connection_idle_time_in_seconds" json:"max_connection_idle_time_in_seconds"`
MaxConnectionTTLInSeconds int `yaml:"max_connection_ttl_in_seconds" json:"max_connection_ttl_in_seconds"`
InsecureSSL bool `yaml:"insecure_ssl" json:"insecure_ssl"`
Enabled *bool `yaml:"enabled" json:"enabled"`
}
ServerConfig represents a Usenet server configuration
type WatcherConfig ¶ added in v0.0.2
type WatcherConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"`
WatchDirectory string `yaml:"watch_directory" json:"watch_directory"`
SizeThreshold int64 `yaml:"size_threshold" json:"size_threshold"`
Schedule ScheduleConfig `yaml:"schedule" json:"schedule"`
IgnorePatterns []string `yaml:"ignore_patterns" json:"ignore_patterns"`
MinFileSize int64 `yaml:"min_file_size" json:"min_file_size"`
CheckInterval time.Duration `yaml:"check_interval" json:"check_interval"`
DeleteOriginalFile bool `yaml:"delete_original_file" json:"delete_original_file"`
}
Click to show internal directories.
Click to hide internal directories.