6 * Copyright 2016 gRPC authors.
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
28 // cloneTLSConfig returns a shallow clone of the exported
29 // fields of cfg, ignoring the unexported sync.Once, which
30 // contains a mutex and must not be copied.
32 // If cfg is nil, a new zero tls.Config is returned.
33 func cloneTLSConfig(cfg *tls.Config) *tls.Config {
40 Certificates: cfg.Certificates,
41 NameToCertificate: cfg.NameToCertificate,
42 GetCertificate: cfg.GetCertificate,
44 NextProtos: cfg.NextProtos,
45 ServerName: cfg.ServerName,
46 ClientAuth: cfg.ClientAuth,
47 ClientCAs: cfg.ClientCAs,
48 InsecureSkipVerify: cfg.InsecureSkipVerify,
49 CipherSuites: cfg.CipherSuites,
50 PreferServerCipherSuites: cfg.PreferServerCipherSuites,
51 SessionTicketsDisabled: cfg.SessionTicketsDisabled,
52 SessionTicketKey: cfg.SessionTicketKey,
53 ClientSessionCache: cfg.ClientSessionCache,
54 MinVersion: cfg.MinVersion,
55 MaxVersion: cfg.MaxVersion,
56 CurvePreferences: cfg.CurvePreferences,
57 DynamicRecordSizingDisabled: cfg.DynamicRecordSizingDisabled,
58 Renegotiation: cfg.Renegotiation,