带有评估系统的 Golang 版本代理挖矿工具
v3.1Made some changes to the judgment logic of whether the proxy is highly anonymous. This problem has led to the absence of proxies that can be used. Now you can enjoy it.
Golang-proxy is an efficient free proxy crawler that ensures that the captured proxies are highly anonymous and at the same time guarantee their quality. You can use these captured proxies to download network resources and ensure the privacy of your own identity.
golang-proxy provides compiled binary files so that you do not need golang on the machine. Download binary compression pack to Release Page
According to your system type, download the corresponding compression package, unzip it and run it. After a few minutes, you can access localhost:9999/all in the browser to see the proxy's crawl results.
Before I go into the detailed introduction of golang-proxy, I think it's best to tell you the most useful information first.
After you start the binary, you can access the following interface in the browser to get the proxy
| url | description |
|---|---|
localhost:9999/all |
Get all highly available proxies |
localhost:9999/all?table=proxy |
Get all highly available proxies |
localhost:9999/random |
Randomly acquire a highly available proxy |
localhost:9999/all?table=crude_proxy |
Obtain the proxies in the temporary table (the quality of them cannot be guaranteed) |
localhost:9999/random?table=proxy |
Randomly get an proxy from the temporary table (the quality of them cannot be guaranteed) |
localhost:9999/sql?query= |
Write the SQL statement you want to execute after query=, customize your filter rules. |
Having mastered the above content, you have been able to use the 50% function of golang-proxy. But the last interface allows you to execute custom SQL statements, and you'll find that you need to know at least the structure of the tables. The following will tell you.
golang-proxy consists of the following parts:
data tablesconfiguration filesource foldermodulesdata tablesIn order to store temporary proxies, we designed the data table crude_proxy, the table is defined as follows.
| field | type | example | description |
|---|---|---|---|
| id | int | - | - |
| ip | string | 192.168.0.1 | - |
| port | string | 255 | - |
| content | string | 192.168.0.1:255 | - |
| insert_time | int | 1540798717 | - |
| update_time | int | 1540798717 | - |
table crude_proxy stores the proxies that are crawled out, and cannot guarantee their quality.
When the agent in the crude_proxy table passes through pre assess ( pre assess roughly verifies the availability of the proxy and tests the proxy's support for https and http ), it will enter the proxy table.
| field | type | example | description |
|---|---|---|---|
| id | int | - | - |
| ip | string | 192.168.0.1 | - |
| port | string | 255 | - |
| scheme_type | int | 2 | Identify the extent to which the proxy supports http and https, 0: http only, 1 https only, 2 https & http |
| content | string | 192.168.0.1:255 | |
| assess_times | int | 5 | proxy evaluation times |
| success_times | int | 5 | The number of times the proxy successfully passed the evaluation |
| avg_response_time | float | 0.001 | - |
| continuous_failed_times | int | 0 | The number of consecutive failures during the proxy evaluation process |
| score | float | 25 | The higher the better |
| insert_time | int | 1540798717 | - |
| update_time | int | 1540798717 | - |
The proxy in the proxy table will be evaluated periodically and their scores will be modified. Low scores will be deleted.
configuration fileFor convenience, the proxy in golang-proxy is stored in the portable database sqlite by default. You can make golang-proxy use the mysql database by adding the config.yml file in the executable directory.
For details, see Config page.
source foldergolang-proxy needs source to define its crawling contents and rules. Therefore, the run directory of golang-proxy needs at least one source folder, and the source folder should have at least one source in yml format.
The source is defined as follows:
page:
entry: "http://www.xxx.com/http/?page=1"
template: "http://www.xxx.com/http/?page={page}"
from: 1
to: 2000
selector:
iterator: ".list item"
ip: ".ip"
port: ".port"
category:
parallelnumber: 3
delayRange: [10, 30]
interval: "@every 10m"
debug: trueIn the definition above, producer will first crawl the entry page, then crawl:
http://www.xxx.com/http/?page=1
http://www.xxx.com/http/?page=2
http://www.xxx.com/http/?page=3
...
http://www.xxx.com/http/?page=2000This source definition page expects this format:
...
...
...
...
...
When producer parses a single page, it always traverses the nodes defined by iterator first, and then gets the elements defined by ip and port selectors from these nodes. The source definition above is still valid for the following HTML structure.
...
...
...
Because when the port selector cannot get the content, it will try to parse the port from the text selected by the ip selector.
The source is stored in the source folder in yml format, and a source definition is completed. Golang-proxy will read it and crawl it the next time it starts. So you successfully define a source, store it in the source folder in YML format, and the next time you start golang-proxy, the source will enter the crawl list.
If a source file name starts with a
., the source will not be read.
modulesgolang-proxy consists of four modules, which cooperate to complete the task that golang-proxy wants to accomplish.
| module name | description |
|---|---|
| producer | Periodically fetch the source defined in the source directory, and write the fetched proxy to the crude_proxy table. |
| consumer | Periodically read a certain number of proxies from crude_proxy, determine their proxy scheme type and availability, and write them to the proxy table. |
| assessor | Periodically read a number of proxies from the proxy table to evaluate their quality. |
| service | Be responsible for the HTTP API interface provided by golang-proxy, allows you to filter and obtain the proxies in the crude_proxy and proxy tables by localhost: 9999/all, localhost: 9999/random, and localhost: 9999/sql. |
When you start the executable file of golang-proxy, you will start these module in turn. But you can add the -mode startup parameter after the golang-proxy executable to command golang-proxy to start only one module. Like below:
golang-proxy -mode=serviceThis will only start the HTTP API interface service.
At this point, you have mastered the 95% function of golang-proxy. If you want to find more, you can read the source code provided above, and improve them.
Welcome to submit issue. If you feel that golang-proxy is helping you, you can order a star or watch, thanks !
Golang-Proxy -- 简单高效的免费代理抓取工具通过抓取网络上公开的免费代理,来维护一个
暂无开放 Issues,或尚未同步最近议题。