mirror of
https://github.com/mjl-/mox.git
synced 2024-12-26 16:33:47 +03:00
smtpclient: expose entire tls connectionstate, not just whether tls was enabled
for moxtools
This commit is contained in:
parent
f3a35a6766
commit
19d1a8059b
2 changed files with 10 additions and 6 deletions
|
@ -596,7 +596,7 @@ func deliverHost(log mlog.Log, resolver dns.Resolver, dialer smtpclient.Dialer,
|
||||||
// be accurate for the whole domain, but we're only storing a hint.
|
// be accurate for the whole domain, but we're only storing a hint.
|
||||||
rdt := store.RecipientDomainTLS{
|
rdt := store.RecipientDomainTLS{
|
||||||
Domain: m.RecipientDomain.Domain.Name(),
|
Domain: m.RecipientDomain.Domain.Name(),
|
||||||
STARTTLS: sc.TLSEnabled(),
|
STARTTLS: sc.TLSConnectionState() != nil,
|
||||||
RequireTLS: sc.SupportsRequireTLS(),
|
RequireTLS: sc.SupportsRequireTLS(),
|
||||||
}
|
}
|
||||||
if err = updateRecipientDomainTLS(ctx, log, m.SenderAccount, rdt); err != nil {
|
if err = updateRecipientDomainTLS(ctx, log, m.SenderAccount, rdt); err != nil {
|
||||||
|
|
|
@ -941,9 +941,13 @@ func (c *Client) SupportsRequireTLS() bool {
|
||||||
return c.extRequireTLS
|
return c.extRequireTLS
|
||||||
}
|
}
|
||||||
|
|
||||||
// TLSEnabled returns whether TLS is enabled for this connection.
|
// TLSConnectionState returns TLS details if TLS is enabled, and nil otherwise.
|
||||||
func (c *Client) TLSEnabled() bool {
|
func (c *Client) TLSConnectionState() *tls.ConnectionState {
|
||||||
return c.tls
|
if tlsConn, ok := c.conn.(*tls.Conn); ok {
|
||||||
|
cs := tlsConn.ConnectionState()
|
||||||
|
return &cs
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deliver attempts to deliver a message to a mail server.
|
// Deliver attempts to deliver a message to a mail server.
|
||||||
|
@ -1140,8 +1144,8 @@ func (c *Client) Botched() bool {
|
||||||
|
|
||||||
// Close cleans up the client, closing the underlying connection.
|
// Close cleans up the client, closing the underlying connection.
|
||||||
//
|
//
|
||||||
// If the connection is in initialized and not botched, a QUIT command is sent and
|
// If the connection is initialized and not botched, a QUIT command is sent and the
|
||||||
// the response read with a short timeout before closing the underlying connection.
|
// response read with a short timeout before closing the underlying connection.
|
||||||
//
|
//
|
||||||
// Close returns any error encountered during QUIT and closing.
|
// Close returns any error encountered during QUIT and closing.
|
||||||
func (c *Client) Close() (rerr error) {
|
func (c *Client) Close() (rerr error) {
|
||||||
|
|
Loading…
Reference in a new issue