From 90c6c277434d1d7ff171e532fbdd9e89859f22f2 Mon Sep 17 00:00:00 2001 From: Garfield Freeman Date: Fri, 19 Nov 2021 10:10:26 -0800 Subject: [PATCH] chore(Device.SslDecrypt): Use util.Copy() --- dev/ssldecrypt/config.go | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/dev/ssldecrypt/config.go b/dev/ssldecrypt/config.go index 596607a9..70fc821f 100644 --- a/dev/ssldecrypt/config.go +++ b/dev/ssldecrypt/config.go @@ -34,24 +34,9 @@ func (o *Config) Copy(s Config) { o.ForwardTrustCertificateEcdsa = s.ForwardTrustCertificateEcdsa o.ForwardUntrustCertificateRsa = s.ForwardUntrustCertificateRsa o.ForwardUntrustCertificateEcdsa = s.ForwardUntrustCertificateEcdsa - if s.RootCaExcludes == nil { - o.RootCaExcludes = nil - } else { - o.RootCaExcludes = make([]string, 0, len(s.RootCaExcludes)) - copy(o.RootCaExcludes, s.RootCaExcludes) - } - if s.TrustedRootCas == nil { - o.TrustedRootCas = nil - } else { - o.TrustedRootCas = make([]string, 0, len(s.TrustedRootCas)) - copy(o.TrustedRootCas, s.TrustedRootCas) - } - if s.DisabledPredefinedExcludeCertificates == nil { - o.DisabledPredefinedExcludeCertificates = nil - } else { - o.DisabledPredefinedExcludeCertificates = make([]string, 0, len(s.DisabledPredefinedExcludeCertificates)) - copy(o.DisabledPredefinedExcludeCertificates, s.DisabledPredefinedExcludeCertificates) - } + o.RootCaExcludes = util.CopyStringSlice(s.RootCaExcludes) + o.TrustedRootCas = util.CopyStringSlice(s.TrustedRootCas) + o.DisabledPredefinedExcludeCertificates = util.CopyStringSlice(s.DisabledPredefinedExcludeCertificates) if s.SslDecryptExcludeCertificates == nil { o.SslDecryptExcludeCertificates = nil } else {