forked from denisenkom/go-mssqldb
-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add tlsmin connection parameter (#45)
* add tlsmin connection parameter * fix typoe * fix param name * 1.3 is too new for old go * tls 1.3 is go 1.12+
- Loading branch information
1 parent
63479d5
commit 2d408c3
Showing
6 changed files
with
71 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//go:build go1.12 | ||
// +build go1.12 | ||
|
||
package msdsn | ||
|
||
import "crypto/tls" | ||
|
||
func TLSVersionFromString(minTLSVersion string) uint16 { | ||
switch minTLSVersion { | ||
case "1.0": | ||
return tls.VersionTLS10 | ||
case "1.1": | ||
return tls.VersionTLS11 | ||
case "1.2": | ||
return tls.VersionTLS12 | ||
case "1.3": | ||
return tls.VersionTLS13 | ||
default: | ||
// use the tls package default | ||
} | ||
return 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
//go:build !go1.12 | ||
// +build !go1.12 | ||
|
||
package msdsn | ||
|
||
import "crypto/tls" | ||
|
||
func TLSVersionFromString(minTLSVersion string) uint16 { | ||
switch minTLSVersion { | ||
case "1.0": | ||
return tls.VersionTLS10 | ||
case "1.1": | ||
return tls.VersionTLS11 | ||
case "1.2": | ||
return tls.VersionTLS12 | ||
default: | ||
// use the tls package default | ||
} | ||
return 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters