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

How to setup and use the http/https/socks5 proxy to connect IMAP/POP3 server? #169

Open
gzlock opened this issue Sep 5, 2021 · 7 comments
Labels
enhancement New feature or request

Comments

@gzlock
Copy link

gzlock commented Sep 5, 2021

I checked the enough_mail document and no such content.

@robert-virkus
Copy link
Member

What's your use-case? If you have set up a proxy on your system, this should be transparent to any network app as far as I understand....

@gzlock
Copy link
Author

gzlock commented Sep 6, 2021

What's your use-case? If you have set up a proxy on your system, this should be transparent to any network app as far as I understand....

I'm chinese, my browser can open google.com when I use a proxy application
image

But I follow the example(High Level API) and try to connect google server(gmail account), the console show connect dns.google.com timeout.

I tried it on the flutter windows desktop mode.

BTW, I used the ThunderBird mail application, I can’t login to gmail when I use it by default, but it provided the network proxy settings, and I set the proxy to 127.0.0.1:7890, it can login gmail.

@robert-virkus
Copy link
Member

This seems to be an problem for Dart and Flutter, compare for example

I have found this GPL-licensed library that allows to connect via Socks5: https://github.com/v0l/socks5

One idea could be to abstract sockets in enough_mail and allow clients to specify a SocketFactory or similar.

Thoughts? Ideas? Suggestions?

@robert-virkus robert-virkus added the enhancement New feature or request label Sep 7, 2021
@gzlock
Copy link
Author

gzlock commented Sep 8, 2021

It can be done like the dio package, allowing proxy settings https://pub.dev/packages/dio#using-proxy

import 'package:dio/dio.dart';
import 'package:dio/adapter.dart';
...
(dio.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate = (client) {
  // config the http client
  client.findProxy = (uri) {
    //proxy all request to localhost:8888
    return 'PROXY localhost:8888';
  };
  // you can also create a new HttpClient to dio
  // return HttpClient();
};

@robert-virkus
Copy link
Member

Dio just exposes the dart:io HttpClient's findProxy(Uri) callback. While I agree that this would be a nice API, I have no idea how to implement this. I cannot integrate with the above mentioned socks5 project, as that is licensed under the GPL-copy-left license and this does not mix with this project's MPL license.
So either this would need to be re-implemented or solved differently.

The underlying question is:

  • how to connect with a Dart Socket through a socks5 proxy?

@hsy159
Copy link

hsy159 commented Jul 3, 2023

I have a same question.. (maybe it's so late..? lol)
How can i use socks proxy?

@lwdsw
Copy link

lwdsw commented Oct 10, 2023

Has this problem been solved?

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

No branches or pull requests

4 participants