-
-
Notifications
You must be signed in to change notification settings - Fork 134
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
Can I set a proxy login when I log in? #1451
Comments
yes sock5, _ := proxy.SOCKS5("tcp", "10.0.0.14:7890", &proxy.Auth{
User: "",
Password: "",
}, proxy.Direct)
dc := sock5.(proxy.ContextDialer)
client := telegram.NewClient(appID, appHash, telegram.Options{
Resolver: dcs.Plain(dcs.PlainOptions{Dial: dc.DialContext}),
}) |
Yes, it is possible just like @Flipped199 said it. func NewDialer(proxyConnStr string) (proxy.Dialer, error) {
url, err := url.Parse(proxyConnStr)
if err != nil {
return nil, err
}
socks5, err := proxy.FromURL(url, proxy.Direct)
if err != nil {
return nil, err
}
return socks5, nil
}
func NewResolver(proxyConnStr string) (dcs.Resolver, error) {
var resolver dcs.Resolver
socks5, err := NewDialer(proxyConnStr)
if err != nil {
return nil, err
}
dc := socks5.(proxy.ContextDialer)
resolver = dcs.Plain(dcs.PlainOptions{
Dial: dc.DialContext,
})
return resolver, nil
}
proxy := "https://proxy_userid:proxy_password@proxy_ip:proxy_port"
resolver, err = NewResolver(proxy)
if err != nil {
return err
}
client := telegram.NewClient(appID, appHash, telegram.Options{
Resolver: dcs.Plain(dcs.PlainOptions{Dial: dc.DialContext}),
}) You need to use the package This question should be asked in the "discussions" section to be honest, and it was already answered here: #714. |
Can I set a proxy login when I log in? I don't see any way to configure it, please help me, thank you very much !!!
The text was updated successfully, but these errors were encountered: