Skip to content

Commit 0135079

Browse files
committed
added generate yaml script
1 parent d124497 commit 0135079

File tree

4 files changed

+41
-8
lines changed

4 files changed

+41
-8
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Docker Rotating Proxy
22
- Fully Optimized for Web Scraping Usage.
33
- HTTP/HTTPS Support
4-
- socks5 with Authorization Proxy to HTTP(S) proxy convert compatible by Goast
4+
- socks5 with Authorization Proxy to HTTP(S) proxy convert compatible by [Gost](https://github.com/ginuerzh/gost)
55

66

77

generate.sh

-2
This file was deleted.

proxyList.txt

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
127.0.0.1:1080:socks5:yourUsername:yourPassword
2-
127.0.0.1:44888:http::
3-
127.0.0.1:55519:https::
4-
127.0.0.1:41258:http::
5-
127.0.0.1:80
1+
159.89.206.161:2434:socks5:vpn:unlimited
2+
142.93.68.63:2434:socks5:vpn:unlimited
3+
82.196.7.200:2434:socks5:vpn:unlimited

setup/generate.php

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env php
2+
<?php
3+
require './vendor/autoload.php';
4+
use Symfony\Component\Yaml\Yaml;
5+
6+
$to = Yaml::parseFile('../template/docker-compose.yml');
7+
var_dump($to);
8+
9+
$proxies = fopen('../proxyList.txt','r');
10+
11+
$i = 1;
12+
$port = 49152;
13+
14+
while ($line = fgets($proxies)){
15+
$line = trim($line);
16+
$proxyInfo = (explode(":",$line));
17+
$cred = '';
18+
if(!isset($proxyInfo[2])){
19+
$proxyInfo[2] = 'http';
20+
}
21+
if (isset($proxyInfo[3]) && isset($proxyInfo[4])) {
22+
$cred = urlencode($proxyInfo[3]) . ':' . urlencode($proxyInfo[4]) . '@';
23+
}
24+
$to['services']['proxy' . $i] = [
25+
'ports' => [
26+
$port . ':' . $port
27+
],
28+
'image' => 'chenhw2/gost:latest',
29+
'environment' => [
30+
'ARGS' => sprintf('-L=:%d -F=%s://%s%s:%d', $port, $proxyInfo[2], $cred, $proxyInfo[0], $proxyInfo[1])
31+
]
32+
];
33+
$i++;
34+
$port++;
35+
}
36+
37+
file_put_contents('docker-compose.yml', Yaml::dump($to));

0 commit comments

Comments
 (0)