36 lines
605 B
Go
36 lines
605 B
Go
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
|
|
}
|