Files
FireflyGo_Proxy/cert.go
AzenKain 9d769ed08c
Some checks failed
Build and Release / release (push) Failing after 26s
init
2025-12-12 17:37:34 +07:00

30 lines
546 B
Go

package main
import (
"crypto/tls"
"os"
"path/filepath"
"github.com/elazarl/goproxy"
)
const caCertName = "firefly-go-proxy-ca.crt"
func setupCertificate() (*tls.Certificate, error) {
if _, err := os.Stat(caCertName); os.IsNotExist(err) {
if err := os.WriteFile(caCertName, goproxy.GoproxyCa.Certificate[0], 0644); err != nil {
return nil, err
}
}
absPath, err := filepath.Abs(caCertName)
if err != nil {
return nil, err
}
if err := installCA(absPath); err != nil {
return nil, err
}
return &goproxy.GoproxyCa, nil
}