Skip to content

Commit

Permalink
because of #815 now we can use XTLS/Xray-core
Browse files Browse the repository at this point in the history
change MHSanaei/Xray-core to XTLS/Xray-core
  • Loading branch information
MHSanaei committed Jul 27, 2023
1 parent 09807b3 commit c2b1fb4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 21 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion DockerInit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
17 changes: 9 additions & 8 deletions web/service/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -417,6 +417,7 @@ func (s *ServerService) GetConfigJson() (interface{}, error) {
if err != nil {
return nil, err
}

return jsonData, nil
}

Expand Down
11 changes: 1 addition & 10 deletions xray/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down Expand Up @@ -88,7 +80,6 @@ func stopProcess(p *Process) {
p.Stop()
}


type Process struct {
*process
}
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit c2b1fb4

Please sign in to comment.