mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2025-05-09 17:20:12 +03:00
home: refactor more
This commit is contained in:
parent
a8850059db
commit
f36efa26a4
4 changed files with 49 additions and 36 deletions
internal/home
|
@ -225,18 +225,25 @@ type tlsConfiguration struct {
|
|||
dnsforward.TLSConfig `yaml:",inline" json:",inline"`
|
||||
}
|
||||
|
||||
// partialClone returns a clone of c with all top-level fields of c and all
|
||||
// cloneForEncoding returns a clone of c with all top-level fields of c and all
|
||||
// exported and YAML-encoded fields of c.TLSConfig cloned.
|
||||
//
|
||||
// TODO(a.garipov): This is better than races, but still not good enough.
|
||||
func (c *tlsConfiguration) partialClone() (cloned *tlsConfiguration) {
|
||||
func (c *tlsConfiguration) cloneForEncoding() (cloned *tlsConfiguration) {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
v := *c
|
||||
cloned = &v
|
||||
cloned.OverrideTLSCiphers = slices.Clone(c.OverrideTLSCiphers)
|
||||
cloned.TLSConfig = dnsforward.TLSConfig{
|
||||
CertificateChain: c.CertificateChain,
|
||||
PrivateKey: c.PrivateKey,
|
||||
CertificatePath: c.CertificatePath,
|
||||
PrivateKeyPath: c.PrivateKeyPath,
|
||||
OverrideTLSCiphers: slices.Clone(c.OverrideTLSCiphers),
|
||||
StrictSNICheck: c.StrictSNICheck,
|
||||
}
|
||||
|
||||
return cloned
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue