git » chasquid » commit d97a404

chasquid: Use human-readable TLS constants in addReceivedHeader

author Alberto Bertogli
2016-10-01 13:08:43 UTC
committer Alberto Bertogli
2016-10-09 23:51:04 UTC
parent 16d9d45e0637f8f3f00d1a917142f985e5eb6afc

chasquid: Use human-readable TLS constants in addReceivedHeader

Make the "Received" header a bit more human-friendly by using the newly
introduced tlsconst package.

chasquid.go +4 -2

diff --git a/chasquid.go b/chasquid.go
index ddef298..ea67313 100644
--- a/chasquid.go
+++ b/chasquid.go
@@ -27,6 +27,7 @@ import (
 	"blitiri.com.ar/go/chasquid/internal/queue"
 	"blitiri.com.ar/go/chasquid/internal/set"
 	"blitiri.com.ar/go/chasquid/internal/systemd"
+	"blitiri.com.ar/go/chasquid/internal/tlsconst"
 	"blitiri.com.ar/go/chasquid/internal/trace"
 	"blitiri.com.ar/go/chasquid/internal/userdb"
 
@@ -732,8 +733,9 @@ func (c *Conn) addReceivedHeader() {
 
 	v += fmt.Sprintf("by %s (chasquid SMTP) over ", c.hostname)
 	if c.tlsConnState != nil {
-		v += fmt.Sprintf("TLS (%#x-%#x)\n",
-			c.tlsConnState.Version, c.tlsConnState.CipherSuite)
+		v += fmt.Sprintf("%s (%s)\n",
+			tlsconst.VersionName(c.tlsConnState.Version),
+			tlsconst.CipherSuiteName(c.tlsConnState.CipherSuite))
 	} else {
 		v += "plain text!\n"
 	}