From 364eb53f3c8dd2c2bed31acd5ba34244aab4d470 Mon Sep 17 00:00:00 2001 From: WendelHime <6754291+WendelHime@users.noreply.github.com> Date: Mon, 28 Oct 2024 17:19:36 -0300 Subject: [PATCH] fix: loading cert files --- http_proxy.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/http_proxy.go b/http_proxy.go index 474e0e70..8e7903d8 100644 --- a/http_proxy.go +++ b/http_proxy.go @@ -1029,7 +1029,16 @@ func (p *Proxy) listenWATER(addr string) (net.Listener, error) { log.Debugf("Listening for water at %v", waterListener.Addr()) return waterListener, nil case "PROTOCOL_UTLS": - cert, err := utls.X509KeyPair([]byte(p.CertFile), []byte(p.KeyFile)) + certPEM, err := os.ReadFile(p.CertFile) + if err != nil { + log.Fatalf("Unable to read certificate file: %v", err) + } + + keyPEM, err := os.ReadFile(p.KeyFile) + if err != nil { + log.Fatalf("Unable to read key file: %v", err) + } + cert, err := utls.X509KeyPair([]byte(certPEM), []byte(keyPEM)) if err != nil { return nil, log.Errorf("failed to load cert: %w", err) }