@@ -62,39 +62,19 @@ type HandshakeVerificationInfo struct {
62
62
Leaf * x509.Certificate
63
63
}
64
64
65
- // VerificationFuncParams contains parameters available to users when
66
- // implementing CustomVerificationFunc.
67
- // The fields in this struct are read-only.
68
- //
69
- // Deprecated: use HandshakeVerificationInfo instead.
70
- type VerificationFuncParams = HandshakeVerificationInfo
71
-
72
65
// PostHandshakeVerificationResults contains the information about results of
73
66
// PostHandshakeVerificationFunc.
74
67
// PostHandshakeVerificationResults is an empty struct for now. It may be extended in the
75
68
// future to include more information.
76
69
type PostHandshakeVerificationResults struct {}
77
70
78
- // VerificationResults contains the information about results of
79
- // PostHandshakeVerificationFunc.
80
- // Deprecated: use PostHandshakeVerificationResults instead.
81
- type VerificationResults = PostHandshakeVerificationResults
82
-
83
71
// PostHandshakeVerificationFunc is the function defined by users to perform
84
72
// custom verification checks after chain building and regular handshake
85
73
// verification has been completed.
86
74
// PostHandshakeVerificationFunc should return (nil, error) if the authorization
87
75
// should fail, with the error containing information on why it failed.
88
76
type PostHandshakeVerificationFunc func (params * HandshakeVerificationInfo ) (* PostHandshakeVerificationResults , error )
89
77
90
- // CustomVerificationFunc is the function defined by users to perform custom
91
- // verification check.
92
- // CustomVerificationFunc returns nil if the authorization fails; otherwise
93
- // returns an empty struct.
94
- //
95
- // Deprecated: use PostHandshakeVerificationFunc instead.
96
- type CustomVerificationFunc = PostHandshakeVerificationFunc
97
-
98
78
// ConnectionInfo contains the parameters available to users when
99
79
// implementing GetRootCertificates.
100
80
type ConnectionInfo struct {
@@ -104,12 +84,6 @@ type ConnectionInfo struct {
104
84
RawCerts [][]byte
105
85
}
106
86
107
- // GetRootCAsParams contains the parameters available to users when
108
- // implementing GetRootCAs.
109
- //
110
- // Deprecated: use ConnectionInfo instead.
111
- type GetRootCAsParams = ConnectionInfo
112
-
113
87
// RootCertificates is the result of GetRootCertificates.
114
88
// If users want to reload the root trust certificate, it is required to return
115
89
// the proper TrustCerts in GetRootCAs.
@@ -118,13 +92,6 @@ type RootCertificates struct {
118
92
TrustCerts * x509.CertPool
119
93
}
120
94
121
- // GetRootCAsResults contains the results of GetRootCAs.
122
- // If users want to reload the root trust certificate, it is required to return
123
- // the proper TrustCerts in GetRootCAs.
124
- //
125
- // Deprecated: use RootCertificates instead.
126
- type GetRootCAsResults = RootCertificates
127
-
128
95
// RootCertificateOptions contains options to obtain root trust certificates
129
96
// for both the client and the server.
130
97
// At most one field should be set. If none of them are set, we use the system
@@ -134,11 +101,6 @@ type RootCertificateOptions struct {
134
101
// If RootCertificates is set, it will be used every time when verifying
135
102
// the peer certificates, without performing root certificate reloading.
136
103
RootCertificates * x509.CertPool
137
- // If RootCACerts is set, it will be used every time when verifying
138
- // the peer certificates, without performing root certificate reloading.
139
- //
140
- // Deprecated: use RootCertificates instead.
141
- RootCACerts * x509.CertPool
142
104
// If GetRootCertificates is set, it will be invoked to obtain root certs for
143
105
// every new connection.
144
106
GetRootCertificates func (params * ConnectionInfo ) (* RootCertificates , error )
@@ -213,14 +175,6 @@ const (
213
175
SkipVerification
214
176
)
215
177
216
- // ClientOptions contains the fields needed to be filled by the client.
217
- // Deprecated: use Options instead.
218
- type ClientOptions = Options
219
-
220
- // ServerOptions contains the fields needed to be filled by the server.
221
- // Deprecated: use Options instead.
222
- type ServerOptions = Options
223
-
224
178
// Options contains the fields a user can configure when setting up TLS clients
225
179
// and servers
226
180
type Options struct {
@@ -233,13 +187,6 @@ type Options struct {
233
187
// If this is set, we will perform this customized check after doing the
234
188
// normal check(s) indicated by setting VerificationType.
235
189
AdditionalPeerVerification PostHandshakeVerificationFunc
236
- // VerifyPeer is a custom verification check after certificate signature
237
- // check.
238
- // If this is set, we will perform this customized check after doing the
239
- // normal check(s) indicated by setting VerificationType.
240
- //
241
- // Deprecated: use AdditionalPeerVerification instead.
242
- VerifyPeer PostHandshakeVerificationFunc
243
190
// RootOptions is OPTIONAL on server side. This field only needs to be set if
244
191
// mutual authentication is required(RequireClientCert is true).
245
192
RootOptions RootCertificateOptions
@@ -251,26 +198,9 @@ type Options struct {
251
198
// the `VerificationType` enum for the different options.
252
199
// Default: CertAndHostVerification
253
200
VerificationType VerificationType
254
- // VType is the verification type on the server side.
255
- //
256
- // Deprecated: use VerificationType instead.
257
- VType VerificationType
258
201
// RevocationOptions is the configurations for certificate revocation checks.
259
202
// It could be nil if such checks are not needed.
260
203
RevocationOptions * RevocationOptions
261
- // RevocationConfig is the configurations for certificate revocation checks.
262
- // It could be nil if such checks are not needed.
263
- //
264
- // Deprecated: use RevocationOptions instead.
265
- RevocationConfig * RevocationConfig
266
- // MinVersion contains the minimum TLS version that is acceptable.
267
- //
268
- // Deprecated: use MinTLSVersion instead.
269
- MinVersion uint16
270
- // MaxVersion contains the maximum TLS version that is acceptable.
271
- //
272
- // Deprecated: use MaxTLSVersion instead.
273
- MaxVersion uint16
274
204
// MinTLSVersion contains the minimum TLS version that is acceptable.
275
205
// The value should be set using tls.VersionTLSxx from https://pkg.go.dev/crypto/tls
276
206
// By default, TLS 1.2 is currently used as the minimum when acting as a
@@ -296,35 +226,6 @@ type Options struct {
296
226
}
297
227
298
228
func (o * Options ) clientConfig () (* tls.Config , error ) {
299
- // TODO(gtcooke94) Remove this block when o.VerifyPeer is remoed.
300
- // VerifyPeer is deprecated, but do this to aid the transitory migration time.
301
- if o .AdditionalPeerVerification == nil {
302
- o .AdditionalPeerVerification = o .VerifyPeer
303
- }
304
- // TODO(gtcooke94). VType is deprecated, eventually remove this block. This
305
- // will ensure that users still explicitly setting `VType` will get the
306
- // setting to the right place.
307
- if o .VType != CertAndHostVerification {
308
- o .VerificationType = o .VType
309
- }
310
- // TODO(gtcooke94) MinVersion and MaxVersion are deprected, eventually
311
- // remove this block. This is a temporary fallback to ensure that if the
312
- // refactored names aren't set we use the old names.
313
- if o .MinTLSVersion == 0 {
314
- o .MinTLSVersion = o .MinVersion
315
- }
316
- if o .MaxTLSVersion == 0 {
317
- o .MaxTLSVersion = o .MaxVersion
318
- }
319
- // TODO(gtcooke94) RootCACerts is deprecated, eventually remove this block.
320
- // This will ensure that users still explicitly setting RootCACerts will get
321
- // the setting int the right place.
322
- if o .RootOptions .RootCACerts != nil {
323
- o .RootOptions .RootCertificates = o .RootOptions .RootCACerts
324
- // There are additional checks that only 1 field of `RootOptions` is
325
- // non-nil, so set the deprecated field to nil
326
- o .RootOptions .RootCACerts = nil
327
- }
328
229
if o .VerificationType == SkipVerification && o .AdditionalPeerVerification == nil {
329
230
return nil , fmt .Errorf ("client needs to provide custom verification mechanism if choose to skip default verification" )
330
231
}
@@ -410,35 +311,6 @@ func (o *Options) clientConfig() (*tls.Config, error) {
410
311
}
411
312
412
313
func (o * Options ) serverConfig () (* tls.Config , error ) {
413
- // TODO(gtcooke94) Remove this block when o.VerifyPeer is remoed.
414
- // VerifyPeer is deprecated, but do this to aid the transitory migration time.
415
- if o .AdditionalPeerVerification == nil {
416
- o .AdditionalPeerVerification = o .VerifyPeer
417
- }
418
- // TODO(gtcooke94). VType is deprecated, eventually remove this block. This
419
- // will ensure that users still explicitly setting `VType` will get the
420
- // setting to the right place.
421
- if o .VType != CertAndHostVerification {
422
- o .VerificationType = o .VType
423
- }
424
- // TODO(gtcooke94) MinVersion and MaxVersion are deprected, eventually
425
- // remove this block. This is a temporary fallback to ensure that if the
426
- // refactored names aren't set we use the old names.
427
- if o .MinTLSVersion == 0 {
428
- o .MinTLSVersion = o .MinVersion
429
- }
430
- if o .MaxTLSVersion == 0 {
431
- o .MaxTLSVersion = o .MaxVersion
432
- }
433
- // TODO(gtcooke94) RootCACerts is deprecated, eventually remove this block.
434
- // This will ensure that users still explicitly setting RootCACerts will get
435
- // the setting int the right place.
436
- if o .RootOptions .RootCACerts != nil {
437
- o .RootOptions .RootCertificates = o .RootOptions .RootCACerts
438
- // There are additional checks that only 1 field of `RootOptions` is
439
- // non-nil, so set the deprecated field to nil
440
- o .RootOptions .RootCACerts = nil
441
- }
442
314
if o .RequireClientCert && o .VerificationType == SkipVerification && o .AdditionalPeerVerification == nil {
443
315
return nil , fmt .Errorf ("server needs to provide custom verification mechanism if choose to skip default verification, but require client certificate(s)" )
444
316
}
@@ -728,12 +600,6 @@ func buildVerifyFunc(c *advancedTLSCreds,
728
600
// NewClientCreds uses ClientOptions to construct a TransportCredentials based
729
601
// on TLS.
730
602
func NewClientCreds (o * Options ) (credentials.TransportCredentials , error ) {
731
- // TODO(gtcooke94) RevocationConfig is deprecated, eventually remove this block.
732
- // This will ensure that users still explicitly setting RevocationConfig will get
733
- // the setting in the right place.
734
- if o .RevocationConfig != nil {
735
- o .RevocationOptions = o .RevocationConfig
736
- }
737
603
conf , err := o .clientConfig ()
738
604
if err != nil {
739
605
return nil , err
@@ -753,12 +619,6 @@ func NewClientCreds(o *Options) (credentials.TransportCredentials, error) {
753
619
// NewServerCreds uses ServerOptions to construct a TransportCredentials based
754
620
// on TLS.
755
621
func NewServerCreds (o * Options ) (credentials.TransportCredentials , error ) {
756
- // TODO(gtcooke94) RevocationConfig is deprecated, eventually remove this block.
757
- // This will ensure that users still explicitly setting RevocationConfig will get
758
- // the setting in the right place.
759
- if o .RevocationConfig != nil {
760
- o .RevocationOptions = o .RevocationConfig
761
- }
762
622
conf , err := o .serverConfig ()
763
623
if err != nil {
764
624
return nil , err
0 commit comments