37 lines
673 B
Go
37 lines
673 B
Go
package windscribe
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"io"
|
|
"net/http"
|
|
"net/url"
|
|
"os"
|
|
"strings"
|
|
)
|
|
|
|
func (c *client) MatchingPort(ctx context.Context) error {
|
|
ephVals := url.Values{
|
|
"port": []string{""},
|
|
"ctime": []string{fmt.Sprint(c.csrf.Time)},
|
|
"ctoken": []string{c.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
|
|
}
|