Skip to content
This repository has been archived by the owner on Jan 31, 2023. It is now read-only.

Commit

Permalink
Change cooler curl from http proxy to socks5
Browse files Browse the repository at this point in the history
  • Loading branch information
JustHumanz committed Sep 25, 2021
1 parent bfabd75 commit c759d80
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions pkg/network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import (
"math/rand"
"net"
"net/http"
"net/url"
"time"

"github.com/JustHumanz/Go-Simp/pkg/config"
log "github.com/sirupsen/logrus"
"golang.org/x/net/proxy"
"google.golang.org/grpc"
)

Expand Down Expand Up @@ -68,17 +68,15 @@ func Curl(url string, addheader map[string]string) ([]byte, error) {
func CoolerCurl(urls string, addheader map[string]string) ([]byte, error) {
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
proxyURL, err := url.Parse(config.GoSimpConf.MultiTOR)

dialSocksProxy, err := proxy.SOCKS5("tcp", config.GoSimpConf.MultiTOR, nil, proxy.Direct)
if err != nil {
return nil, err
log.Error(err)
}

client := &http.Client{
Transport: &http.Transport{
Proxy: http.ProxyURL(proxyURL),
DialContext: (&net.Dialer{
Timeout: 10 * time.Second,
}).DialContext,
Dial: dialSocksProxy.Dial,
},
}

Expand Down

0 comments on commit c759d80

Please sign in to comment.