package main import ( "encoding/json" "fmt" "io" "log" "net/http" "net/http/cookiejar" "net/url" "os" "strings" "dynatron.me/x/windport/pkg/windscribe" ) func main() { a := windscribe.Auth{} err := json.NewDecoder(os.Stdin).Decode(&a) if err != nil { log.Fatal(err) } var PTransport http.RoundTripper = &http.Transport{Proxy: http.ProxyFromEnvironment} cli := client{ hc: http.DefaultClient, auth: a, } cli.hc.Transport = PTransport cli.hc.Jar, err = cookiejar.New(nil) if err != nil { log.Fatal(err) } err = cli.matchingPort() if err != nil { log.Fatal(err) } } type client struct { hc *http.Client auth Auth } func (c *client) matchingPort() error { ephVals := url.Values{ "port": []string{""}, "ctime": []string{fmt.Sprint(csrf.Time)}, "ctoken": []string{csrf.Token}, } req, err = http.NewRequestWithContext(ctx, "POST", "https://windscribe.com/staticips/postEphPort", strings.NewReader(ephVals.Encode())) if err != nil { return err } fillReq(req) req.Header.Set("referer", "https://windscribe.com/myaccount") resp, err = c.hc.Do(req) if err != nil { return err } io.Copy(os.Stderr, resp.Body) cleanupBody(resp.Body) return nil }