MCPcopy
hub / github.com/etcd-io/etcd / copyTLSFiles

Function copyTLSFiles

tests/integration/util_test.go:26–43  ·  view source on GitHub ↗

copyTLSFiles clones certs files to dst directory.

(ti transport.TLSInfo, dst string)

Source from the content-addressed store, hash-verified

24
25// copyTLSFiles clones certs files to dst directory.
26func copyTLSFiles(ti transport.TLSInfo, dst string) (transport.TLSInfo, error) {
27 ci := transport.TLSInfo{
28 KeyFile: filepath.Join(dst, "server-key.pem"),
29 CertFile: filepath.Join(dst, "server.pem"),
30 TrustedCAFile: filepath.Join(dst, "etcd-root-ca.pem"),
31 ClientCertAuth: ti.ClientCertAuth,
32 }
33 if err := copyFile(ti.KeyFile, ci.KeyFile); err != nil {
34 return transport.TLSInfo{}, err
35 }
36 if err := copyFile(ti.CertFile, ci.CertFile); err != nil {
37 return transport.TLSInfo{}, err
38 }
39 if err := copyFile(ti.TrustedCAFile, ci.TrustedCAFile); err != nil {
40 return transport.TLSInfo{}, err
41 }
42 return ci, nil
43}
44
45func copyFile(src, dst string) error {
46 f, err := os.Open(src)

Callers 3

TestTLSReloadCopyFunction · 0.85
TestTLSReloadCopyIPOnlyFunction · 0.85

Calls 1

copyFileFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…