mirror of
https://github.com/TeamPiped/RYD-Proxy.git
synced 2024-12-12 21:30:40 +05:30
Prepare for a proxyless mode.
This commit is contained in:
parent
2b0fa64656
commit
a761ae1031
6
docker-compose.proxyless.yml
Normal file
6
docker-compose.proxyless.yml
Normal file
@ -0,0 +1,6 @@
|
||||
services:
|
||||
ryd-proxy:
|
||||
image: 1337kavin/ryd-proxy:latest
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "127.0.0.1:3000:3000"
|
@ -9,5 +9,7 @@ services:
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
- tor-proxy
|
||||
environment:
|
||||
- PROXY=socks5://tor-proxy:5566
|
||||
ports:
|
||||
- "127.0.0.1:3000:3000"
|
||||
|
10
main.go
10
main.go
@ -20,13 +20,13 @@ var client *http.Client
|
||||
func main() {
|
||||
|
||||
proxy := os.Getenv("PROXY")
|
||||
var httpProxy func(*http.Request) (*url.URL, error)
|
||||
|
||||
if proxy == "" {
|
||||
proxy = "socks5://tor-proxy:5566"
|
||||
if proxy != "" {
|
||||
proxyUrl, _ := url.Parse(proxy)
|
||||
httpProxy = http.ProxyURL(proxyUrl)
|
||||
}
|
||||
|
||||
proxyUrl, _ := url.Parse(proxy)
|
||||
|
||||
client = &http.Client{
|
||||
Transport: &http.Transport{
|
||||
Dial: (&net.Dialer{
|
||||
@ -41,7 +41,7 @@ func main() {
|
||||
MaxConnsPerHost: 0,
|
||||
MaxIdleConnsPerHost: 10,
|
||||
MaxIdleConns: 0,
|
||||
Proxy: http.ProxyURL(proxyUrl),
|
||||
Proxy: httpProxy,
|
||||
},
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user