From 3e0faecaaebd8394a1a9d18ec11b5a60f210b654 Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Tue, 18 Apr 2023 21:34:06 +0330 Subject: improve reality setting split xtls from tls - remove iran warp - remove old setting reality from franzkafka (it was a messy code) -and other improvement Co-Authored-By: Alireza Ahmadi --- web/service/server.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'web/service/server.go') diff --git a/web/service/server.go b/web/service/server.go index c73fce57..f2540252 100644 --- a/web/service/server.go +++ b/web/service/server.go @@ -390,3 +390,29 @@ func (s *ServerService) GetDb() ([]byte, error) { return fileContents, nil } + +func (s *ServerService) GetNewX25519Cert() (interface{}, error) { + // Run the command + cmd := exec.Command(xray.GetBinaryPath(), "x25519") + var out bytes.Buffer + cmd.Stdout = &out + err := cmd.Run() + if err != nil { + return nil, err + } + + lines := strings.Split(out.String(), "\n") + + privateKeyLine := strings.Split(lines[0], ":") + publicKeyLine := strings.Split(lines[1], ":") + + privateKey := strings.TrimSpace(privateKeyLine[1]) + publicKey := strings.TrimSpace(publicKeyLine[1]) + + keyPair := map[string]interface{}{ + "privateKey": privateKey, + "publicKey": publicKey, + } + + return keyPair, nil +} -- cgit v1.2.3