 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Overview ¶
app interface for graphical user interface. 基本业务执行顺序依次为:New()-->[SetLog(io.Writer)-->]Init()-->SpiderPrepare()-->Run()
Index ¶
- Variables
- type App
- type Logic
- func (self *Logic) CountNodes() int
- func (self *Logic) GetAppConf(k ...string) interface{}
- func (self *Logic) GetMode() int
- func (self *Logic) GetOutputLib() []string
- func (self *Logic) GetSpiderByName(name string) *spider.Spider
- func (self *Logic) GetSpiderLib() []*spider.Spider
- func (self *Logic) GetSpiderQueue() crawler.SpiderQueue
- func (self *Logic) GetTaskJar() *distribute.TaskJar
- func (self *Logic) Init(mode int, port int, master string, w ...io.Writer) App
- func (self *Logic) IsPause() bool
- func (self *Logic) IsRunning() bool
- func (self *Logic) IsStopped() bool
- func (self *Logic) LogGoOn() App
- func (self *Logic) LogRest() App
- func (self *Logic) PauseRecover()
- func (self *Logic) ReInit(mode int, port int, master string, w ...io.Writer) App
- func (self *Logic) Run()
- func (self *Logic) SetAppConf(k string, v interface{}) App
- func (self *Logic) SetLog(w io.Writer) App
- func (self *Logic) SpiderPrepare(original []*spider.Spider) App
- func (self *Logic) Status() int
- func (self *Logic) Stop()
 
Constants ¶
This section is empty.
Variables ¶
      View Source
      
  var LogicApp = New()
    全局唯一的核心接口实例
Functions ¶
This section is empty.
Types ¶
type App ¶
type App interface {
	SetLog(io.Writer) App                                         // 设置全局log实时显示终端
	LogGoOn() App                                                 // 继续log打印
	LogRest() App                                                 // 暂停log打印
	Init(mode int, port int, master string, w ...io.Writer) App   // 使用App前必须进行先Init初始化,SetLog()除外
	ReInit(mode int, port int, master string, w ...io.Writer) App // 切换运行模式并重设log打印目标
	GetAppConf(k ...string) interface{}                           // 获取全局参数
	SetAppConf(k string, v interface{}) App                       // 设置全局参数(client模式下不调用该方法)
	SpiderPrepare(original []*spider.Spider) App                  // 须在设置全局运行参数后Run()前调用(client模式下不调用该方法)
	Run()                                                         // 阻塞式运行直至任务完成(须在所有应当配置项配置完成后调用)
	Stop()                                                        // Offline 模式下中途终止任务(对外为阻塞式运行直至当前任务终止)
	IsRunning() bool                                              // 检查任务是否正在运行
	IsPause() bool                                                // 检查任务是否处于暂停状态
	IsStopped() bool                                              // 检查任务是否已经终止
	PauseRecover()                                                // Offline 模式下暂停\恢复任务
	Status() int                                                  // 返回当前状态
	GetSpiderLib() []*spider.Spider                               // 获取全部蜘蛛种类
	GetSpiderByName(string) *spider.Spider                        // 通过名字获取某蜘蛛
	GetSpiderQueue() crawler.SpiderQueue                          // 获取蜘蛛队列接口实例
	GetOutputLib() []string                                       // 获取全部输出方式
	GetTaskJar() *distribute.TaskJar                              // 返回任务库
	distribute.Distributer                                        // 实现分布式接口
}
    type Logic ¶
type Logic struct {
	*cache.AppConf        // 全局配置
	*spider.SpiderSpecies // 全部蜘蛛种类
	crawler.SpiderQueue   // 当前任务的蜘蛛队列
	*distribute.TaskJar   // 服务器与客户端间传递任务的存储库
	crawler.CrawlerPool   // 爬行回收池
	teleport.Teleport     // socket长连接双工通信接口,json数据传输
	sync.RWMutex
	// contains filtered or unexported fields
}
    func (*Logic) GetSpiderByName ¶
通过名字获取某蜘蛛
func (*Logic) SpiderPrepare ¶
SpiderPrepare()必须在设置全局运行参数之后,Run()的前一刻执行 original为spider包中未有过赋值操作的原始蜘蛛种类 已被显式赋值过的spider将不再重新分配Keyin client模式下不调用该方法
       Directories
      ¶
      Directories
      ¶
    
    | Path | Synopsis | 
|---|---|
| aid
       | |
| 
          
            surfer
            
            
          
           surfer是一款Go语言编写的高并发web下载器,支持 GET/POST/HEAD 方法及 http/https 协议,同时支持固定UserAgent自动保存cookie与随机大量UserAgent禁用cookie两种模式,高度模拟浏览器行为,可实现模拟登录等功能。 | surfer是一款Go语言编写的高并发web下载器,支持 GET/POST/HEAD 方法及 http/https 协议,同时支持固定UserAgent自动保存cookie与随机大量UserAgent禁用cookie两种模式,高度模拟浏览器行为,可实现模拟登录等功能。 | 
| 
          
            surfer/agent
            
            
          
           Package agent generates user agents strings for well known browsers and for custom browsers. | Package agent generates user agents strings for well known browsers and for custom browsers. | 
| 
          
            surfer/example
            
            command
          
          
         | |
| 数据收集 | 数据收集 | 
| 
          
            collector
            
            
          
           结果收集与输出 | 结果收集与输出 | 
 Click to show internal directories. 
   Click to hide internal directories.