mirror of
https://github.com/apernet/hysteria.git
synced 2025-04-02 03:57:38 +03:00
fix: crash when the tls option is not used & change from python3 to python
This commit is contained in:
parent
667b08ec3e
commit
4ed3f21d72
2 changed files with 14 additions and 14 deletions
|
@ -291,19 +291,19 @@ func (c *serverConfig) fillTLSConfig(hyConfig *server.Config) error {
|
|||
if c.TLS != nil && c.ACME != nil {
|
||||
return configError{Field: "tls", Err: errors.New("cannot set both tls and acme")}
|
||||
}
|
||||
// SNI guard
|
||||
var sniGuard utils.SNIGuardFunc
|
||||
switch strings.ToLower(c.TLS.SNIGuard) {
|
||||
case "", "dns-san":
|
||||
sniGuard = utils.SNIGuardDNSSAN
|
||||
case "strict":
|
||||
sniGuard = utils.SNIGuardStrict
|
||||
case "disable":
|
||||
sniGuard = nil
|
||||
default:
|
||||
return configError{Field: "tls.sniGuard", Err: errors.New("unsupported SNI guard")}
|
||||
}
|
||||
if c.TLS != nil {
|
||||
// SNI guard
|
||||
var sniGuard utils.SNIGuardFunc
|
||||
switch strings.ToLower(c.TLS.SNIGuard) {
|
||||
case "", "dns-san":
|
||||
sniGuard = utils.SNIGuardDNSSAN
|
||||
case "strict":
|
||||
sniGuard = utils.SNIGuardStrict
|
||||
case "disable":
|
||||
sniGuard = nil
|
||||
default:
|
||||
return configError{Field: "tls.sniGuard", Err: errors.New("unsupported SNI guard")}
|
||||
}
|
||||
// Local TLS cert
|
||||
if c.TLS.Cert == "" || c.TLS.Key == "" {
|
||||
return configError{Field: "tls", Err: errors.New("empty cert or key path")}
|
||||
|
|
|
@ -111,7 +111,7 @@ func generateTestCertificate(dnssan []string, certType string) error {
|
|||
if len(dnssan) > 0 {
|
||||
args = append(args, "--dnssan", strings.Join(dnssan, ","))
|
||||
}
|
||||
cmd := exec.Command("python3", args...)
|
||||
cmd := exec.Command("python", args...)
|
||||
out, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
log.Printf("Failed to generate test certificate: %s", out)
|
||||
|
@ -129,7 +129,7 @@ func runTestTLSClient(sni string) error {
|
|||
if sni != "" {
|
||||
args = append(args, "--sni", sni)
|
||||
}
|
||||
cmd := exec.Command("python3", args...)
|
||||
cmd := exec.Command("python", args...)
|
||||
out, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
log.Printf("Failed to run test TLS client: %s", out)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue