-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
42 lines (34 loc) · 935 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package main
import (
"log"
"net/http"
"net/url"
"time"
)
// Drugula Market URL
var webUrl string = "http://drugula44brpin5w2xk6j3adll35pp3zdihqqkndhg336j55pwdtufyd.onion/"
// Tor proxy
var torProxy string = "socks5://127.0.0.1:9050"
func main() {
for {
go statusCheck()
time.Sleep(time.Second * 60)
}
}
func statusCheck() {
// Parse Tor proxy URL string to a URL type
torProxyUrl, err := url.Parse(torProxy)
if err != nil {
log.Print("Error parsing Tor proxy URL:", torProxy, ".", err)
}
// Set up a custom HTTP transport to use the proxy and create the client
torTransport := &http.Transport{Proxy: http.ProxyURL(torProxyUrl)}
client := &http.Client{Transport: torTransport, Timeout: time.Second * 10}
// Make request
resp, err := client.Get(webUrl)
if err != nil {
log.Print("Error making GET request.", err)
}
defer resp.Body.Close()
log.Println("Drugula Market status code:", resp.StatusCode)
}