spider

package
v0.0.0-...-b12484f Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CollectClash     = "clash"
	CollectV2ray     = "v2ray"
	CollectSharelink = "share"
	CollectFuzzy     = "fuzzy"
)

Variables

View Source
var ErrorCreateNotSupported = errors.New("type not supported")

Functions

func ComputeFuzzy

func ComputeFuzzy(content []byte) []map[string]any

func Crawl

func Crawl() bool

func GetBytes

func GetBytes(url string) []byte

func GetCountryName

func GetCountryName(keys []string, maps map[string]map[string]any) []map[string]any

func Register

func Register(sourceType string, c collector)

func SortAddEmoji

func SortAddEmoji(proxies []map[string]any)

func SortAddIndex

func SortAddIndex(proxies []map[string]any) []map[string]any

func Unique

func Unique(mappings []map[string]any, needTls bool) (maps map[string]map[string]any)

Types

type Clash

type Clash struct {
	Url string
}

func (*Clash) Get

func (c *Clash) Get() []map[string]any

func (*Clash) Get2ChanWG

func (c *Clash) Get2ChanWG(pc chan []map[string]any, wg *sync.WaitGroup)

type Collect

type Collect interface {
	Get() []map[string]any
	Get2ChanWG(pc chan []map[string]any, wg *sync.WaitGroup)
}

func NewClashCollect

func NewClashCollect(getter Getter) Collect

func NewCollect

func NewCollect(sourceType string, getter Getter) (Collect, error)

func NewFuzzyCollect

func NewFuzzyCollect(getter Getter) Collect

func NewShareLinkCollect

func NewShareLinkCollect(getter Getter) Collect

func NewV2rayCollect

func NewV2rayCollect(getter Getter) Collect

type Fuzzy

type Fuzzy struct {
	Url string
}

func (*Fuzzy) Get

func (c *Fuzzy) Get() []map[string]any

func (*Fuzzy) Get2ChanWG

func (c *Fuzzy) Get2ChanWG(pc chan []map[string]any, wg *sync.WaitGroup)

type Getter

type Getter struct {
	Id   string `json:"id,omitempty" yaml:"id,omitempty"`
	Type string `json:"type" yaml:"type"`
	Url  string `json:"url" yaml:"url"`
}

type Job

type Job func(chan struct{})
type ShareLink struct {
	Url string
}

func (*ShareLink) Get

func (c *ShareLink) Get() []map[string]any

func (*ShareLink) Get2ChanWG

func (c *ShareLink) Get2ChanWG(pc chan []map[string]any, wg *sync.WaitGroup)

type TimeoutPool

type TimeoutPool struct {
	// contains filtered or unexported fields
}

func NewTimeoutPool

func NewTimeoutPool(size int) *TimeoutPool

NewTimeoutPool 初始化一个任务队列长度为size

func NewTimeoutPoolWithDefaults

func NewTimeoutPoolWithDefaults() *TimeoutPool

NewTimeoutPoolWithDefaults 初始化一个任务队列长度512

func (*TimeoutPool) StartAndWait

func (p *TimeoutPool) StartAndWait()

StartAndWait 启动并等待协程池内的运行全部运行结束

func (*TimeoutPool) SubmitWithTimeout

func (p *TimeoutPool) SubmitWithTimeout(job Job, timeout time.Duration)

SubmitWithTimeout 提交一个任务到协程池

func (*TimeoutPool) WaitCount

func (p *TimeoutPool) WaitCount(count int)

type V2ray

type V2ray struct {
	Url string
}

func (*V2ray) Get

func (c *V2ray) Get() []map[string]any

func (*V2ray) Get2ChanWG

func (c *V2ray) Get2ChanWG(pc chan []map[string]any, wg *sync.WaitGroup)

Jump to

Keyboard shortcuts

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