because of #815 now we can use XTLS/Xray-core

change MHSanaei/Xray-core to XTLS/Xray-core
This commit is contained in:
MHSanaei 2023-07-27 11:06:27 +03:30
parent 09807b39aa
commit c2b1fb4855
4 changed files with 13 additions and 21 deletions

View file

@ -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

View file

@ -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}"

View file

@ -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 {
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
}

View file

@ -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()