go-pop3 icon indicating copy to clipboard operation
go-pop3 copied to clipboard

Expose the Dialer instance

Open kubuzetto opened this issue 1 year ago • 0 comments

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)

kubuzetto avatar Feb 08 '24 20:02 kubuzetto