Documentation
¶
Overview ¶
Package config provides software configuration, path, and runtime parameter loading and management.
Index ¶
Constants ¶
View Source
const ( Version string = "v1.3.5" // Version number Author string = "andeya" // Author Name string = "Pholcus Ghost Spider Data Collection" // Software name FullName string = Name + "_" + Version + " (by " + Author + ")" // Full name Tag string = "pholcus" // Identifier )
Software information.
View Source
const ( WorkRoot string = Tag + "_pkg" // Runtime directory name ConfigFile string = WorkRoot + "/config.ini" // Config file path CacheDir string = WorkRoot + "/cache" // Cache directory LogPath string = WorkRoot + "/logs/pholcus.log" // Log file path LogAsync bool = true // Whether to output logs asynchronously PhantomJSTemp string = CacheDir // Surfer-Phantom: temp dir for JS files HistoryTag string = "history" // History record identifier HistoryDir string = WorkRoot + "/" + HistoryTag // History dir for excel/csv output SpiderExt string = ".pholcus.xml" // Dynamic rule extension (recommended) SpiderExtOld string = ".pholcus.html" // Dynamic rule extension (legacy) )
Path constants derived from Tag.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BeanstalkdConfig ¶ added in v1.4.0
type Config ¶ added in v1.4.0
type Config struct {
CrawlsCap int `ini:"crawlcap"`
PhantomJS string `ini:"phantomjs"`
ProxyFile string `ini:"proxylib"`
SpiderDir string `ini:"spiderdir"`
FileDir string `ini:"fileoutdir"`
TextDir string `ini:"textoutdir"`
DBName string `ini:"dbname"`
Mgo MgoConfig `ini:"mgo"`
MySQL MySQLConfig `ini:"mysql"`
Beanstalkd BeanstalkdConfig `ini:"beanstalkd"`
Kafka KafkaConfig `ini:"kafka"`
Log LogConfig `ini:"log"`
Run RunConfig `ini:"run"`
}
Config holds all runtime-configurable values, initialized with defaults. Fields are overwritten by LoadConfig() from the INI file via struct tags.
type KafkaConfig ¶ added in v1.4.0
type KafkaConfig struct {
Brokers string `ini:"brokers"`
}
type LogConfig ¶ added in v1.4.0
type LogConfig struct {
Cap int64 `ini:"cap"`
LevelStr string `ini:"level"`
ConsoleLevelStr string `ini:"consolelevel"`
FeedbackLevelStr string `ini:"feedbacklevel"`
LineInfo bool `ini:"lineinfo"`
Save bool `ini:"save"`
}
func (*LogConfig) ConsoleLevel ¶ added in v1.4.0
ConsoleLevel returns the console log level, clamped to at least the global level.
func (*LogConfig) FeedbackLevel ¶ added in v1.4.0
FeedbackLevel returns the feedback log level, clamped to at least the global level.
type MySQLConfig ¶ added in v1.4.0
type RunConfig ¶ added in v1.4.0
type RunConfig struct {
Mode int `ini:"mode"`
Port int `ini:"port"`
Master string `ini:"master"`
ThreadNum int `ini:"thread"`
Pausetime int64 `ini:"pause"`
OutType string `ini:"outtype"`
BatchCap int `ini:"batchcap"`
Limit int64 `ini:"limit"`
ProxyMinute int64 `ini:"proxyminute"`
SuccessInherit bool `ini:"success"`
FailureInherit bool `ini:"failure"`
}
Click to show internal directories.
Click to hide internal directories.