go-pop3
go-pop3 copied to clipboard
Expose the Dialer instance
I applied a change that exposes the net.Dialer
to be used for the connection via the Opts
struct. Instead of using net.DialTimeout
, the users of the library can provide a custom Dialer
to control more aspects of the connection step than just the timeout.
- Passing a simple
Dialer
interface here allows one to mock the actual connection part; making unit tests easier. - The users can implement custom dialers to extend the behavior, for example a "proxy dialer" can allow the library to direct the traffic through proxies (this is my use case, and the reason why I'm opening this PR)