fix: windows build

This commit is contained in:
hiddify
2024-09-29 10:46:12 +02:00
parent 704e4d2d09
commit 14f3bc2fe2

View File

@@ -16,7 +16,16 @@ import (
"time"
)
func GenerateCertificate(certPath, keyPath string, isServer bool) {
func fileExists(path string) bool {
_, err := os.Stat(path)
return !os.IsNotExist(err) // returns true if the file exists
}
func GenerateCertificate(certPath, keyPath string, isServer bool, skipIfExist bool) {
if skipIfExist && fileExists(certPath) && fileExists(keyPath) {
return
}
priv, err := ecdsa.GenerateKey(elliptic.P384(), rand.Reader)
if err != nil {
panic(err)