Skip to content

Commit

Permalink
fix: loading cert files
Browse files Browse the repository at this point in the history
  • Loading branch information
WendelHime committed Oct 28, 2024
1 parent 353da30 commit 364eb53
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion http_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 364eb53

Please sign in to comment.