getter

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 8, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GetterList = make([]Getter, 0)

	ErrorUrlNotFound         = errors.New("url未定义")
	ErrorCrawlSubNotFound    = errors.New("subs爬取节点未定义或格式错误")
	ErrorCreaterNotSupported = errors.New("不支持的获取类型")
)

Functions

func InitGetter

func InitGetter() error

func Register

func Register(sourceType string, c creator)

func StringArray2ProxyArray

func StringArray2ProxyArray(origin []string) proxy.ProxyList

Types

type Clash

type Clash struct {
	Url string
}

func (*Clash) Get

func (c *Clash) Get() proxy.ProxyList

Get implements Getter.

func (*Clash) SyncGet

func (c *Clash) SyncGet(pc chan proxy.Proxy, wg *sync.WaitGroup)

SyncGet implements Getter.

type Crawl

type Crawl struct {
	Url       string
	Subs      []Sub
	Collector *colly.Collector
	// contains filtered or unexported fields
}

func (*Crawl) Get

func (c *Crawl) Get() proxy.ProxyList

Get implements Getter.

func (*Crawl) SyncGet

func (c *Crawl) SyncGet(pc chan proxy.Proxy, wg *sync.WaitGroup)

SyncGet implements Getter.

type Getter

type Getter interface {
	Get() proxy.ProxyList
	SyncGet(pc chan proxy.Proxy, wg *sync.WaitGroup)
}

定义每种getter的基本函数

type Sub

type Sub struct {
	Type  string `json:"type" yaml:"type"`
	Xpath string `json:"xpath" yaml:"xpath"`
	Subs  []Sub  `json:"subs" yaml:"subs"`
}

type Subscribe

type Subscribe struct {
	Url string
}

func (*Subscribe) Get

func (s *Subscribe) Get() proxy.ProxyList

Get implements Getter.

func (*Subscribe) SyncGet

func (v *Subscribe) SyncGet(pc chan proxy.Proxy, wg *sync.WaitGroup)

SyncGet implements Getter.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL