gitee.com/lh-her-team/common@v1.5.1/crypto/tls/credentials/credentials_util_go18.go (about) 1 // Copyright 2009 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package credentials 6 7 import ( 8 cmtls "gitee.com/lh-her-team/common/crypto/tls" 9 ) 10 11 // cloneTLSConfig returns a shallow clone of the exported 12 // fields of cfg, ignoring the unexported sync.Once, which 13 // contains a mutex and must not be copied. 14 // 15 // If cfg is nil, a new zero tls.Config is returned. 16 func cloneTLSConfig(cfg *cmtls.Config) *cmtls.Config { 17 if cfg == nil { 18 return &cmtls.Config{} 19 } 20 return cfg.Clone() 21 }