forked from thanos-io/thanos
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow user to specify tls version for backward compatibility (thanos-…
…io#7654) * optional tls version logic Signed-off-by: pureiboi <[email protected]> * update cmd description and match doc Signed-off-by: pureiboi <[email protected]> * feat: update doc with make docs Signed-off-by: pureiboi <[email protected]> * fix indentation by linter Signed-off-by: pureiboi <[email protected]> --------- Signed-off-by: pureiboi <[email protected]> Signed-off-by: pureiboi <[email protected]
- Loading branch information
Showing
15 changed files
with
158 additions
and
21 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
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
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
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
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,58 @@ | ||
// Copyright (c) The Thanos Authors. | ||
// Licensed under the Apache License 2.0. | ||
|
||
package tls | ||
|
||
import ( | ||
"crypto/tls" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestTlsOptions(t *testing.T) { | ||
var tests = []struct { | ||
input string | ||
fail bool | ||
result uint16 | ||
}{ | ||
{ | ||
input: "", | ||
fail: true, | ||
}, { | ||
input: "ab", | ||
fail: true, | ||
}, { | ||
input: "1", | ||
fail: true, | ||
}, { | ||
input: "1.0", | ||
result: tls.VersionTLS10, | ||
}, | ||
{ | ||
input: "1.1", | ||
result: tls.VersionTLS11, | ||
}, | ||
{ | ||
input: "1.2", | ||
result: tls.VersionTLS12, | ||
}, | ||
{ | ||
input: "1.3", | ||
result: tls.VersionTLS13, | ||
}, | ||
} | ||
|
||
for _, test := range tests { | ||
minTlsVersion, err := getTlsVersion(test.input) | ||
|
||
if test.fail { | ||
require.Error(t, err) | ||
continue | ||
} | ||
|
||
require.NoError(t, err) | ||
assert.Equal(t, test.result, minTlsVersion) | ||
} | ||
} |
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