Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTPS Proxy is not working: unknown scheme https #700

Closed
mircoianese opened this issue Nov 17, 2024 · 1 comment
Closed

HTTPS Proxy is not working: unknown scheme https #700

mircoianese opened this issue Nov 17, 2024 · 1 comment

Comments

@mircoianese
Copy link

Hello,

I'm trying to set up an HTTPS proxy but I'm getting this error while connecting:
failed to connect: couldn't dial whatsapp web websocket: proxy: unknown scheme: https

This is my code:

client := whatsmeow.NewClient(device, clientLog)

err := client.SetProxyAddress("https://username:[email protected]:1234", whatsmeow.SetProxyOptions{
    NoWebsocket: false,
    NoMedia:     false,
})

// err here is nil

err := client.Connect()

By further looking at the code, I see the proxy_FromURL function from x_net_proxy.go package getting called:

// FromURL returns a Dialer given a URL specification and an underlying
// Dialer for it to make network requests.
func proxy_FromURL(u *url.URL, forward proxy_Dialer) (proxy_Dialer, error) {
	var auth *proxy_Auth
	if u.User != nil {
		auth = new(proxy_Auth)
		auth.User = u.User.Username()
		if p, ok := u.User.Password(); ok {
			auth.Password = p
		}
	}

	switch u.Scheme {
	case "socks5":
		return proxy_SOCKS5("tcp", u.Host, auth, forward)
	}

	// If the scheme doesn't match any of the built-in schemes, see if it
	// was registered by another package.
	if proxy_proxySchemes != nil {
		if f, ok := proxy_proxySchemes[u.Scheme]; ok {
			return f(u, forward)
		}
	}

	return nil, errors.New("proxy: unknown scheme: " + u.Scheme)
}

And this is the function that's returning the error.
Thank you

@mircoianese
Copy link
Author

Closing, seems to be related to: gorilla/websocket#950

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant