Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions .github/build/friendly-filenames.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{
"android-arm64": { "friendlyName": "android-arm64-v8a" },
"android-amd64": { "friendlyName": "android-amd64" },
"darwin-amd64": { "friendlyName": "macos-64" },
"darwin-arm64": { "friendlyName": "macos-arm64-v8a" },
"freebsd-386": { "friendlyName": "freebsd-32" },
"freebsd-amd64": { "friendlyName": "freebsd-64" },
"freebsd-arm64": { "friendlyName": "freebsd-arm64-v8a" },
"freebsd-arm7": { "friendlyName": "freebsd-arm32-v7a" },
"linux-386": { "friendlyName": "linux-32" },
"linux-amd64": { "friendlyName": "linux-64" },
"linux-arm5": { "friendlyName": "linux-arm32-v5" },
Expand All @@ -14,19 +13,15 @@
"linux-arm7": { "friendlyName": "linux-arm32-v7a" },
"linux-mips64le": { "friendlyName": "linux-mips64le" },
"linux-mips64": { "friendlyName": "linux-mips64" },
"linux-mipslesoftfloat": { "friendlyName": "linux-mips32le-softfloat" },
"linux-mipsle": { "friendlyName": "linux-mips32le" },
"linux-mipssoftfloat": { "friendlyName": "linux-mips32-softfloat" },
"linux-mips": { "friendlyName": "linux-mips32" },
"linux-ppc64le": { "friendlyName": "linux-ppc64le" },
"linux-ppc64": { "friendlyName": "linux-ppc64" },
"linux-riscv64": { "friendlyName": "linux-riscv64" },
"linux-loong64": { "friendlyName": "linux-loong64" },
"linux-s390x": { "friendlyName": "linux-s390x" },
"openbsd-386": { "friendlyName": "openbsd-32" },
"openbsd-amd64": { "friendlyName": "openbsd-64" },
"openbsd-arm64": { "friendlyName": "openbsd-arm64-v8a" },
"openbsd-arm7": { "friendlyName": "openbsd-arm32-v7a" },
"windows-386": { "friendlyName": "windows-32" },
"windows-amd64": { "friendlyName": "windows-64" },
"windows-arm64": { "friendlyName": "windows-arm64-v8a" }
Expand Down
76 changes: 76 additions & 0 deletions .github/workflows/extended-nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Extended or Back-seated Nightly Build
# Secondary builds are built here.
# Failing maybe not meaning a blocking. This is a judgement call.

on:
workflow_dispatch:
push:
pull_request:
types: [opened, synchronize, reopened]

jobs:
build:
permissions:
contents: write
strategy:
matrix:
include:
- goos: openbsd
goarch: amd64
assetname: openbsd-64
- goos: openbsd
goarch: arm64
assetname: openbsd-arm64-v8a
fail-fast: false

runs-on: ubuntu-latest
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: 0
steps:
- name: Checkout codebase
uses: actions/checkout@v6

- name: Show workflow information
run: |
_NAME=${{ matrix.assetname }}
echo "GOOS: $GOOS, GOARCH: $GOARCH, RELEASE_NAME: $_NAME"
echo "ASSET_NAME=$_NAME" >> $GITHUB_ENV

- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
check-latest: true

- name: Get project dependencies
run: go mod download

- name: Build Xray
run: |
if [[ ${GOARCH} == 'arm' ]]; then
GOARM="7"
fi
# Building
mkdir -p build_assets
COMMID=$(git describe --always --dirty)
if [[ ${GOOS} == 'windows' ]]; then
echo 'Building Xray for Windows...'
go build -o build_assets/xray.exe -trimpath -buildvcs=false -ldflags="-X github.com/xtls/xray-core/core.build=${COMMID} -s -w -buildid=" -v ./main
else
echo 'Building Xray...'
go build -o build_assets/xray -trimpath -buildvcs=false -ldflags="-X github.com/xtls/xray-core/core.build=${COMMID} -s -w -buildid=" -v ./main
fi

- name: Copy README.md & LICENSE
run: |
cp ${GITHUB_WORKSPACE}/README.md ./build_assets/README.md
cp ${GITHUB_WORKSPACE}/LICENSE ./build_assets/LICENSE

- name: Upload files to Artifacts
uses: actions/upload-artifact@v7
with:
name: Xray-${{ env.ASSET_NAME }}
path: |
./build_assets/*
3 changes: 3 additions & 0 deletions .github/workflows/release-win7.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
name: Build and Release for Windows 7
# The furthest build might happen in August 2028 before a newer monor version of Go 1 releases.
# The furthest build must before Go 2 releases.
# Multiple factors may affect this procedure.

on:
workflow_dispatch:
Expand Down
121 changes: 62 additions & 59 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,86 +78,66 @@ jobs:
contents: write
strategy:
matrix:
# Include amd64 on all platforms.
goos: [windows, freebsd, openbsd, linux, darwin]
goarch: [amd64, 386]
# Include x86-64 and ARM64 on all platforms.
goos: [windows, freebsd, linux, darwin, android]
goarch: [amd64, arm64]
patch-assetname: [""]
exclude:
# Exclude i386 on darwin
- goarch: 386
goos: darwin
# Building for OpenBSD has been suspended unless there are active
# contributors that uses OpenBSD actively.
# PRs for OpenBSD compatibility are welcome.
# Building for BSDs will be add back when there is active maintenance.
include:
# BEGIN MacOS ARM64
- goos: darwin
goarch: arm64
# END MacOS ARM64
# BEGIN Linux ARM 5 6 7
# BEGIN RISCV & LoongArch
- goos: linux
goarch: arm
goarm: 7
goarch: riscv64
- goos: linux
goarch: arm
goarm: 6
goarch: loong64
# END RISCV & LoongArch
# BEGIN PPC
- goos: linux
goarch: arm
goarm: 5
# END Linux ARM 5 6 7
# BEGIN Android ARM 8
- goos: android
goarch: arm64
# END Android ARM 8
# BEGIN Android AMD64
- goos: android
goarch: amd64
patch-assetname: android-amd64
# END Android AMD64
# Windows ARM
- goos: windows
goarch: arm64
# BEGIN Other architectures
# BEGIN riscv64 & ARM64 & LOONG64
goarch: ppc64
- goos: linux
goarch: arm64
goarch: ppc64le
# END PPC
# BEGIN S390X
- goos: linux
goarch: riscv64
goarch: s390x
# END S390X
# BEGIN x86
# Removing x86 32-bit on Linux will depending on upstream.
- goos: linux
goarch: loong64
# END riscv64 & ARM64 & LOONG64
goarch: 386
# Back-seating x86 32-bit on Windows (not win7) will be in v27.
- goos: windows
goarch: 386
# END x86
# BEGIN MIPS
# MIPS64 BE/LE will be removed in v27
- goos: linux
goarch: mips64
- goos: linux
goarch: mips64le
# MIPS32 BE/LE will be back-seated in v27.
# This is a long tail architecture due to router productions.
- goos: linux
goarch: mipsle
- goos: linux
goarch: mips
# END MIPS
# BEGIN PPC
# BEGIN Linux ARM
# ARMv7 is a long tail
- goos: linux
goarch: ppc64
- goos: linux
goarch: ppc64le
# END PPC
# BEGIN FreeBSD ARM
- goos: freebsd
goarch: arm64
- goos: freebsd
goarch: arm
goarm: 7
# END FreeBSD ARM
# BEGIN S390X
# ARMv6 will be removed in v27
- goos: linux
goarch: s390x
# END S390X
# END Other architectures
# BEGIN OPENBSD ARM
- goos: openbsd
goarch: arm64
- goos: openbsd
goarch: arm
goarm: 7
# END OPENBSD ARM
goarm: 6
# ARMv5 will be removed in v27
- goos: linux
goarch: arm
goarm: 5
# END Linux ARM
fail-fast: false

runs-on: ubuntu-latest
Expand Down Expand Up @@ -186,8 +166,8 @@ jobs:
- name: Show workflow information
run: |
_NAME=${{ matrix.patch-assetname }}
[ -n "$_NAME" ] || _NAME=$(jq ".[\"$GOOS-$GOARCH$GOARM$GOMIPS\"].friendlyName" -r < .github/build/friendly-filenames.json)
echo "GOOS: $GOOS, GOARCH: $GOARCH, GOARM: $GOARM, GOMIPS: $GOMIPS, RELEASE_NAME: $_NAME"
[ -n "$_NAME" ] || _NAME=$(jq ".[\"$GOOS-$GOARCH$GOARM\"].friendlyName" -r < .github/build/friendly-filenames.json)
echo "GOOS: $GOOS, GOARCH: $GOARCH, RELEASE_NAME: $_NAME"
echo "ASSET_NAME=$_NAME" >> $GITHUB_ENV

- name: Set up Go
Expand All @@ -201,6 +181,29 @@ jobs:

- name: Build Xray
run: |
# Special processing for ARM64
if [[ ${GOARCH} == 'arm64' ]]; then
if [[ ${GOOS} == 'darwin' ]]; then
GOARM64="v8.4"
fi
if [[ ${GOOS} == 'windows' ]]; then
GOARM64="v8.2"
fi
fi
# Special processing for x86-64
if [[ ${GOARCH} == 'amd64' ]]; then
if [[ ${GOOS} == 'darwin' ]]; then
GOAMD64="v3"
fi
if [[ ${GOOS} == 'windows' ]]; then
GOAMD64="v2"
fi
fi
# Special processing for 32-bit ARM
if [[ ${GOARCH} == 'arm' ]] && [[ ${GOOS} != 'linux' ]]; then
GOARM="7"
fi
# Building
mkdir -p build_assets
COMMID=$(git describe --always --dirty)
if [[ ${GOOS} == 'windows' ]]; then
Expand Down
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,30 @@ Make sure that you are using the same Go version, and remember to set the git co
CGO_ENABLED=0 go build -o xray -trimpath -buildvcs=false -gcflags="all=-l=4" -ldflags="-X github.com/xtls/xray-core/core.build=REPLACE -s -w -buildid=" -v ./main
```

If you are compiling a Windows x86-64 target, add this environment variable before compiling:

```
GOAMD64=v2
```

If you are compiling a macOS x86-64 target, add this environment variable before compiling:

```
GOAMD64=v3
```

If you are compiling a Windows ARM64 target, add this environment variable before compiling:

```
GOARM64=v8.2
```

If you are compiling a macOS ARM64 target, add this environment variable before compiling:

```
GOARM64=v8.4
```

If you are compiling a 32-bit MIPS/MIPSLE target, use this command instead:

```bash
Expand Down
4 changes: 2 additions & 2 deletions common/buf/readv_posix.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build !windows && !wasm && !illumos && !openbsd
// +build !windows,!wasm,!illumos,!openbsd
//go:build !windows && !openbsd
// +build !windows,!openbsd

package buf

Expand Down
4 changes: 2 additions & 2 deletions common/buf/readv_reader.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build !wasm && !openbsd
// +build !wasm,!openbsd
//go:build !openbsd
// +build !openbsd

package buf

Expand Down
4 changes: 2 additions & 2 deletions common/buf/readv_reader_stub.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build wasm || openbsd
// +build wasm openbsd
//go:build openbsd
// +build openbsd

package buf

Expand Down
4 changes: 2 additions & 2 deletions common/buf/readv_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build !wasm && !openbsd
// +build !wasm,!openbsd
//go:build !openbsd
// +build !openbsd

package buf_test

Expand Down
37 changes: 0 additions & 37 deletions common/buf/readv_unix.go

This file was deleted.

4 changes: 2 additions & 2 deletions transport/internet/sockopt_other.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build js || netbsd || openbsd || solaris
// +build js netbsd openbsd solaris
//go:build !windows && !darwin && !linux && !android && !freebsd
// +build !windows,!darwin,!linux,!android,!freebsd

package internet

Expand Down