Perform protocol tests

This commit is contained in:
nemunaire 2015-07-12 16:24:18 +02:00
parent e2bc8eb5b4
commit cda781cf71

View File

@ -0,0 +1,35 @@
package protocolts
import (
"crypto/tls"
)
func Run(protocol string, host string) (map[uint16]bool) {
result := map[uint16]bool{}
for _, v := range []uint16{
tls.VersionSSL30,
tls.VersionTLS10,
tls.VersionTLS11,
tls.VersionTLS12,
} {
r, _ := test(protocol, host, v)
result[v] = r
}
return result
}
func test(protocol string, host string, version uint16) (bool, error) {
conn, err := tls.Dial(protocol, host, &tls.Config{
MinVersion: version,
MaxVersion: version,
InsecureSkipVerify: true,
})
if err != nil {
return false, err
}
defer conn.Close();
return true, nil
}