diff options
| author | Sanaei <ho3ein.sanaei@gmail.com> | 2025-08-04 17:27:57 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-04 17:27:57 +0300 |
| commit | e4ba5ba53a27ee256364e7031df3d43afb3b3fe6 (patch) | |
| tree | 994de962ab65539acbc7f9802b07fa5c111795fd /web/service | |
| parent | 6ff555c8bb7abf2d528363b4937757424a0ae527 (diff) | |
add ech support (#3310)
Co-authored-by: Alireza Ahmadi <alireza7@gmail.com>
Diffstat (limited to 'web/service')
| -rw-r--r-- | web/service/server.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/web/service/server.go b/web/service/server.go index e75a97b8..f0be46c2 100644 --- a/web/service/server.go +++ b/web/service/server.go @@ -743,3 +743,27 @@ func (s *ServerService) GetNewmldsa65() (any, error) { return keyPair, nil } + +func (s *ServerService) GetNewEchCert(sni string) (interface{}, error) { + // Run the command + cmd := exec.Command(xray.GetBinaryPath(), "tls", "ech", "--serverName", sni) + var out bytes.Buffer + cmd.Stdout = &out + err := cmd.Run() + if err != nil { + return nil, err + } + + lines := strings.Split(out.String(), "\n") + if len(lines) < 4 { + return nil, common.NewError("invalid ech cert") + } + + configList := lines[1] + serverKeys := lines[3] + + return map[string]interface{}{ + "echServerKeys": serverKeys, + "echConfigList": configList, + }, nil +} |
