initial support for hysteria
update config
update api
change user email format
...
This commit is contained in:
yuzuki999
2023-06-08 22:46:33 +08:00
parent 52f9734278
commit 42bb7bc90f
30 changed files with 809 additions and 983 deletions

31
node/cert.go Normal file
View File

@@ -0,0 +1,31 @@
package node
import (
"fmt"
"github.com/Yuzuki616/V2bX/common/file"
"github.com/Yuzuki616/V2bX/node/lego"
)
func (c *Controller) requestCert() error {
if c.CertConfig.CertFile == "" || c.CertConfig.KeyFile == "" {
return fmt.Errorf("cert file path or key file path not exist")
}
switch c.CertConfig.CertMode {
case "reality", "none", "":
return nil
case "dns", "http":
if file.IsExist(c.CertConfig.CertFile) && file.IsExist(c.CertConfig.KeyFile) {
return nil
}
l, err := lego.New(c.CertConfig)
if err != nil {
return fmt.Errorf("create lego object error: %s", err)
}
err = l.CreateCert()
if err != nil {
return fmt.Errorf("create cert error: %s", err)
}
return nil
}
return fmt.Errorf("unsupported certmode: %s", c.CertConfig.CertMode)
}