Documentation ¶
Index ¶
- Variables
- func IsAgentFromUserAgent(userAgent string) bool
- type Agent
- type AgentIP
- type DB
- type IPCacheMap
- type Manager
- func (this *Manager) AddIP(ip string, agentCode string)
- func (this *Manager) ContainsIP(ip string) bool
- func (this *Manager) Load() error
- func (this *Manager) LookupIP(ip string) (agentCode string)
- func (this *Manager) Loop() (hasNext bool, err error)
- func (this *Manager) LoopAll() error
- func (this *Manager) SetDB(db *DB)
- func (this *Manager) Start()
- type Queue
Constants ¶
This section is empty.
Variables ¶
View Source
var AllAgents = []*Agent{ NewAgent("baidu", []string{".baidu.com."}, nil, []string{"Baidu"}), NewAgent("google", []string{".googlebot.com."}, nil, []string{"Google"}), NewAgent("bing", []string{".search.msn.com."}, nil, []string{"bingbot"}), NewAgent("sogou", []string{".sogou.com."}, nil, []string{"Sogou"}), NewAgent("youdao", []string{".163.com."}, nil, []string{"Youdao"}), NewAgent("yahoo", []string{".yahoo.com."}, nil, []string{"Yahoo"}), NewAgent("bytedance", []string{".bytedance.com."}, nil, []string{"Bytespider"}), NewAgent("sm", []string{".sm.cn."}, nil, []string{"YisouSpider"}), NewAgent("yandex", []string{".yandex.com.", ".yndx.net."}, nil, []string{"Yandex"}), NewAgent("semrush", []string{".semrush.com."}, nil, []string{"SEMrush"}), }
Functions ¶
func IsAgentFromUserAgent ¶
Types ¶
type Agent ¶
type Agent struct { Code string Keywords []string // user agent keywords // contains filtered or unexported fields }
type IPCacheMap ¶
type IPCacheMap struct {
// contains filtered or unexported fields
}
func NewIPCacheMap ¶
func NewIPCacheMap(maxLen int) *IPCacheMap
func (*IPCacheMap) Add ¶
func (this *IPCacheMap) Add(ip string)
func (*IPCacheMap) Contains ¶
func (this *IPCacheMap) Contains(ip string) bool
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager Agent管理器
func NewManager ¶
func NewManager() *Manager
Click to show internal directories.
Click to hide internal directories.