Xray-core
Xray-core copied to clipboard
修改代码后怎么编译
修改代码后怎么编译
https://github.com/chika0801/Xray-install/blob/main/compile_Xray-core.md
To prepare the environment, follow these steps:
- Download and install Go:
curl -sLo go.tar.gz https://go.dev/dl/$(curl -sL https://golang.org/VERSION?m=text|head -1).linux-amd64.tar.gz
rm -rf /usr/local/go
tar -C /usr/local/ -xzf go.tar.gz
rm go.tar.gz
echo -e "export PATH=$PATH:/usr/local/go/bin" > /etc/profile.d/go.sh
source /etc/profile.d/go.sh
go version
- Install Git:
apt install -y git
To download the code, run the following command:
git clone https://github.com/XTLS/Xray-core.git
To update the code, use the following commands:
cd Xray-core
git pull
cd ..
For compilation, use the following commands:
For Linux AMD64:
cd Xray-core
go mod download
go env -w CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GOAMD64=v2
go build -v -o xray -trimpath -ldflags "-s -w -buildid=" ./main
cd ..
For Windows AMD64:
cd Xray-core
go mod download
go env -w CGO_ENABLED=0 GOOS=windows GOARCH=amd64 GOAMD64=v3
go build -v -o xray.exe -trimpath -ldflags "-s -w -buildid=" ./main
cd ..
After compilation, copy the files to the desired location:
For Linux AMD64:
cp -f Xray-core/xray /usr/local/bin/
chmod +x /usr/local/bin/xray
For Windows AMD64:
cp -f Xray-core/xray.exe .
Make sure to give appropriate permissions to the executable files.
For Linux AMD64, use the following command to give executable permission to the xray
file:
chmod +x /usr/local/bin/xray
这种问题都来发issues...
这种问题都来发issues...
不会嘛。没接触过go
@liukeqqs go编译都不知道然后修改代码。。。 然后重复一般 issues区是反馈软件问题的不是发这种东西的
@liukeqqs go编译都不知道然后修改代码。。。 然后重复一般 issues区是反馈软件问题的不是发这种东西的
好的呢。
Answered