Perform protocol tests
This commit is contained in:
parent
e2bc8eb5b4
commit
cda781cf71
35
eyespot/protocolts/protocols.go
Normal file
35
eyespot/protocolts/protocols.go
Normal 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
|
||||
}
|
Loading…
Reference in New Issue
Block a user