Add IsSecure() to Transport

This commit is contained in:
Wichert Akkerman
2019-10-11 07:15:47 +02:00
committed by Mickaël Rémond
parent 7fa4b06705
commit 8db608ccc1
4 changed files with 21 additions and 6 deletions
+7 -1
View File
@@ -11,7 +11,8 @@ type XMPPTransport struct {
Config TransportConfiguration
TLSConfig *tls.Config
// TCP level connection / can be replaced by a TLS session after starttls
conn net.Conn
conn net.Conn
isSecure bool
}
func (t *XMPPTransport) Connect() error {
@@ -25,6 +26,10 @@ func (t XMPPTransport) DoesStartTLS() bool {
return true
}
func (t XMPPTransport) IsSecure() bool {
return t.isSecure
}
func (t *XMPPTransport) StartTLS(domain string) error {
if t.Config.TLSConfig == nil {
t.Config.TLSConfig = &tls.Config{}
@@ -45,6 +50,7 @@ func (t *XMPPTransport) StartTLS(domain string) error {
}
}
t.isSecure = true
return nil
}