This commit is contained in:
Vladislav Yarmak 2021-03-26 22:40:27 +02:00
parent c7c6bba005
commit e6b0ede774
2 changed files with 12 additions and 12 deletions

22
main.go
View file

@ -15,7 +15,7 @@ import (
) )
var ( var (
version = "undefined" version = "undefined"
) )
func perror(msg string) { func perror(msg string) {
@ -31,18 +31,18 @@ func arg_fail(msg string) {
} }
type CLIArgs struct { type CLIArgs struct {
country string country string
bind_address string bind_address string
verbosity int verbosity int
timeout time.Duration timeout time.Duration
resolver string resolver string
showVersion bool showVersion bool
proxy string proxy string
} }
func parse_args() CLIArgs { func parse_args() CLIArgs {
var args CLIArgs var args CLIArgs
flag.StringVar(&args.country, "country", "us", "desired proxy location") flag.StringVar(&args.country, "country", "EU", "desired proxy location")
flag.BoolVar(&args.list_countries, "list-countries", false, "list available countries and exit") flag.BoolVar(&args.list_countries, "list-countries", false, "list available countries and exit")
flag.BoolVar(&args.list_proxies, "list-proxies", false, "output proxy list and exit") flag.BoolVar(&args.list_proxies, "list-proxies", false, "output proxy list and exit")
flag.StringVar(&args.bind_address, "bind-address", "127.0.0.1:8080", "HTTP proxy listen address") flag.StringVar(&args.bind_address, "bind-address", "127.0.0.1:8080", "HTTP proxy listen address")
@ -53,8 +53,8 @@ func parse_args() CLIArgs {
"DNS/DoH/DoT resolver to workaround Hola blocked hosts. "+ "DNS/DoH/DoT resolver to workaround Hola blocked hosts. "+
"See https://github.com/ameshkov/dnslookup/ for upstream DNS URL format.") "See https://github.com/ameshkov/dnslookup/ for upstream DNS URL format.")
flag.BoolVar(&args.showVersion, "version", false, "show program version and exit") flag.BoolVar(&args.showVersion, "version", false, "show program version and exit")
flag.StringVar(&args.proxy, "proxy", "", "sets base proxy to use for all dial-outs. " + flag.StringVar(&args.proxy, "proxy", "", "sets base proxy to use for all dial-outs. "+
"Format: <http|https|socks5|socks5h>://[login:password@]host[:port] " + "Format: <http|https|socks5|socks5h>://[login:password@]host[:port] "+
"Examples: http://user:password@192.168.1.1:3128, socks5://10.0.0.1:1080") "Examples: http://user:password@192.168.1.1:3128, socks5://10.0.0.1:1080")
flag.Parse() flag.Parse()
if args.country == "" { if args.country == "" {

View file

@ -249,7 +249,7 @@ func (c *SEClient) GeoList(ctx context.Context) ([]SEGeoEntry, error) {
func (c *SEClient) Discover(ctx context.Context, requestedGeo string) ([]SEIPEntry, error) { func (c *SEClient) Discover(ctx context.Context, requestedGeo string) ([]SEIPEntry, error) {
geoListInput := url.Values{ geoListInput := url.Values{
"serial_no": {c.AssignedDeviceIDHash}, "serial_no": {c.AssignedDeviceIDHash},
"requested_geo": {requestedGeo}, "requested_geo": {requestedGeo},
} }
req, err := http.NewRequestWithContext( req, err := http.NewRequestWithContext(