Documentation
¶
Index ¶
- Constants
- Variables
- type CacheConfig
- type Config
- func (config *Config) BindFlags() func() error
- func (config *Config) HandleConfFileFlag(path string) error
- func (config *Config) Pretty(output io.Writer) error
- func (config *Config) Read(input io.Reader) error
- func (config *Config) SetDBLogMode(db_logmode string) error
- func (config *Config) SetDBType(db_type string) error
- func (config *Config) Write(output io.Writer) error
- type I2PConfig
- type ScrapeConfig
- type ScraperConfig
- type SearchConfig
Constants ¶
View Source
const ( SendEmail = true EmailFrom = "donotrespond@nyaa.pantsu.cat" EmailTestTo = "" EmailHost = "localhost" EmailUsername = "" EmailPassword = "" EmailPort = 465 EmailTimeout = 10 * time.Second )
View Source
const ( // Environment should be one of: DEVELOPMENT, TEST, PRODUCTION Environment = "DEVELOPMENT" WebAddress = "nyaa.pantsu.cat" AuthTokenExpirationDay = 1000 )
View Source
const ( AccessLogFilePath = "log/access" AccessLogFileExtension = ".txt" AccessLogMaxSize = 5 // megabytes AccessLogMaxBackups = 7 AccessLogMaxAge = 30 //days ErrorLogFilePath = "log/error" ErrorLogFileExtension = ".json" ErrorLogMaxSize = 10 // megabytes ErrorLogMaxBackups = 7 ErrorLogMaxAge = 30 //days )
View Source
const ( TorrentOrder = "torrent_id" TorrentSort = "DESC" )
View Source
const ( // TorrentFileStorage = "/var/www/wherever/you/want" // TorrentStorageLink = "https://your.site/somewhere/%s.torrent" TorrentFileStorage = "" TorrentStorageLink = "" // TODO: deprecate this and move all files to the same server TorrentCacheLink = "http://anicache.com/torrent/%s.torrent" UploadsDisabled = false )
View Source
const DefaultCacheSize = 1 << 10
View Source
const ( // LastOldTorrentID is the highest torrent ID // that was copied from the original Nyaa LastOldTorrentID = 923000 )
View Source
const (
TorrentsPerPage = 50
)
Variables ¶
View Source
var DefaultCacheConfig = CacheConfig{
Dialect: "nop",
}
View Source
var DefaultScraperConfig = ScraperConfig{ Addr: ":9999", NumWorkers: 4, IntervalSeconds: 60 * 60, Trackers: []ScrapeConfig{ ScrapeConfig{ URL: "udp://tracker.coppersurfer.tk:6969/", Name: "coppersurfer.tk", }, }, }
DefaultScraperConfig is the default config for bittorrent scraping
View Source
var DefaultSearchConfig = SearchConfig{}
View Source
var Defaults = Config{"localhost", 9999, "sqlite3", "./nyaa.db?cache_size=50", "default", DefaultScraperConfig, DefaultCacheConfig, DefaultSearchConfig, nil}
View Source
var EmailTokenHashKey = []byte("CHANGE_THIS_BEFORE_DEPLOYING_YOU_GIT")
View Source
var Trackers = []string{
"udp://tracker.doko.moe:6969",
"udp://tracker.coppersurfer.tk:6969",
"udp://zer0day.to:1337/announce",
"udp://tracker.leechers-paradise.org:6969",
"udp://explodie.org:6969",
"udp://tracker.opentrackr.org:1337",
"udp://tracker.internetwarriors.net:1337/announce",
"http://mgtracker.org:6969/announce",
"http://tracker.baka-sub.cf/announce"}
Functions ¶
This section is empty.
Types ¶
type CacheConfig ¶
CacheConfig is config struct for caching strategy
type Config ¶
type Config struct { Host string `json:"host"` Port int `json:"port"` DBType string `json:"db_type"` // DBParams will be directly passed to Gorm, and its internal // structure depends on the dialect for each db type DBParams string `json:"db_params"` DBLogMode string `json:"db_logmode"` // tracker scraper config (required) Scrape ScraperConfig `json:"scraper"` // cache config Cache CacheConfig `json:"cache"` // search config Search SearchConfig `json:"search"` // optional i2p configuration I2P *I2PConfig `json:"i2p"` }
func (*Config) BindFlags ¶
BindFlags returns a function which is to be used after flag.Parse to check and copy the flags' values to the Config instance.
func (*Config) HandleConfFileFlag ¶
func (*Config) SetDBLogMode ¶
type ScrapeConfig ¶
type ScraperConfig ¶
type ScraperConfig struct { Addr string `json:"bind"` NumWorkers int `json:"workers"` IntervalSeconds int64 `json:"default_interval"` Trackers []ScrapeConfig `json:"trackers"` }
type SearchConfig ¶
type SearchConfig struct { }
Click to show internal directories.
Click to hide internal directories.