mirror of
https://github.com/warmbly/warmbly.git
synced 2026-08-18 16:01:18 +00:00
b71deb37a6
Tiny helper that builds a *net.Dialer (and tls.Dialer wrapper) with an optional LocalAddr. Used by the SMTP and IMAP clients so a worker on a multi-IP box can bind outbound TCP to a specific source IP. Bind IP comes from an explicit *net.TCPAddr on the client, or falls back to the WORKER_BIND_IP env var, or finally to the OS default route. The env-var path is cached once via sync.Once. 4 tests cover explicit bind, nil-passthrough, tls.Dialer composition, and timeout sanity.