-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Google Cloud Platform support #13598
Changes from all commits
73a6be9
8c020df
2be6675
d1a264b
35ab57b
bc01ef6
bf3dfb7
1d96ecb
176f687
7e6b60c
d7ab36a
da0a9ea
bfd2f6c
67a11a4
f18cb77
9edf6e7
04cd032
44cedcd
40b7f0f
83151d1
1cfcc25
4fbc832
1400084
2a3da59
a55c9f5
c7e8a01
42b53af
ed570e8
c556ae8
93c66f7
1a6d4ae
80228fe
0872410
419be75
19919f5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Licensed to Elasticsearch B.V. under one or more contributor | ||
// license agreements. See the NOTICE file distributed with | ||
// this work for additional information regarding copyright | ||
// ownership. Elasticsearch B.V. licenses this file to you under | ||
// the Apache License, Version 2.0 (the "License"); you may | ||
// not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
package tlscommon | ||
|
||
import "fmt" | ||
|
||
// TLSVersion type for TLS version. | ||
type TLSVersion uint16 | ||
|
||
func (v TLSVersion) String() string { | ||
if s, ok := tlsProtocolVersionsInverse[v]; ok { | ||
return s | ||
} | ||
return "unknown" | ||
} | ||
|
||
//Unpack transforms the string into a constant. | ||
func (v *TLSVersion) Unpack(s string) error { | ||
version, found := tlsProtocolVersions[s] | ||
if !found { | ||
return fmt.Errorf("invalid tls version '%v'", s) | ||
} | ||
|
||
*v = version | ||
return nil | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// Licensed to Elasticsearch B.V. under one or more contributor | ||
// license agreements. See the NOTICE file distributed with | ||
// this work for additional information regarding copyright | ||
// ownership. Elasticsearch B.V. licenses this file to you under | ||
// the Apache License, Version 2.0 (the "License"); you may | ||
// not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
// +build go1.13 | ||
|
||
package tlscommon | ||
|
||
import "crypto/tls" | ||
|
||
// Define all the possible TLS version. | ||
const ( | ||
TLSVersionSSL30 TLSVersion = tls.VersionSSL30 | ||
TLSVersion10 TLSVersion = tls.VersionTLS10 | ||
TLSVersion11 TLSVersion = tls.VersionTLS11 | ||
TLSVersion12 TLSVersion = tls.VersionTLS12 | ||
TLSVersion13 TLSVersion = tls.VersionTLS13 | ||
|
||
// TLSVersionMin is the min TLS version supported. | ||
TLSVersionMin = TLSVersionSSL30 | ||
|
||
// TLSVersionMax is the max TLS version supported. | ||
TLSVersionMax = TLSVersion13 | ||
|
||
// TLSVersionDefaultMin is the minimal default TLS version that is | ||
// enabled by default. TLSVersionDefaultMin is >= TLSVersionMin | ||
TLSVersionDefaultMin = TLSVersion11 | ||
|
||
// TLSVersionDefaultMax is the max default TLS version that | ||
// is enabled by default. | ||
TLSVersionDefaultMax = TLSVersionMax | ||
) | ||
|
||
// TLSDefaultVersions list of versions of TLS we should support. | ||
var TLSDefaultVersions = []TLSVersion{ | ||
TLSVersion11, | ||
TLSVersion12, | ||
TLSVersion13, | ||
} | ||
|
||
var tlsProtocolVersions = map[string]TLSVersion{ | ||
"SSLv3": TLSVersionSSL30, | ||
"SSLv3.0": TLSVersionSSL30, | ||
"TLSv1": TLSVersion10, | ||
"TLSv1.0": TLSVersion10, | ||
"TLSv1.1": TLSVersion11, | ||
"TLSv1.2": TLSVersion12, | ||
"TLSv1.3": TLSVersion13, | ||
} | ||
|
||
var tlsProtocolVersionsInverse = map[TLSVersion]string{ | ||
TLSVersionSSL30: "SSLv3", | ||
TLSVersion10: "TLSv1.0", | ||
TLSVersion11: "TLSv1.1", | ||
TLSVersion12: "TLSv1.2", | ||
TLSVersion13: "TLSv1.3", | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// Licensed to Elasticsearch B.V. under one or more contributor | ||
// license agreements. See the NOTICE file distributed with | ||
// this work for additional information regarding copyright | ||
// ownership. Elasticsearch B.V. licenses this file to you under | ||
// the Apache License, Version 2.0 (the "License"); you may | ||
// not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
// +build !go1.13 | ||
|
||
package tlscommon | ||
|
||
import "crypto/tls" | ||
|
||
const ( | ||
TLSVersionSSL30 TLSVersion = tls.VersionSSL30 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. exported const TLSVersionSSL30 should have comment (or a comment on this block) or be unexported There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. exported const TLSVersionSSL30 should have comment (or a comment on this block) or be unexported |
||
TLSVersion10 TLSVersion = tls.VersionTLS10 | ||
TLSVersion11 TLSVersion = tls.VersionTLS11 | ||
TLSVersion12 TLSVersion = tls.VersionTLS12 | ||
|
||
// TLSVersionMin is the min TLS version supported. | ||
TLSVersionMin = TLSVersionSSL30 | ||
|
||
// TLSVersionMax is the max TLS version supported. | ||
TLSVersionMax = TLSVersion12 | ||
|
||
// TLSVersionDefaultMin is the minimal default TLS version that is | ||
// enabled by default. TLSVersionDefaultMin is >= TLSVersionMin | ||
TLSVersionDefaultMin = TLSVersion10 | ||
|
||
// TLSVersionDefaultMax is the max default TLS version that | ||
// is enabled by default. | ||
TLSVersionDefaultMax = TLSVersionMax | ||
) | ||
|
||
// TLSDefaultVersions list of versions of TLS we should support. | ||
var TLSDefaultVersions = []TLSVersion{ | ||
TLSVersion10, | ||
TLSVersion11, | ||
TLSVersion12, | ||
} | ||
|
||
var tlsProtocolVersions = map[string]TLSVersion{ | ||
"SSLv3": TLSVersionSSL30, | ||
"SSLv3.0": TLSVersionSSL30, | ||
"TLSv1": TLSVersion10, | ||
"TLSv1.0": TLSVersion10, | ||
"TLSv1.1": TLSVersion11, | ||
"TLSv1.2": TLSVersion12, | ||
} | ||
|
||
var tlsProtocolVersionsInverse = map[TLSVersion]string{ | ||
TLSVersionSSL30: "SSLv3", | ||
TLSVersion10: "TLSv1.0", | ||
TLSVersion11: "TLSv1.1", | ||
TLSVersion12: "TLSv1.2", | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exported const TLSVersionSSL30 should have comment (or a comment on this block) or be unexported