proxypool

package module
v0.0.0-...-3404f59 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2020 License: MIT Imports: 6 Imported by: 0

README

基于 Golang 的免费代理池

本项目基于 https://github.com/diinvoke/proxy-pool ,由于做了比较大的更改所以建立了个项目单独维护。

更新日志

  • 20200110 增加 RPC(使用 grpc)接口调用
  • 20191217 初始化版本
  • 20191215 扩展原有的项目,并重写部分代码,感谢 @diinvoke 的原项目

安装和部署

go get github.com/mingcheng/proxypool
代码层面,可以调用
	config := proxypool.Config{
		FetchInterval:   15 * time.Minute,
		CheckInterval:   2 * time.Minute,
		CheckConcurrent: 10,
	}

	go proxypool.Start(config)
	defer proxypool.Stop()
Docker 方式部署
docker run -p 8080:8080 docker.pkg.github.com/mingcheng/proxypool/proxypool:lastest

使用

// ...

配置
	config := proxypool.Config{
		FetchInterval:   15 * time.Minute,
		CheckInterval:   2 * time.Minute,
		CheckConcurrent: 10,
	}
HTTP 接口
  • /all 所有可用的代理列表
  • /random 随机获取一个可用的代理
RPC 接口

调用方式请参考 example/rpc_client.go 文件

扩展代理来源

// ...

@TODO

  • 更多的免费代理来源
  • 对接 Prometheus ,获取状态信息

- eof -

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(p model.Proxy)

Add a proxy to check

func All

func All() []*model.Proxy

All function to get all valid proxy

func Random

func Random() *model.Proxy

Random to get a validable proxy

func Start

func Start(config Config)

Start proxypool

func Stop

func Stop()

Stop proxypool

Types

type Config

type Config struct {
	FetchInterval   time.Duration
	CheckInterval   time.Duration
	CheckConcurrent uint
}

Config type for config the proxypool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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