correctly use socks proxy

this shouldn't be hardcoded, i'll eventually put it in the config file
This commit is contained in:
alyssa rose 2021-03-09 21:24:13 +00:00 committed by alyssa
parent f5437ff3ce
commit dd27b1e875
1 changed files with 6 additions and 0 deletions

View File

@ -6,6 +6,7 @@ import (
"log" "log"
"net" "net"
"net/http" "net/http"
"net/url"
"os" "os"
"path/filepath" "path/filepath"
"strings" "strings"
@ -37,6 +38,11 @@ func setupHttp() {
KeepAlive: 3 * time.Minute, KeepAlive: 3 * time.Minute,
DualStack: true, DualStack: true,
}).DialContext }).DialContext
proxyUrl, err := url.Parse("socks5://127.0.0.1:8080")
if err != nil {
log.Fatalln(err)
}
tr.Proxy = http.ProxyURL(proxyUrl)
client := http.DefaultClient client := http.DefaultClient
client.Transport = tr client.Transport = tr
} }