Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSanaei <ho3ein.sanaei@gmail.com>2025-08-04 17:27:57 +0300
committerGitHub <noreply@github.com>2025-08-04 17:27:57 +0300
commite4ba5ba53a27ee256364e7031df3d43afb3b3fe6 (patch)
tree994de962ab65539acbc7f9802b07fa5c111795fd /web/service
parent6ff555c8bb7abf2d528363b4937757424a0ae527 (diff)
add ech support (#3310)
Co-authored-by: Alireza Ahmadi <alireza7@gmail.com>
Diffstat (limited to 'web/service')
-rw-r--r--web/service/server.go24
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
+}