diff options
| author | MHSanaei <ho3ein.sanaei@gmail.com> | 2023-07-27 10:36:27 +0300 |
|---|---|---|
| committer | MHSanaei <ho3ein.sanaei@gmail.com> | 2023-07-27 10:36:27 +0300 |
| commit | c2b1fb485534ad1c0be5a3ba65761751526d29e5 (patch) | |
| tree | ad4f3291262d06d459e932430d8ad1b0b08a7c5e | |
| parent | 09807b39aa971ce2f4ea3fc84a4e54766d08fefd (diff) | |
because of #815 now we can use XTLS/Xray-core
change MHSanaei/Xray-core to XTLS/Xray-core
| -rw-r--r-- | .github/workflows/release.yml | 4 | ||||
| -rwxr-xr-x | DockerInit.sh | 2 | ||||
| -rw-r--r-- | web/service/server.go | 17 | ||||
| -rw-r--r-- | xray/process.go | 11 |
4 files changed, 13 insertions, 21 deletions
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7d9c288f..27b72263 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -47,11 +47,11 @@ jobs: # Download dependencies if [ "${{ matrix.platform }}" == "amd64" ]; then - wget https://github.com/mhsanaei/Xray-core/releases/latest/download/Xray-linux-64.zip + wget https://github.com/XTLS/Xray-core/releases/download/v1.8.1/Xray-linux-64.zip unzip Xray-linux-64.zip rm -f Xray-linux-64.zip else - wget https://github.com/mhsanaei/Xray-core/releases/latest/download/Xray-linux-arm64-v8a.zip + wget https://github.com/XTLS/Xray-core/releases/download/v1.8.1/Xray-linux-arm64-v8a.zip unzip Xray-linux-arm64-v8a.zip rm -f Xray-linux-arm64-v8a.zip fi diff --git a/DockerInit.sh b/DockerInit.sh index d1a5e40a..17bce0c2 100755 --- a/DockerInit.sh +++ b/DockerInit.sh @@ -18,7 +18,7 @@ esac mkdir -p build/bin cd build/bin -wget "https://github.com/mhsanaei/xray-core/releases/latest/download/Xray-linux-${ARCH}.zip" +wget "https://github.com/XTLS/Xray-core/releases/download/v1.8.1/Xray-linux-${ARCH}.zip" unzip "Xray-linux-${ARCH}.zip" rm -f "Xray-linux-${ARCH}.zip" geoip.dat geosite.dat iran.dat mv xray "xray-linux-${FNAME}" diff --git a/web/service/server.go b/web/service/server.go index c5f4e264..3de5f3ff 100644 --- a/web/service/server.go +++ b/web/service/server.go @@ -224,7 +224,7 @@ func (s *ServerService) GetStatus(lastStatus *Status) *Status { } func (s *ServerService) GetXrayVersions() ([]string, error) { - url := "https://api.github.com/repos/MHSanaei/Xray-core/releases" + url := "https://api.github.com/repos/XTLS/Xray-core/releases" resp, err := http.Get(url) if err != nil { return nil, err @@ -243,14 +243,17 @@ func (s *ServerService) GetXrayVersions() ([]string, error) { if err != nil { return nil, err } - versions := make([]string, 0, len(releases)) + var versions []string for _, release := range releases { - versions = append(versions, release.TagName) + if release.TagName >= "v1.7.5" { + versions = append(versions, release.TagName) + } } return versions, nil } func (s *ServerService) StopXrayService() (string error) { + err := s.xrayService.StopXray() if err != nil { logger.Error("stop xray failed:", err) @@ -261,6 +264,7 @@ func (s *ServerService) StopXrayService() (string error) { } func (s *ServerService) RestartXrayService() (string error) { + s.xrayService.StopXray() defer func() { err := s.xrayService.RestartXray(true) @@ -289,7 +293,7 @@ func (s *ServerService) downloadXRay(version string) (string, error) { } fileName := fmt.Sprintf("Xray-%s-%s.zip", osName, arch) - url := fmt.Sprintf("https://github.com/MHSanaei/Xray-core/releases/download/%s/%s", version, fileName) + url := fmt.Sprintf("https://github.com/XTLS/Xray-core/releases/download/%s/%s", version, fileName) resp, err := http.Get(url) if err != nil { return "", err @@ -370,10 +374,6 @@ func (s *ServerService) UpdateXray(version string) error { if err != nil { return err } - err = copyZipFile("iran.dat", xray.GetIranPath()) - if err != nil { - return err - } return nil } @@ -417,6 +417,7 @@ func (s *ServerService) GetConfigJson() (interface{}, error) { if err != nil { return nil, err } + return jsonData, nil } diff --git a/xray/process.go b/xray/process.go index 0882c716..9bccffd9 100644 --- a/xray/process.go +++ b/xray/process.go @@ -40,14 +40,6 @@ func GetGeoipPath() string { return config.GetBinFolderPath() + "/geoip.dat" } -func GetIranPath() string { - return config.GetBinFolderPath() + "/iran.dat" -} - -func GetBlockedIPsPath() string { - return config.GetBinFolderPath() + "/BlockedIps" -} - func GetIPLimitLogPath() string { return config.GetLogFolder() + "/3xipl.log" } @@ -88,7 +80,6 @@ func stopProcess(p *Process) { p.Stop() } - type Process struct { *process } @@ -203,7 +194,7 @@ func (p *process) Start() (err error) { return common.NewErrorf("Failed to write configuration file: %v", err) } - cmd := exec.Command(GetBinaryPath(), "-c", configPath, "-restrictedIPsPath", GetBlockedIPsPath()) + cmd := exec.Command(GetBinaryPath(), "-c", configPath) p.cmd = cmd stdReader, err := cmd.StdoutPipe() |
