Compare commits

..

2 Commits

Author SHA1 Message Date
风扇滑翔翼
600ee0ed1a Add prefix match 2024-07-06 06:12:12 +00:00
风扇滑翔翼
4bec9ab845 Add H2 path support for fallback 2024-07-04 19:59:18 +00:00
181 changed files with 1823 additions and 3796 deletions

View File

@@ -13,14 +13,16 @@ body:
required: true required: true
- label: I searched issues and did not find any similar issues. - label: I searched issues and did not find any similar issues.
required: true required: true
- label: The problem can be successfully reproduced in the latest Release - type: input
attributes:
label: Version
description: Version of Xray-core
validations:
required: true required: true
- type: textarea - type: textarea
attributes: attributes:
label: Description label: Description
description: |- description: Please provide a detailed description of the error. And the information you think valuable.
Please provide a detailed description of the error. And the information you think valuable.
If the problem occurs after the update, please provide the **specific** version
validations: validations:
required: true required: true
- type: textarea - type: textarea

View File

@@ -11,16 +11,18 @@ body:
required: true required: true
- label: 我提供了完整的配置文件和日志,而不是出于自己的判断只给出截取的部分。 - label: 我提供了完整的配置文件和日志,而不是出于自己的判断只给出截取的部分。
required: true required: true
- label: 我搜索了 issues, 没有发现已提出的类似问题。 - label: 我搜索了issues没有发现已提出的类似问题。
required: true required: true
- label: 问题在 Release 最新的版本上可以成功复现 - type: input
attributes:
label: 版本
description: 使用的Xray-core版本
validations:
required: true required: true
- type: textarea - type: textarea
attributes: attributes:
label: 描述 label: 描述
description: |- description: 请提供错误的详细描述。以及你认为有价值的信息。
请提供错误的详细描述。以及你认为有价值的信息。
如果问题在更新后出现,请提供**具体**出现问题的版本号。
validations: validations:
required: true required: true
- type: textarea - type: textarea

View File

@@ -1,4 +0,0 @@
contact_links:
- name: Community Support and Questions
url: https://github.com/XTLS/Xray-core/discussions
about: Please ask and answer questions there. The issue tracker is for issues with core.

View File

@@ -2,27 +2,21 @@
FROM --platform=$BUILDPLATFORM golang:alpine AS build FROM --platform=$BUILDPLATFORM golang:alpine AS build
WORKDIR /src WORKDIR /src
COPY . . COPY . .
ARG TARGETOS ARG TARGETOS TARGETARCH
ARG TARGETARCH
RUN GOOS=$TARGETOS GOARCH=$TARGETARCH CGO_ENABLED=0 go build -o xray -trimpath -ldflags "-s -w -buildid=" ./main RUN GOOS=$TARGETOS GOARCH=$TARGETARCH CGO_ENABLED=0 go build -o xray -trimpath -ldflags "-s -w -buildid=" ./main
ADD https://github.com/v2fly/geoip/releases/latest/download/geoip.dat /v2fly/geoip.dat
ADD https://github.com/v2fly/domain-list-community/releases/latest/download/dlc.dat /v2fly/geosite.dat
ADD https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat /loyalsoldier/geoip.dat
ADD https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat /loyalsoldier/geosite.dat
# chainguard/static contains only tzdata and ca-certificates, can be built with multiarch static binaries. FROM --platform=${TARGETPLATFORM} alpine:latest
FROM --platform=linux/amd64 chainguard/static:latest
WORKDIR /var/log/xray
COPY .github/docker/files/config.json /etc/xray/config.json
COPY --from=build --chmod=755 /src/xray /usr/bin/xray
USER root
WORKDIR /root WORKDIR /root
COPY .github/docker/files/config.json /etc/xray/config.json
COPY --from=build /src/xray /usr/bin/xray
RUN set -ex \
&& apk add --no-cache tzdata ca-certificates \
&& mkdir -p /var/log/xray /usr/share/xray \
&& chmod +x /usr/bin/xray \
&& wget -O /usr/share/xray/geosite.dat https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat \
&& wget -O /usr/share/xray/geoip.dat https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat
VOLUME /etc/xray VOLUME /etc/xray
ARG TZ=Asia/Shanghai ENV TZ=Asia/Shanghai
ENV TZ=$TZ
ENTRYPOINT [ "/usr/bin/xray" ] ENTRYPOINT [ "/usr/bin/xray" ]
CMD [ "-config", "/etc/xray/config.json" ] CMD [ "-config", "/etc/xray/config.json" ]
ARG flavor=v2fly
COPY --from=build --chmod=644 /$flavor /usr/share/xray

View File

@@ -19,20 +19,7 @@ jobs:
uses: docker/metadata-action@v5 uses: docker/metadata-action@v5
with: with:
images: ghcr.io/${{ github.repository_owner }}/xray-core images: ghcr.io/${{ github.repository_owner }}/xray-core
flavor: latest=auto flavor: latest=true
tags: |
type=sha
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
- name: Docker metadata Loyalsoldier flavor
id: loyalsoldier
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/xray-core
flavor: |
latest=auto
suffix=-ls,onlatest=true
tags: | tags: |
type=sha type=sha
type=ref,event=branch type=ref,event=branch
@@ -44,33 +31,18 @@ jobs:
registry: ghcr.io registry: ghcr.io
username: ${{ github.repository_owner }} username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- # Add support for more platforms with QEMU (optional)
# https://github.com/docker/setup-qemu-action
name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
- name: Build and push - name: Build and push
uses: docker/build-push-action@v6 uses: docker/build-push-action@v6
with: with:
context: . context: .
platforms: | platforms: linux/amd64,linux/arm64
linux/amd64
linux/arm64
linux/loong64
linux/riscv64
provenance: false
file: .github/docker/Dockerfile file: .github/docker/Dockerfile
push: true push: true
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
- name: Build and push Loyalsoldier flavor labels: ${{ steps.meta.outputs.labels }}
uses: docker/build-push-action@v6
with:
context: .
platforms: |
linux/amd64
linux/arm64
linux/loong64
linux/riscv64
provenance: false
file: .github/docker/Dockerfile
build-args: flavor=loyalsoldier
push: true
tags: |
${{ steps.loyalsoldier.outputs.tags }}

View File

@@ -78,15 +78,12 @@ jobs:
# Include amd64 on all platforms. # Include amd64 on all platforms.
goos: [windows, freebsd, openbsd, linux, darwin] goos: [windows, freebsd, openbsd, linux, darwin]
goarch: [amd64, 386] goarch: [amd64, 386]
gotoolchain: [""]
patch-assetname: [""]
exclude: exclude:
# Exclude i386 on darwin # Exclude i386 on darwin
- goarch: 386 - goarch: 386
goos: darwin goos: darwin
include: include:
# BEGIN MacOS ARM64 # BEIGIN MacOS ARM64
- goos: darwin - goos: darwin
goarch: arm64 goarch: arm64
# END MacOS ARM64 # END MacOS ARM64
@@ -155,16 +152,6 @@ jobs:
goarch: arm goarch: arm
goarm: 7 goarm: 7
# END OPENBSD ARM # END OPENBSD ARM
# BEGIN Windows 7
- goos: windows
goarch: amd64
gotoolchain: 1.21.4
patch-assetname: win7-64
- goos: windows
goarch: 386
gotoolchain: 1.21.4
patch-assetname: win7-32
# END Windows 7
fail-fast: false fail-fast: false
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -179,15 +166,14 @@ jobs:
- name: Show workflow information - name: Show workflow information
run: | run: |
_NAME=${{ matrix.patch-assetname }} export _NAME=$(jq ".[\"$GOOS-$GOARCH$GOARM$GOMIPS\"].friendlyName" -r < .github/build/friendly-filenames.json)
[ -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" echo "GOOS: $GOOS, GOARCH: $GOARCH, GOARM: $GOARM, GOMIPS: $GOMIPS, RELEASE_NAME: $_NAME"
echo "ASSET_NAME=$_NAME" >> $GITHUB_ENV echo "ASSET_NAME=$_NAME" >> $GITHUB_ENV
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v5 uses: actions/setup-go@v5
with: with:
go-version: ${{ matrix.gotoolchain || '1.23' }} go-version-file: go.mod
check-latest: true check-latest: true
- name: Get project dependencies - name: Get project dependencies

View File

@@ -32,7 +32,7 @@ jobs:
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v5 uses: actions/setup-go@v5
with: with:
go-version: '1.23' go-version-file: go.mod
check-latest: true check-latest: true
- name: Restore Cache - name: Restore Cache
uses: actions/cache/restore@v4 uses: actions/cache/restore@v4

View File

@@ -3,13 +3,13 @@ NAME = xray
VERSION=$(shell git describe --always --dirty) VERSION=$(shell git describe --always --dirty)
# NOTE: This MAKEFILE can be used to build Xray-core locally and in Automatic workflows. It is \ # NOTE: This MAKEFILE can be used to build Xray-core locally and in Automatic workflows. It is \
provided for convenience in automatic building and functions as a part of it. provided for convinience in automatic building and functions as a part of it.
# NOTE: If you need to modify this file, please be aware that:\ # NOTE: If you need to modify this file, please be aware that:\
- This file is not the main Makefile; it only accepts environment variables and builds the \ - This file is not the main Makefile; it only accepts environment variables and builds the \
binary.\ binary.\
- Automatic building expects the correct binaries to be built by this Makefile. If you \ - Automatic building expects the correct binaries to be built by this Makefile. If you \
intend to propose a change to this Makefile, carefully review the file below and ensure \ intend to propose a change to this Makefile, carefully review the file below and ensure \
that the change will not accidentally break the automatic building:\ that the change will not accidently break the automatic building:\
.github/workflows/release.yml \ .github/workflows/release.yml \
Otherwise it is recommended to contact the project maintainers. Otherwise it is recommended to contact the project maintainers.

View File

@@ -4,10 +4,6 @@
[README](https://github.com/XTLS/Xray-core#readme) is open, so feel free to submit your project [here](https://github.com/XTLS/Xray-core/pulls). [README](https://github.com/XTLS/Xray-core#readme) is open, so feel free to submit your project [here](https://github.com/XTLS/Xray-core/pulls).
## Donation & NFTs
[Announcement of NFTs by Project X](https://github.com/XTLS/Xray-core/discussions/3633)
## License ## License
[Mozilla Public License Version 2.0](https://github.com/XTLS/Xray-core/blob/main/LICENSE) [Mozilla Public License Version 2.0](https://github.com/XTLS/Xray-core/blob/main/LICENSE)
@@ -22,8 +18,6 @@
[Project X Channel](https://t.me/projectXtls) [Project X Channel](https://t.me/projectXtls)
[Project VLESS](https://t.me/projectVless) (non-Chinese)
## Installation ## Installation
- Linux Script - Linux Script
@@ -33,7 +27,8 @@
- [ghcr.io/xtls/xray-core](https://ghcr.io/xtls/xray-core) (**Official**) - [ghcr.io/xtls/xray-core](https://ghcr.io/xtls/xray-core) (**Official**)
- [teddysun/xray](https://hub.docker.com/r/teddysun/xray) - [teddysun/xray](https://hub.docker.com/r/teddysun/xray)
- Web Panel - Web Panel
- [3X-UI](https://github.com/MHSanaei/3x-ui), [X-UI](https://github.com/alireza0/x-ui), [Xray-UI](https://github.com/qist/xray-ui) - [X-UI-English](https://github.com/NidukaAkalanka/x-ui-english), [3X-UI](https://github.com/MHSanaei/3x-ui), [X-UI](https://github.com/alireza0/x-ui), [X-UI](https://github.com/diditra/x-ui)
- [Xray-UI](https://github.com/qist/xray-ui), [X-UI](https://github.com/sing-web/x-ui)
- [Hiddify](https://github.com/hiddify/hiddify-config) - [Hiddify](https://github.com/hiddify/hiddify-config)
- [Marzban](https://github.com/Gozargah/Marzban) - [Marzban](https://github.com/Gozargah/Marzban)
- [Libertea](https://github.com/VZiChoushaDui/Libertea) - [Libertea](https://github.com/VZiChoushaDui/Libertea)
@@ -72,10 +67,13 @@
- [luci-app-xray](https://github.com/yichya/luci-app-xray) ([openwrt-xray](https://github.com/yichya/openwrt-xray)) - [luci-app-xray](https://github.com/yichya/luci-app-xray) ([openwrt-xray](https://github.com/yichya/openwrt-xray))
- Windows - Windows
- [v2rayN](https://github.com/2dust/v2rayN) - [v2rayN](https://github.com/2dust/v2rayN)
- [NekoRay](https://github.com/Matsuridayo/nekoray)
- [Furious](https://github.com/LorenEteval/Furious) - [Furious](https://github.com/LorenEteval/Furious)
- [HiddifyN](https://github.com/hiddify/HiddifyN)
- [Invisible Man - Xray](https://github.com/InvisibleManVPN/InvisibleMan-XRayClient) - [Invisible Man - Xray](https://github.com/InvisibleManVPN/InvisibleMan-XRayClient)
- Android - Android
- [v2rayNG](https://github.com/2dust/v2rayNG) - [v2rayNG](https://github.com/2dust/v2rayNG)
- [HiddifyNG](https://github.com/hiddify/HiddifyNG)
- [X-flutter](https://github.com/XTLS/X-flutter) - [X-flutter](https://github.com/XTLS/X-flutter)
- iOS & macOS arm64 - iOS & macOS arm64
- [FoXray](https://apps.apple.com/app/foxray/id6448898396) - [FoXray](https://apps.apple.com/app/foxray/id6448898396)
@@ -87,6 +85,7 @@
- [FoXray](https://apps.apple.com/app/foxray/id6448898396) - [FoXray](https://apps.apple.com/app/foxray/id6448898396)
- Linux - Linux
- [v2rayA](https://github.com/v2rayA/v2rayA) - [v2rayA](https://github.com/v2rayA/v2rayA)
- [NekoRay](https://github.com/Matsuridayo/nekoray)
- [Furious](https://github.com/LorenEteval/Furious) - [Furious](https://github.com/LorenEteval/Furious)
## Others that support VLESS, XTLS, REALITY, XUDP, PLUX... ## Others that support VLESS, XTLS, REALITY, XUDP, PLUX...
@@ -99,15 +98,21 @@
- [XTLS/libXray](https://github.com/XTLS/libXray) - [XTLS/libXray](https://github.com/XTLS/libXray)
- [xtlsapi](https://github.com/hiddify/xtlsapi) - [xtlsapi](https://github.com/hiddify/xtlsapi)
- [AndroidLibXrayLite](https://github.com/2dust/AndroidLibXrayLite) - [AndroidLibXrayLite](https://github.com/2dust/AndroidLibXrayLite)
- [XrayKit](https://github.com/arror/XrayKit)
- [Xray-core-python](https://github.com/LorenEteval/Xray-core-python) - [Xray-core-python](https://github.com/LorenEteval/Xray-core-python)
- [xray-api](https://github.com/XVGuardian/xray-api) - [xray-api](https://github.com/XVGuardian/xray-api)
- [XrayR](https://github.com/XrayR-project/XrayR) - [XrayR](https://github.com/XrayR-project/XrayR)
- [XrayR-release](https://github.com/XrayR-project/XrayR-release) - [XrayR-release](https://github.com/XrayR-project/XrayR-release)
- [XrayR-V2Board](https://github.com/missuo/XrayR-V2Board) - [XrayR-V2Board](https://github.com/missuo/XrayR-V2Board)
- [Clash.Meta](https://github.com/MetaCubeX/Clash.Meta) - [Clash.Meta](https://github.com/MetaCubeX/Clash.Meta)
- [Clash Verge](https://github.com/zzzgydi/clash-verge)
- [clashN](https://github.com/2dust/clashN) - [clashN](https://github.com/2dust/clashN)
- [Clash Meta for Android](https://github.com/MetaCubeX/ClashMetaForAndroid) - [Clash Meta for Android](https://github.com/MetaCubeX/ClashMetaForAndroid)
- [meta_for_ios](https://t.me/meta_for_ios)
- [sing-box](https://github.com/SagerNet/sing-box) - [sing-box](https://github.com/SagerNet/sing-box)
- [installReality](https://github.com/BoxXt/installReality)
- [sbox-reality](https://github.com/Misaka-blog/sbox-reality)
- [sing-box-for-ios](https://github.com/SagerNet/sing-box-for-ios)
## Contributing ## Contributing

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.34.2 // protoc-gen-go v1.34.1
// protoc v5.27.0 // protoc v5.27.0
// source: app/commander/config.proto // source: app/commander/config.proto
@@ -166,7 +166,7 @@ func file_app_commander_config_proto_rawDescGZIP() []byte {
} }
var file_app_commander_config_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_app_commander_config_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_app_commander_config_proto_goTypes = []any{ var file_app_commander_config_proto_goTypes = []interface{}{
(*Config)(nil), // 0: xray.app.commander.Config (*Config)(nil), // 0: xray.app.commander.Config
(*ReflectionConfig)(nil), // 1: xray.app.commander.ReflectionConfig (*ReflectionConfig)(nil), // 1: xray.app.commander.ReflectionConfig
(*serial.TypedMessage)(nil), // 2: xray.common.serial.TypedMessage (*serial.TypedMessage)(nil), // 2: xray.common.serial.TypedMessage
@@ -186,7 +186,7 @@ func file_app_commander_config_proto_init() {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_app_commander_config_proto_msgTypes[0].Exporter = func(v any, i int) any { file_app_commander_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Config); i { switch v := v.(*Config); i {
case 0: case 0:
return &v.state return &v.state
@@ -198,7 +198,7 @@ func file_app_commander_config_proto_init() {
return nil return nil
} }
} }
file_app_commander_config_proto_msgTypes[1].Exporter = func(v any, i int) any { file_app_commander_config_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ReflectionConfig); i { switch v := v.(*ReflectionConfig); i {
case 0: case 0:
return &v.state return &v.state

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.34.2 // protoc-gen-go v1.34.1
// protoc v5.27.0 // protoc v5.27.0
// source: app/dispatcher/config.proto // source: app/dispatcher/config.proto
@@ -139,7 +139,7 @@ func file_app_dispatcher_config_proto_rawDescGZIP() []byte {
} }
var file_app_dispatcher_config_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_app_dispatcher_config_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_app_dispatcher_config_proto_goTypes = []any{ var file_app_dispatcher_config_proto_goTypes = []interface{}{
(*SessionConfig)(nil), // 0: xray.app.dispatcher.SessionConfig (*SessionConfig)(nil), // 0: xray.app.dispatcher.SessionConfig
(*Config)(nil), // 1: xray.app.dispatcher.Config (*Config)(nil), // 1: xray.app.dispatcher.Config
} }
@@ -158,7 +158,7 @@ func file_app_dispatcher_config_proto_init() {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_app_dispatcher_config_proto_msgTypes[0].Exporter = func(v any, i int) any { file_app_dispatcher_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SessionConfig); i { switch v := v.(*SessionConfig); i {
case 0: case 0:
return &v.state return &v.state
@@ -170,7 +170,7 @@ func file_app_dispatcher_config_proto_init() {
return nil return nil
} }
} }
file_app_dispatcher_config_proto_msgTypes[1].Exporter = func(v any, i int) any { file_app_dispatcher_config_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Config); i { switch v := v.(*Config); i {
case 0: case 0:
return &v.state return &v.state

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.34.2 // protoc-gen-go v1.34.1
// protoc v5.27.0 // protoc v5.27.0
// source: app/dns/config.proto // source: app/dns/config.proto
@@ -658,7 +658,7 @@ func file_app_dns_config_proto_rawDescGZIP() []byte {
var file_app_dns_config_proto_enumTypes = make([]protoimpl.EnumInfo, 2) var file_app_dns_config_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
var file_app_dns_config_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_app_dns_config_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_app_dns_config_proto_goTypes = []any{ var file_app_dns_config_proto_goTypes = []interface{}{
(DomainMatchingType)(0), // 0: xray.app.dns.DomainMatchingType (DomainMatchingType)(0), // 0: xray.app.dns.DomainMatchingType
(QueryStrategy)(0), // 1: xray.app.dns.QueryStrategy (QueryStrategy)(0), // 1: xray.app.dns.QueryStrategy
(*NameServer)(nil), // 2: xray.app.dns.NameServer (*NameServer)(nil), // 2: xray.app.dns.NameServer
@@ -698,7 +698,7 @@ func file_app_dns_config_proto_init() {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_app_dns_config_proto_msgTypes[0].Exporter = func(v any, i int) any { file_app_dns_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*NameServer); i { switch v := v.(*NameServer); i {
case 0: case 0:
return &v.state return &v.state
@@ -710,7 +710,7 @@ func file_app_dns_config_proto_init() {
return nil return nil
} }
} }
file_app_dns_config_proto_msgTypes[1].Exporter = func(v any, i int) any { file_app_dns_config_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Config); i { switch v := v.(*Config); i {
case 0: case 0:
return &v.state return &v.state
@@ -722,7 +722,7 @@ func file_app_dns_config_proto_init() {
return nil return nil
} }
} }
file_app_dns_config_proto_msgTypes[2].Exporter = func(v any, i int) any { file_app_dns_config_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*NameServer_PriorityDomain); i { switch v := v.(*NameServer_PriorityDomain); i {
case 0: case 0:
return &v.state return &v.state
@@ -734,7 +734,7 @@ func file_app_dns_config_proto_init() {
return nil return nil
} }
} }
file_app_dns_config_proto_msgTypes[3].Exporter = func(v any, i int) any { file_app_dns_config_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*NameServer_OriginalRule); i { switch v := v.(*NameServer_OriginalRule); i {
case 0: case 0:
return &v.state return &v.state
@@ -746,7 +746,7 @@ func file_app_dns_config_proto_init() {
return nil return nil
} }
} }
file_app_dns_config_proto_msgTypes[5].Exporter = func(v any, i int) any { file_app_dns_config_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Config_HostMapping); i { switch v := v.(*Config_HostMapping); i {
case 0: case 0:
return &v.state return &v.state

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.34.2 // protoc-gen-go v1.34.1
// protoc v5.27.0 // protoc v5.27.0
// source: app/dns/fakedns/fakedns.proto // source: app/dns/fakedns/fakedns.proto
@@ -159,7 +159,7 @@ func file_app_dns_fakedns_fakedns_proto_rawDescGZIP() []byte {
} }
var file_app_dns_fakedns_fakedns_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_app_dns_fakedns_fakedns_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_app_dns_fakedns_fakedns_proto_goTypes = []any{ var file_app_dns_fakedns_fakedns_proto_goTypes = []interface{}{
(*FakeDnsPool)(nil), // 0: xray.app.dns.fakedns.FakeDnsPool (*FakeDnsPool)(nil), // 0: xray.app.dns.fakedns.FakeDnsPool
(*FakeDnsPoolMulti)(nil), // 1: xray.app.dns.fakedns.FakeDnsPoolMulti (*FakeDnsPoolMulti)(nil), // 1: xray.app.dns.fakedns.FakeDnsPoolMulti
} }
@@ -178,7 +178,7 @@ func file_app_dns_fakedns_fakedns_proto_init() {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_app_dns_fakedns_fakedns_proto_msgTypes[0].Exporter = func(v any, i int) any { file_app_dns_fakedns_fakedns_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*FakeDnsPool); i { switch v := v.(*FakeDnsPool); i {
case 0: case 0:
return &v.state return &v.state
@@ -190,7 +190,7 @@ func file_app_dns_fakedns_fakedns_proto_init() {
return nil return nil
} }
} }
file_app_dns_fakedns_fakedns_proto_msgTypes[1].Exporter = func(v any, i int) any { file_app_dns_fakedns_fakedns_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*FakeDnsPoolMulti); i { switch v := v.(*FakeDnsPoolMulti); i {
case 0: case 0:
return &v.state return &v.state

View File

@@ -62,7 +62,7 @@ func NewServer(dest net.Destination, dispatcher routing.Dispatcher, queryStrateg
dest.Network = net.Network_UDP dest.Network = net.Network_UDP
} }
if dest.Network == net.Network_UDP { // UDP classic DNS mode if dest.Network == net.Network_UDP { // UDP classic DNS mode
return NewClassicNameServer(dest, dispatcher, queryStrategy), nil return NewClassicNameServer(dest, dispatcher), nil
} }
return nil, errors.New("No available name server could be created from ", dest).AtWarning() return nil, errors.New("No available name server could be created from ", dest).AtWarning()
} }
@@ -85,12 +85,12 @@ func NewClient(
return errors.New("failed to create nameserver").Base(err).AtWarning() return errors.New("failed to create nameserver").Base(err).AtWarning()
} }
// Prioritize local domains with specific TLDs or those without any dot for the local DNS // Priotize local domains with specific TLDs or without any dot to local DNS
if _, isLocalDNS := server.(*LocalNameServer); isLocalDNS { if _, isLocalDNS := server.(*LocalNameServer); isLocalDNS {
ns.PrioritizedDomain = append(ns.PrioritizedDomain, localTLDsAndDotlessDomains...) ns.PrioritizedDomain = append(ns.PrioritizedDomain, localTLDsAndDotlessDomains...)
ns.OriginalRules = append(ns.OriginalRules, localTLDsAndDotlessDomainsRule) ns.OriginalRules = append(ns.OriginalRules, localTLDsAndDotlessDomainsRule)
// The following lines is a solution to avoid core panicsrule index out of range when setting `localhost` DNS client in config. // The following lines is a solution to avoid core panicsrule index out of range when setting `localhost` DNS client in config.
// Because the `localhost` DNS client will append len(localTLDsAndDotlessDomains) rules into matcherInfos to match `geosite:private` default rule. // Because the `localhost` DNS client will apend len(localTLDsAndDotlessDomains) rules into matcherInfos to match `geosite:private` default rule.
// But `matcherInfos` has no enough length to add rules, which leads to core panics (rule index out of range). // But `matcherInfos` has no enough length to add rules, which leads to core panics (rule index out of range).
// To avoid this, the length of `matcherInfos` must be equal to the expected, so manually append it with Golang default zero value first for later modification. // To avoid this, the length of `matcherInfos` must be equal to the expected, so manually append it with Golang default zero value first for later modification.
// Related issues: // Related issues:

View File

@@ -259,7 +259,7 @@ func (s *DoHNameServer) sendQuery(ctx context.Context, domain string, clientIP n
}) })
// forced to use mux for DOH // forced to use mux for DOH
// dnsCtx = session.ContextWithMuxPreferred(dnsCtx, true) // dnsCtx = session.ContextWithMuxPrefered(dnsCtx, true)
var cancel context.CancelFunc var cancel context.CancelFunc
dnsCtx, cancel = context.WithDeadline(dnsCtx, deadline) dnsCtx, cancel = context.WithDeadline(dnsCtx, deadline)

View File

@@ -32,11 +32,10 @@ type ClassicNameServer struct {
udpServer *udp.Dispatcher udpServer *udp.Dispatcher
cleanup *task.Periodic cleanup *task.Periodic
reqID uint32 reqID uint32
queryStrategy QueryStrategy
} }
// NewClassicNameServer creates udp server object for remote resolving. // NewClassicNameServer creates udp server object for remote resolving.
func NewClassicNameServer(address net.Destination, dispatcher routing.Dispatcher, queryStrategy QueryStrategy) *ClassicNameServer { func NewClassicNameServer(address net.Destination, dispatcher routing.Dispatcher) *ClassicNameServer {
// default to 53 if unspecific // default to 53 if unspecific
if address.Port == 0 { if address.Port == 0 {
address.Port = net.Port(53) address.Port = net.Port(53)
@@ -48,7 +47,6 @@ func NewClassicNameServer(address net.Destination, dispatcher routing.Dispatcher
requests: make(map[uint16]*dnsRequest), requests: make(map[uint16]*dnsRequest),
pub: pubsub.NewService(), pub: pubsub.NewService(),
name: strings.ToUpper(address.String()), name: strings.ToUpper(address.String()),
queryStrategy: queryStrategy,
} }
s.cleanup = &task.Periodic{ s.cleanup = &task.Periodic{
Interval: time.Minute, Interval: time.Minute,
@@ -241,10 +239,6 @@ func (s *ClassicNameServer) findIPsForDomain(domain string, option dns_feature.I
// QueryIP implements Server. // QueryIP implements Server.
func (s *ClassicNameServer) QueryIP(ctx context.Context, domain string, clientIP net.IP, option dns_feature.IPOption, disableCache bool) ([]net.IP, error) { func (s *ClassicNameServer) QueryIP(ctx context.Context, domain string, clientIP net.IP, option dns_feature.IPOption, disableCache bool) ([]net.IP, error) {
fqdn := Fqdn(domain) fqdn := Fqdn(domain)
option = ResolveIpOptionOverride(s.queryStrategy, option)
if !option.IPv4Enable && !option.IPv6Enable {
return nil, dns_feature.ErrEmptyResponse
}
if disableCache { if disableCache {
errors.LogDebug(ctx, "DNS cache is disabled. Querying IP for ", domain, " at ", s.name) errors.LogDebug(ctx, "DNS cache is disabled. Querying IP for ", domain, " at ", s.name)

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.34.2 // protoc-gen-go v1.34.1
// protoc v5.27.0 // protoc v5.27.0
// source: app/log/command/config.proto // source: app/log/command/config.proto
@@ -174,7 +174,7 @@ func file_app_log_command_config_proto_rawDescGZIP() []byte {
} }
var file_app_log_command_config_proto_msgTypes = make([]protoimpl.MessageInfo, 3) var file_app_log_command_config_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_app_log_command_config_proto_goTypes = []any{ var file_app_log_command_config_proto_goTypes = []interface{}{
(*Config)(nil), // 0: xray.app.log.command.Config (*Config)(nil), // 0: xray.app.log.command.Config
(*RestartLoggerRequest)(nil), // 1: xray.app.log.command.RestartLoggerRequest (*RestartLoggerRequest)(nil), // 1: xray.app.log.command.RestartLoggerRequest
(*RestartLoggerResponse)(nil), // 2: xray.app.log.command.RestartLoggerResponse (*RestartLoggerResponse)(nil), // 2: xray.app.log.command.RestartLoggerResponse
@@ -195,7 +195,7 @@ func file_app_log_command_config_proto_init() {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_app_log_command_config_proto_msgTypes[0].Exporter = func(v any, i int) any { file_app_log_command_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Config); i { switch v := v.(*Config); i {
case 0: case 0:
return &v.state return &v.state
@@ -207,7 +207,7 @@ func file_app_log_command_config_proto_init() {
return nil return nil
} }
} }
file_app_log_command_config_proto_msgTypes[1].Exporter = func(v any, i int) any { file_app_log_command_config_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RestartLoggerRequest); i { switch v := v.(*RestartLoggerRequest); i {
case 0: case 0:
return &v.state return &v.state
@@ -219,7 +219,7 @@ func file_app_log_command_config_proto_init() {
return nil return nil
} }
} }
file_app_log_command_config_proto_msgTypes[2].Exporter = func(v any, i int) any { file_app_log_command_config_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RestartLoggerResponse); i { switch v := v.(*RestartLoggerResponse); i {
case 0: case 0:
return &v.state return &v.state

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT. // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions: // versions:
// - protoc-gen-go-grpc v1.5.1 // - protoc-gen-go-grpc v1.3.0
// - protoc v5.27.0 // - protoc v5.27.0
// source: app/log/command/config.proto // source: app/log/command/config.proto
@@ -15,8 +15,8 @@ import (
// This is a compile-time assertion to ensure that this generated file // This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against. // is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later. // Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion9 const _ = grpc.SupportPackageIsVersion7
const ( const (
LoggerService_RestartLogger_FullMethodName = "/xray.app.log.command.LoggerService/RestartLogger" LoggerService_RestartLogger_FullMethodName = "/xray.app.log.command.LoggerService/RestartLogger"
@@ -38,9 +38,8 @@ func NewLoggerServiceClient(cc grpc.ClientConnInterface) LoggerServiceClient {
} }
func (c *loggerServiceClient) RestartLogger(ctx context.Context, in *RestartLoggerRequest, opts ...grpc.CallOption) (*RestartLoggerResponse, error) { func (c *loggerServiceClient) RestartLogger(ctx context.Context, in *RestartLoggerRequest, opts ...grpc.CallOption) (*RestartLoggerResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(RestartLoggerResponse) out := new(RestartLoggerResponse)
err := c.cc.Invoke(ctx, LoggerService_RestartLogger_FullMethodName, in, out, cOpts...) err := c.cc.Invoke(ctx, LoggerService_RestartLogger_FullMethodName, in, out, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@@ -49,24 +48,20 @@ func (c *loggerServiceClient) RestartLogger(ctx context.Context, in *RestartLogg
// LoggerServiceServer is the server API for LoggerService service. // LoggerServiceServer is the server API for LoggerService service.
// All implementations must embed UnimplementedLoggerServiceServer // All implementations must embed UnimplementedLoggerServiceServer
// for forward compatibility. // for forward compatibility
type LoggerServiceServer interface { type LoggerServiceServer interface {
RestartLogger(context.Context, *RestartLoggerRequest) (*RestartLoggerResponse, error) RestartLogger(context.Context, *RestartLoggerRequest) (*RestartLoggerResponse, error)
mustEmbedUnimplementedLoggerServiceServer() mustEmbedUnimplementedLoggerServiceServer()
} }
// UnimplementedLoggerServiceServer must be embedded to have // UnimplementedLoggerServiceServer must be embedded to have forward compatible implementations.
// forward compatible implementations. type UnimplementedLoggerServiceServer struct {
// }
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedLoggerServiceServer struct{}
func (UnimplementedLoggerServiceServer) RestartLogger(context.Context, *RestartLoggerRequest) (*RestartLoggerResponse, error) { func (UnimplementedLoggerServiceServer) RestartLogger(context.Context, *RestartLoggerRequest) (*RestartLoggerResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method RestartLogger not implemented") return nil, status.Errorf(codes.Unimplemented, "method RestartLogger not implemented")
} }
func (UnimplementedLoggerServiceServer) mustEmbedUnimplementedLoggerServiceServer() {} func (UnimplementedLoggerServiceServer) mustEmbedUnimplementedLoggerServiceServer() {}
func (UnimplementedLoggerServiceServer) testEmbeddedByValue() {}
// UnsafeLoggerServiceServer may be embedded to opt out of forward compatibility for this service. // UnsafeLoggerServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to LoggerServiceServer will // Use of this interface is not recommended, as added methods to LoggerServiceServer will
@@ -76,13 +71,6 @@ type UnsafeLoggerServiceServer interface {
} }
func RegisterLoggerServiceServer(s grpc.ServiceRegistrar, srv LoggerServiceServer) { func RegisterLoggerServiceServer(s grpc.ServiceRegistrar, srv LoggerServiceServer) {
// If the following call pancis, it indicates UnimplementedLoggerServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&LoggerService_ServiceDesc, srv) s.RegisterService(&LoggerService_ServiceDesc, srv)
} }

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.34.2 // protoc-gen-go v1.34.1
// protoc v5.27.0 // protoc v5.27.0
// source: app/log/config.proto // source: app/log/config.proto
@@ -211,7 +211,7 @@ func file_app_log_config_proto_rawDescGZIP() []byte {
var file_app_log_config_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_app_log_config_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_app_log_config_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_app_log_config_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_app_log_config_proto_goTypes = []any{ var file_app_log_config_proto_goTypes = []interface{}{
(LogType)(0), // 0: xray.app.log.LogType (LogType)(0), // 0: xray.app.log.LogType
(*Config)(nil), // 1: xray.app.log.Config (*Config)(nil), // 1: xray.app.log.Config
(log.Severity)(0), // 2: xray.common.log.Severity (log.Severity)(0), // 2: xray.common.log.Severity
@@ -233,7 +233,7 @@ func file_app_log_config_proto_init() {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_app_log_config_proto_msgTypes[0].Exporter = func(v any, i int) any { file_app_log_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Config); i { switch v := v.(*Config); i {
case 0: case 0:
return &v.state return &v.state

View File

@@ -30,8 +30,8 @@ func New(ctx context.Context, config *Config) (*Instance, error) {
} }
log.RegisterHandler(g) log.RegisterHandler(g)
// Start logger instantly on initialization // start logger instantly on inited
// Other modules would log during initialization // other modules would log during init
if err := g.startInternal(); err != nil { if err := g.startInternal(); err != nil {
return nil, err return nil, err
} }

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.34.2 // protoc-gen-go v1.34.1
// protoc v5.27.0 // protoc v5.27.0
// source: app/metrics/config.proto // source: app/metrics/config.proto
@@ -98,7 +98,7 @@ func file_app_metrics_config_proto_rawDescGZIP() []byte {
} }
var file_app_metrics_config_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_app_metrics_config_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_app_metrics_config_proto_goTypes = []any{ var file_app_metrics_config_proto_goTypes = []interface{}{
(*Config)(nil), // 0: xray.app.metrics.Config (*Config)(nil), // 0: xray.app.metrics.Config
} }
var file_app_metrics_config_proto_depIdxs = []int32{ var file_app_metrics_config_proto_depIdxs = []int32{
@@ -115,7 +115,7 @@ func file_app_metrics_config_proto_init() {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_app_metrics_config_proto_msgTypes[0].Exporter = func(v any, i int) any { file_app_metrics_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Config); i { switch v := v.(*Config); i {
case 0: case 0:
return &v.state return &v.state

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.34.2 // protoc-gen-go v1.34.1
// protoc v5.27.0 // protoc v5.27.0
// source: app/observatory/burst/config.proto // source: app/observatory/burst/config.proto
@@ -211,7 +211,7 @@ func file_app_observatory_burst_config_proto_rawDescGZIP() []byte {
} }
var file_app_observatory_burst_config_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_app_observatory_burst_config_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_app_observatory_burst_config_proto_goTypes = []any{ var file_app_observatory_burst_config_proto_goTypes = []interface{}{
(*Config)(nil), // 0: xray.core.app.observatory.burst.Config (*Config)(nil), // 0: xray.core.app.observatory.burst.Config
(*HealthPingConfig)(nil), // 1: xray.core.app.observatory.burst.HealthPingConfig (*HealthPingConfig)(nil), // 1: xray.core.app.observatory.burst.HealthPingConfig
} }
@@ -230,7 +230,7 @@ func file_app_observatory_burst_config_proto_init() {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_app_observatory_burst_config_proto_msgTypes[0].Exporter = func(v any, i int) any { file_app_observatory_burst_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Config); i { switch v := v.(*Config); i {
case 0: case 0:
return &v.state return &v.state
@@ -242,7 +242,7 @@ func file_app_observatory_burst_config_proto_init() {
return nil return nil
} }
} }
file_app_observatory_burst_config_proto_msgTypes[1].Exporter = func(v any, i int) any { file_app_observatory_burst_config_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*HealthPingConfig); i { switch v := v.(*HealthPingConfig); i {
case 0: case 0:
return &v.state return &v.state

View File

@@ -209,7 +209,7 @@ func (h *HealthPing) PutResult(tag string, rtt time.Duration) {
if !ok { if !ok {
// validity is 2 times to sampling period, since the check are // validity is 2 times to sampling period, since the check are
// distributed in the time line randomly, in extreme cases, // distributed in the time line randomly, in extreme cases,
// Previous checks are distributed on the left, and later ones // previous checks are distributed on the left, and latters
// on the right // on the right
validity := h.Settings.Interval * time.Duration(h.Settings.SamplingCount) * 2 validity := h.Settings.Interval * time.Duration(h.Settings.SamplingCount) * 2
r = NewHealthPingResult(h.Settings.SamplingCount, validity) r = NewHealthPingResult(h.Settings.SamplingCount, validity)

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.34.2 // protoc-gen-go v1.34.1
// protoc v5.27.0 // protoc v5.27.0
// source: app/observatory/command/command.proto // source: app/observatory/command/command.proto
@@ -197,7 +197,7 @@ func file_app_observatory_command_command_proto_rawDescGZIP() []byte {
} }
var file_app_observatory_command_command_proto_msgTypes = make([]protoimpl.MessageInfo, 3) var file_app_observatory_command_command_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_app_observatory_command_command_proto_goTypes = []any{ var file_app_observatory_command_command_proto_goTypes = []interface{}{
(*GetOutboundStatusRequest)(nil), // 0: xray.core.app.observatory.command.GetOutboundStatusRequest (*GetOutboundStatusRequest)(nil), // 0: xray.core.app.observatory.command.GetOutboundStatusRequest
(*GetOutboundStatusResponse)(nil), // 1: xray.core.app.observatory.command.GetOutboundStatusResponse (*GetOutboundStatusResponse)(nil), // 1: xray.core.app.observatory.command.GetOutboundStatusResponse
(*Config)(nil), // 2: xray.core.app.observatory.command.Config (*Config)(nil), // 2: xray.core.app.observatory.command.Config
@@ -220,7 +220,7 @@ func file_app_observatory_command_command_proto_init() {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_app_observatory_command_command_proto_msgTypes[0].Exporter = func(v any, i int) any { file_app_observatory_command_command_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetOutboundStatusRequest); i { switch v := v.(*GetOutboundStatusRequest); i {
case 0: case 0:
return &v.state return &v.state
@@ -232,7 +232,7 @@ func file_app_observatory_command_command_proto_init() {
return nil return nil
} }
} }
file_app_observatory_command_command_proto_msgTypes[1].Exporter = func(v any, i int) any { file_app_observatory_command_command_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetOutboundStatusResponse); i { switch v := v.(*GetOutboundStatusResponse); i {
case 0: case 0:
return &v.state return &v.state
@@ -244,7 +244,7 @@ func file_app_observatory_command_command_proto_init() {
return nil return nil
} }
} }
file_app_observatory_command_command_proto_msgTypes[2].Exporter = func(v any, i int) any { file_app_observatory_command_command_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Config); i { switch v := v.(*Config); i {
case 0: case 0:
return &v.state return &v.state

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT. // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions: // versions:
// - protoc-gen-go-grpc v1.5.1 // - protoc-gen-go-grpc v1.3.0
// - protoc v5.27.0 // - protoc v5.27.0
// source: app/observatory/command/command.proto // source: app/observatory/command/command.proto
@@ -15,8 +15,8 @@ import (
// This is a compile-time assertion to ensure that this generated file // This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against. // is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later. // Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion9 const _ = grpc.SupportPackageIsVersion7
const ( const (
ObservatoryService_GetOutboundStatus_FullMethodName = "/xray.core.app.observatory.command.ObservatoryService/GetOutboundStatus" ObservatoryService_GetOutboundStatus_FullMethodName = "/xray.core.app.observatory.command.ObservatoryService/GetOutboundStatus"
@@ -38,9 +38,8 @@ func NewObservatoryServiceClient(cc grpc.ClientConnInterface) ObservatoryService
} }
func (c *observatoryServiceClient) GetOutboundStatus(ctx context.Context, in *GetOutboundStatusRequest, opts ...grpc.CallOption) (*GetOutboundStatusResponse, error) { func (c *observatoryServiceClient) GetOutboundStatus(ctx context.Context, in *GetOutboundStatusRequest, opts ...grpc.CallOption) (*GetOutboundStatusResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetOutboundStatusResponse) out := new(GetOutboundStatusResponse)
err := c.cc.Invoke(ctx, ObservatoryService_GetOutboundStatus_FullMethodName, in, out, cOpts...) err := c.cc.Invoke(ctx, ObservatoryService_GetOutboundStatus_FullMethodName, in, out, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@@ -49,24 +48,20 @@ func (c *observatoryServiceClient) GetOutboundStatus(ctx context.Context, in *Ge
// ObservatoryServiceServer is the server API for ObservatoryService service. // ObservatoryServiceServer is the server API for ObservatoryService service.
// All implementations must embed UnimplementedObservatoryServiceServer // All implementations must embed UnimplementedObservatoryServiceServer
// for forward compatibility. // for forward compatibility
type ObservatoryServiceServer interface { type ObservatoryServiceServer interface {
GetOutboundStatus(context.Context, *GetOutboundStatusRequest) (*GetOutboundStatusResponse, error) GetOutboundStatus(context.Context, *GetOutboundStatusRequest) (*GetOutboundStatusResponse, error)
mustEmbedUnimplementedObservatoryServiceServer() mustEmbedUnimplementedObservatoryServiceServer()
} }
// UnimplementedObservatoryServiceServer must be embedded to have // UnimplementedObservatoryServiceServer must be embedded to have forward compatible implementations.
// forward compatible implementations. type UnimplementedObservatoryServiceServer struct {
// }
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedObservatoryServiceServer struct{}
func (UnimplementedObservatoryServiceServer) GetOutboundStatus(context.Context, *GetOutboundStatusRequest) (*GetOutboundStatusResponse, error) { func (UnimplementedObservatoryServiceServer) GetOutboundStatus(context.Context, *GetOutboundStatusRequest) (*GetOutboundStatusResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetOutboundStatus not implemented") return nil, status.Errorf(codes.Unimplemented, "method GetOutboundStatus not implemented")
} }
func (UnimplementedObservatoryServiceServer) mustEmbedUnimplementedObservatoryServiceServer() {} func (UnimplementedObservatoryServiceServer) mustEmbedUnimplementedObservatoryServiceServer() {}
func (UnimplementedObservatoryServiceServer) testEmbeddedByValue() {}
// UnsafeObservatoryServiceServer may be embedded to opt out of forward compatibility for this service. // UnsafeObservatoryServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to ObservatoryServiceServer will // Use of this interface is not recommended, as added methods to ObservatoryServiceServer will
@@ -76,13 +71,6 @@ type UnsafeObservatoryServiceServer interface {
} }
func RegisterObservatoryServiceServer(s grpc.ServiceRegistrar, srv ObservatoryServiceServer) { func RegisterObservatoryServiceServer(s grpc.ServiceRegistrar, srv ObservatoryServiceServer) {
// If the following call pancis, it indicates UnimplementedObservatoryServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&ObservatoryService_ServiceDesc, srv) s.RegisterService(&ObservatoryService_ServiceDesc, srv)
} }

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.34.2 // protoc-gen-go v1.34.1
// protoc v5.27.0 // protoc v5.27.0
// source: app/observatory/config.proto // source: app/observatory/config.proto
@@ -536,7 +536,7 @@ func file_app_observatory_config_proto_rawDescGZIP() []byte {
} }
var file_app_observatory_config_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_app_observatory_config_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_app_observatory_config_proto_goTypes = []any{ var file_app_observatory_config_proto_goTypes = []interface{}{
(*ObservationResult)(nil), // 0: xray.core.app.observatory.ObservationResult (*ObservationResult)(nil), // 0: xray.core.app.observatory.ObservationResult
(*HealthPingMeasurementResult)(nil), // 1: xray.core.app.observatory.HealthPingMeasurementResult (*HealthPingMeasurementResult)(nil), // 1: xray.core.app.observatory.HealthPingMeasurementResult
(*OutboundStatus)(nil), // 2: xray.core.app.observatory.OutboundStatus (*OutboundStatus)(nil), // 2: xray.core.app.observatory.OutboundStatus
@@ -560,7 +560,7 @@ func file_app_observatory_config_proto_init() {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_app_observatory_config_proto_msgTypes[0].Exporter = func(v any, i int) any { file_app_observatory_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ObservationResult); i { switch v := v.(*ObservationResult); i {
case 0: case 0:
return &v.state return &v.state
@@ -572,7 +572,7 @@ func file_app_observatory_config_proto_init() {
return nil return nil
} }
} }
file_app_observatory_config_proto_msgTypes[1].Exporter = func(v any, i int) any { file_app_observatory_config_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*HealthPingMeasurementResult); i { switch v := v.(*HealthPingMeasurementResult); i {
case 0: case 0:
return &v.state return &v.state
@@ -584,7 +584,7 @@ func file_app_observatory_config_proto_init() {
return nil return nil
} }
} }
file_app_observatory_config_proto_msgTypes[2].Exporter = func(v any, i int) any { file_app_observatory_config_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*OutboundStatus); i { switch v := v.(*OutboundStatus); i {
case 0: case 0:
return &v.state return &v.state
@@ -596,7 +596,7 @@ func file_app_observatory_config_proto_init() {
return nil return nil
} }
} }
file_app_observatory_config_proto_msgTypes[3].Exporter = func(v any, i int) any { file_app_observatory_config_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ProbeResult); i { switch v := v.(*ProbeResult); i {
case 0: case 0:
return &v.state return &v.state
@@ -608,7 +608,7 @@ func file_app_observatory_config_proto_init() {
return nil return nil
} }
} }
file_app_observatory_config_proto_msgTypes[4].Exporter = func(v any, i int) any { file_app_observatory_config_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Intensity); i { switch v := v.(*Intensity); i {
case 0: case 0:
return &v.state return &v.state
@@ -620,7 +620,7 @@ func file_app_observatory_config_proto_init() {
return nil return nil
} }
} }
file_app_observatory_config_proto_msgTypes[5].Exporter = func(v any, i int) any { file_app_observatory_config_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Config); i { switch v := v.(*Config); i {
case 0: case 0:
return &v.state return &v.state

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.34.2 // protoc-gen-go v1.34.1
// protoc v5.27.0 // protoc v5.27.0
// source: app/policy/config.proto // source: app/policy/config.proto
@@ -570,7 +570,7 @@ func file_app_policy_config_proto_rawDescGZIP() []byte {
} }
var file_app_policy_config_proto_msgTypes = make([]protoimpl.MessageInfo, 9) var file_app_policy_config_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
var file_app_policy_config_proto_goTypes = []any{ var file_app_policy_config_proto_goTypes = []interface{}{
(*Second)(nil), // 0: xray.app.policy.Second (*Second)(nil), // 0: xray.app.policy.Second
(*Policy)(nil), // 1: xray.app.policy.Policy (*Policy)(nil), // 1: xray.app.policy.Policy
(*SystemPolicy)(nil), // 2: xray.app.policy.SystemPolicy (*SystemPolicy)(nil), // 2: xray.app.policy.SystemPolicy
@@ -606,7 +606,7 @@ func file_app_policy_config_proto_init() {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_app_policy_config_proto_msgTypes[0].Exporter = func(v any, i int) any { file_app_policy_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Second); i { switch v := v.(*Second); i {
case 0: case 0:
return &v.state return &v.state
@@ -618,7 +618,7 @@ func file_app_policy_config_proto_init() {
return nil return nil
} }
} }
file_app_policy_config_proto_msgTypes[1].Exporter = func(v any, i int) any { file_app_policy_config_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Policy); i { switch v := v.(*Policy); i {
case 0: case 0:
return &v.state return &v.state
@@ -630,7 +630,7 @@ func file_app_policy_config_proto_init() {
return nil return nil
} }
} }
file_app_policy_config_proto_msgTypes[2].Exporter = func(v any, i int) any { file_app_policy_config_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SystemPolicy); i { switch v := v.(*SystemPolicy); i {
case 0: case 0:
return &v.state return &v.state
@@ -642,7 +642,7 @@ func file_app_policy_config_proto_init() {
return nil return nil
} }
} }
file_app_policy_config_proto_msgTypes[3].Exporter = func(v any, i int) any { file_app_policy_config_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Config); i { switch v := v.(*Config); i {
case 0: case 0:
return &v.state return &v.state
@@ -654,7 +654,7 @@ func file_app_policy_config_proto_init() {
return nil return nil
} }
} }
file_app_policy_config_proto_msgTypes[4].Exporter = func(v any, i int) any { file_app_policy_config_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Policy_Timeout); i { switch v := v.(*Policy_Timeout); i {
case 0: case 0:
return &v.state return &v.state
@@ -666,7 +666,7 @@ func file_app_policy_config_proto_init() {
return nil return nil
} }
} }
file_app_policy_config_proto_msgTypes[5].Exporter = func(v any, i int) any { file_app_policy_config_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Policy_Stats); i { switch v := v.(*Policy_Stats); i {
case 0: case 0:
return &v.state return &v.state
@@ -678,7 +678,7 @@ func file_app_policy_config_proto_init() {
return nil return nil
} }
} }
file_app_policy_config_proto_msgTypes[6].Exporter = func(v any, i int) any { file_app_policy_config_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Policy_Buffer); i { switch v := v.(*Policy_Buffer); i {
case 0: case 0:
return &v.state return &v.state
@@ -690,7 +690,7 @@ func file_app_policy_config_proto_init() {
return nil return nil
} }
} }
file_app_policy_config_proto_msgTypes[7].Exporter = func(v any, i int) any { file_app_policy_config_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SystemPolicy_Stats); i { switch v := v.(*SystemPolicy_Stats); i {
case 0: case 0:
return &v.state return &v.state

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.34.2 // protoc-gen-go v1.34.1
// protoc v5.27.0 // protoc v5.27.0
// source: app/proxyman/command/command.proto // source: app/proxyman/command/command.proto
@@ -806,7 +806,7 @@ func file_app_proxyman_command_command_proto_rawDescGZIP() []byte {
} }
var file_app_proxyman_command_command_proto_msgTypes = make([]protoimpl.MessageInfo, 15) var file_app_proxyman_command_command_proto_msgTypes = make([]protoimpl.MessageInfo, 15)
var file_app_proxyman_command_command_proto_goTypes = []any{ var file_app_proxyman_command_command_proto_goTypes = []interface{}{
(*AddUserOperation)(nil), // 0: xray.app.proxyman.command.AddUserOperation (*AddUserOperation)(nil), // 0: xray.app.proxyman.command.AddUserOperation
(*RemoveUserOperation)(nil), // 1: xray.app.proxyman.command.RemoveUserOperation (*RemoveUserOperation)(nil), // 1: xray.app.proxyman.command.RemoveUserOperation
(*AddInboundRequest)(nil), // 2: xray.app.proxyman.command.AddInboundRequest (*AddInboundRequest)(nil), // 2: xray.app.proxyman.command.AddInboundRequest
@@ -858,7 +858,7 @@ func file_app_proxyman_command_command_proto_init() {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_app_proxyman_command_command_proto_msgTypes[0].Exporter = func(v any, i int) any { file_app_proxyman_command_command_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AddUserOperation); i { switch v := v.(*AddUserOperation); i {
case 0: case 0:
return &v.state return &v.state
@@ -870,7 +870,7 @@ func file_app_proxyman_command_command_proto_init() {
return nil return nil
} }
} }
file_app_proxyman_command_command_proto_msgTypes[1].Exporter = func(v any, i int) any { file_app_proxyman_command_command_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RemoveUserOperation); i { switch v := v.(*RemoveUserOperation); i {
case 0: case 0:
return &v.state return &v.state
@@ -882,7 +882,7 @@ func file_app_proxyman_command_command_proto_init() {
return nil return nil
} }
} }
file_app_proxyman_command_command_proto_msgTypes[2].Exporter = func(v any, i int) any { file_app_proxyman_command_command_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AddInboundRequest); i { switch v := v.(*AddInboundRequest); i {
case 0: case 0:
return &v.state return &v.state
@@ -894,7 +894,7 @@ func file_app_proxyman_command_command_proto_init() {
return nil return nil
} }
} }
file_app_proxyman_command_command_proto_msgTypes[3].Exporter = func(v any, i int) any { file_app_proxyman_command_command_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AddInboundResponse); i { switch v := v.(*AddInboundResponse); i {
case 0: case 0:
return &v.state return &v.state
@@ -906,7 +906,7 @@ func file_app_proxyman_command_command_proto_init() {
return nil return nil
} }
} }
file_app_proxyman_command_command_proto_msgTypes[4].Exporter = func(v any, i int) any { file_app_proxyman_command_command_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RemoveInboundRequest); i { switch v := v.(*RemoveInboundRequest); i {
case 0: case 0:
return &v.state return &v.state
@@ -918,7 +918,7 @@ func file_app_proxyman_command_command_proto_init() {
return nil return nil
} }
} }
file_app_proxyman_command_command_proto_msgTypes[5].Exporter = func(v any, i int) any { file_app_proxyman_command_command_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RemoveInboundResponse); i { switch v := v.(*RemoveInboundResponse); i {
case 0: case 0:
return &v.state return &v.state
@@ -930,7 +930,7 @@ func file_app_proxyman_command_command_proto_init() {
return nil return nil
} }
} }
file_app_proxyman_command_command_proto_msgTypes[6].Exporter = func(v any, i int) any { file_app_proxyman_command_command_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AlterInboundRequest); i { switch v := v.(*AlterInboundRequest); i {
case 0: case 0:
return &v.state return &v.state
@@ -942,7 +942,7 @@ func file_app_proxyman_command_command_proto_init() {
return nil return nil
} }
} }
file_app_proxyman_command_command_proto_msgTypes[7].Exporter = func(v any, i int) any { file_app_proxyman_command_command_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AlterInboundResponse); i { switch v := v.(*AlterInboundResponse); i {
case 0: case 0:
return &v.state return &v.state
@@ -954,7 +954,7 @@ func file_app_proxyman_command_command_proto_init() {
return nil return nil
} }
} }
file_app_proxyman_command_command_proto_msgTypes[8].Exporter = func(v any, i int) any { file_app_proxyman_command_command_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AddOutboundRequest); i { switch v := v.(*AddOutboundRequest); i {
case 0: case 0:
return &v.state return &v.state
@@ -966,7 +966,7 @@ func file_app_proxyman_command_command_proto_init() {
return nil return nil
} }
} }
file_app_proxyman_command_command_proto_msgTypes[9].Exporter = func(v any, i int) any { file_app_proxyman_command_command_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AddOutboundResponse); i { switch v := v.(*AddOutboundResponse); i {
case 0: case 0:
return &v.state return &v.state
@@ -978,7 +978,7 @@ func file_app_proxyman_command_command_proto_init() {
return nil return nil
} }
} }
file_app_proxyman_command_command_proto_msgTypes[10].Exporter = func(v any, i int) any { file_app_proxyman_command_command_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RemoveOutboundRequest); i { switch v := v.(*RemoveOutboundRequest); i {
case 0: case 0:
return &v.state return &v.state
@@ -990,7 +990,7 @@ func file_app_proxyman_command_command_proto_init() {
return nil return nil
} }
} }
file_app_proxyman_command_command_proto_msgTypes[11].Exporter = func(v any, i int) any { file_app_proxyman_command_command_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RemoveOutboundResponse); i { switch v := v.(*RemoveOutboundResponse); i {
case 0: case 0:
return &v.state return &v.state
@@ -1002,7 +1002,7 @@ func file_app_proxyman_command_command_proto_init() {
return nil return nil
} }
} }
file_app_proxyman_command_command_proto_msgTypes[12].Exporter = func(v any, i int) any { file_app_proxyman_command_command_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AlterOutboundRequest); i { switch v := v.(*AlterOutboundRequest); i {
case 0: case 0:
return &v.state return &v.state
@@ -1014,7 +1014,7 @@ func file_app_proxyman_command_command_proto_init() {
return nil return nil
} }
} }
file_app_proxyman_command_command_proto_msgTypes[13].Exporter = func(v any, i int) any { file_app_proxyman_command_command_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AlterOutboundResponse); i { switch v := v.(*AlterOutboundResponse); i {
case 0: case 0:
return &v.state return &v.state
@@ -1026,7 +1026,7 @@ func file_app_proxyman_command_command_proto_init() {
return nil return nil
} }
} }
file_app_proxyman_command_command_proto_msgTypes[14].Exporter = func(v any, i int) any { file_app_proxyman_command_command_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Config); i { switch v := v.(*Config); i {
case 0: case 0:
return &v.state return &v.state

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT. // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions: // versions:
// - protoc-gen-go-grpc v1.5.1 // - protoc-gen-go-grpc v1.3.0
// - protoc v5.27.0 // - protoc v5.27.0
// source: app/proxyman/command/command.proto // source: app/proxyman/command/command.proto
@@ -15,8 +15,8 @@ import (
// This is a compile-time assertion to ensure that this generated file // This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against. // is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later. // Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion9 const _ = grpc.SupportPackageIsVersion7
const ( const (
HandlerService_AddInbound_FullMethodName = "/xray.app.proxyman.command.HandlerService/AddInbound" HandlerService_AddInbound_FullMethodName = "/xray.app.proxyman.command.HandlerService/AddInbound"
@@ -48,9 +48,8 @@ func NewHandlerServiceClient(cc grpc.ClientConnInterface) HandlerServiceClient {
} }
func (c *handlerServiceClient) AddInbound(ctx context.Context, in *AddInboundRequest, opts ...grpc.CallOption) (*AddInboundResponse, error) { func (c *handlerServiceClient) AddInbound(ctx context.Context, in *AddInboundRequest, opts ...grpc.CallOption) (*AddInboundResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(AddInboundResponse) out := new(AddInboundResponse)
err := c.cc.Invoke(ctx, HandlerService_AddInbound_FullMethodName, in, out, cOpts...) err := c.cc.Invoke(ctx, HandlerService_AddInbound_FullMethodName, in, out, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@@ -58,9 +57,8 @@ func (c *handlerServiceClient) AddInbound(ctx context.Context, in *AddInboundReq
} }
func (c *handlerServiceClient) RemoveInbound(ctx context.Context, in *RemoveInboundRequest, opts ...grpc.CallOption) (*RemoveInboundResponse, error) { func (c *handlerServiceClient) RemoveInbound(ctx context.Context, in *RemoveInboundRequest, opts ...grpc.CallOption) (*RemoveInboundResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(RemoveInboundResponse) out := new(RemoveInboundResponse)
err := c.cc.Invoke(ctx, HandlerService_RemoveInbound_FullMethodName, in, out, cOpts...) err := c.cc.Invoke(ctx, HandlerService_RemoveInbound_FullMethodName, in, out, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@@ -68,9 +66,8 @@ func (c *handlerServiceClient) RemoveInbound(ctx context.Context, in *RemoveInbo
} }
func (c *handlerServiceClient) AlterInbound(ctx context.Context, in *AlterInboundRequest, opts ...grpc.CallOption) (*AlterInboundResponse, error) { func (c *handlerServiceClient) AlterInbound(ctx context.Context, in *AlterInboundRequest, opts ...grpc.CallOption) (*AlterInboundResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(AlterInboundResponse) out := new(AlterInboundResponse)
err := c.cc.Invoke(ctx, HandlerService_AlterInbound_FullMethodName, in, out, cOpts...) err := c.cc.Invoke(ctx, HandlerService_AlterInbound_FullMethodName, in, out, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@@ -78,9 +75,8 @@ func (c *handlerServiceClient) AlterInbound(ctx context.Context, in *AlterInboun
} }
func (c *handlerServiceClient) AddOutbound(ctx context.Context, in *AddOutboundRequest, opts ...grpc.CallOption) (*AddOutboundResponse, error) { func (c *handlerServiceClient) AddOutbound(ctx context.Context, in *AddOutboundRequest, opts ...grpc.CallOption) (*AddOutboundResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(AddOutboundResponse) out := new(AddOutboundResponse)
err := c.cc.Invoke(ctx, HandlerService_AddOutbound_FullMethodName, in, out, cOpts...) err := c.cc.Invoke(ctx, HandlerService_AddOutbound_FullMethodName, in, out, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@@ -88,9 +84,8 @@ func (c *handlerServiceClient) AddOutbound(ctx context.Context, in *AddOutboundR
} }
func (c *handlerServiceClient) RemoveOutbound(ctx context.Context, in *RemoveOutboundRequest, opts ...grpc.CallOption) (*RemoveOutboundResponse, error) { func (c *handlerServiceClient) RemoveOutbound(ctx context.Context, in *RemoveOutboundRequest, opts ...grpc.CallOption) (*RemoveOutboundResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(RemoveOutboundResponse) out := new(RemoveOutboundResponse)
err := c.cc.Invoke(ctx, HandlerService_RemoveOutbound_FullMethodName, in, out, cOpts...) err := c.cc.Invoke(ctx, HandlerService_RemoveOutbound_FullMethodName, in, out, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@@ -98,9 +93,8 @@ func (c *handlerServiceClient) RemoveOutbound(ctx context.Context, in *RemoveOut
} }
func (c *handlerServiceClient) AlterOutbound(ctx context.Context, in *AlterOutboundRequest, opts ...grpc.CallOption) (*AlterOutboundResponse, error) { func (c *handlerServiceClient) AlterOutbound(ctx context.Context, in *AlterOutboundRequest, opts ...grpc.CallOption) (*AlterOutboundResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(AlterOutboundResponse) out := new(AlterOutboundResponse)
err := c.cc.Invoke(ctx, HandlerService_AlterOutbound_FullMethodName, in, out, cOpts...) err := c.cc.Invoke(ctx, HandlerService_AlterOutbound_FullMethodName, in, out, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@@ -109,7 +103,7 @@ func (c *handlerServiceClient) AlterOutbound(ctx context.Context, in *AlterOutbo
// HandlerServiceServer is the server API for HandlerService service. // HandlerServiceServer is the server API for HandlerService service.
// All implementations must embed UnimplementedHandlerServiceServer // All implementations must embed UnimplementedHandlerServiceServer
// for forward compatibility. // for forward compatibility
type HandlerServiceServer interface { type HandlerServiceServer interface {
AddInbound(context.Context, *AddInboundRequest) (*AddInboundResponse, error) AddInbound(context.Context, *AddInboundRequest) (*AddInboundResponse, error)
RemoveInbound(context.Context, *RemoveInboundRequest) (*RemoveInboundResponse, error) RemoveInbound(context.Context, *RemoveInboundRequest) (*RemoveInboundResponse, error)
@@ -120,12 +114,9 @@ type HandlerServiceServer interface {
mustEmbedUnimplementedHandlerServiceServer() mustEmbedUnimplementedHandlerServiceServer()
} }
// UnimplementedHandlerServiceServer must be embedded to have // UnimplementedHandlerServiceServer must be embedded to have forward compatible implementations.
// forward compatible implementations. type UnimplementedHandlerServiceServer struct {
// }
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedHandlerServiceServer struct{}
func (UnimplementedHandlerServiceServer) AddInbound(context.Context, *AddInboundRequest) (*AddInboundResponse, error) { func (UnimplementedHandlerServiceServer) AddInbound(context.Context, *AddInboundRequest) (*AddInboundResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method AddInbound not implemented") return nil, status.Errorf(codes.Unimplemented, "method AddInbound not implemented")
@@ -146,7 +137,6 @@ func (UnimplementedHandlerServiceServer) AlterOutbound(context.Context, *AlterOu
return nil, status.Errorf(codes.Unimplemented, "method AlterOutbound not implemented") return nil, status.Errorf(codes.Unimplemented, "method AlterOutbound not implemented")
} }
func (UnimplementedHandlerServiceServer) mustEmbedUnimplementedHandlerServiceServer() {} func (UnimplementedHandlerServiceServer) mustEmbedUnimplementedHandlerServiceServer() {}
func (UnimplementedHandlerServiceServer) testEmbeddedByValue() {}
// UnsafeHandlerServiceServer may be embedded to opt out of forward compatibility for this service. // UnsafeHandlerServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to HandlerServiceServer will // Use of this interface is not recommended, as added methods to HandlerServiceServer will
@@ -156,13 +146,6 @@ type UnsafeHandlerServiceServer interface {
} }
func RegisterHandlerServiceServer(s grpc.ServiceRegistrar, srv HandlerServiceServer) { func RegisterHandlerServiceServer(s grpc.ServiceRegistrar, srv HandlerServiceServer) {
// If the following call pancis, it indicates UnimplementedHandlerServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&HandlerService_ServiceDesc, srv) s.RegisterService(&HandlerService_ServiceDesc, srv)
} }

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.34.2 // protoc-gen-go v1.34.1
// protoc v5.27.0 // protoc v5.27.0
// source: app/proxyman/config.proto // source: app/proxyman/config.proto
@@ -920,7 +920,7 @@ func file_app_proxyman_config_proto_rawDescGZIP() []byte {
var file_app_proxyman_config_proto_enumTypes = make([]protoimpl.EnumInfo, 2) var file_app_proxyman_config_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
var file_app_proxyman_config_proto_msgTypes = make([]protoimpl.MessageInfo, 10) var file_app_proxyman_config_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
var file_app_proxyman_config_proto_goTypes = []any{ var file_app_proxyman_config_proto_goTypes = []interface{}{
(KnownProtocols)(0), // 0: xray.app.proxyman.KnownProtocols (KnownProtocols)(0), // 0: xray.app.proxyman.KnownProtocols
(AllocationStrategy_Type)(0), // 1: xray.app.proxyman.AllocationStrategy.Type (AllocationStrategy_Type)(0), // 1: xray.app.proxyman.AllocationStrategy.Type
(*InboundConfig)(nil), // 2: xray.app.proxyman.InboundConfig (*InboundConfig)(nil), // 2: xray.app.proxyman.InboundConfig
@@ -968,7 +968,7 @@ func file_app_proxyman_config_proto_init() {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_app_proxyman_config_proto_msgTypes[0].Exporter = func(v any, i int) any { file_app_proxyman_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*InboundConfig); i { switch v := v.(*InboundConfig); i {
case 0: case 0:
return &v.state return &v.state
@@ -980,7 +980,7 @@ func file_app_proxyman_config_proto_init() {
return nil return nil
} }
} }
file_app_proxyman_config_proto_msgTypes[1].Exporter = func(v any, i int) any { file_app_proxyman_config_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AllocationStrategy); i { switch v := v.(*AllocationStrategy); i {
case 0: case 0:
return &v.state return &v.state
@@ -992,7 +992,7 @@ func file_app_proxyman_config_proto_init() {
return nil return nil
} }
} }
file_app_proxyman_config_proto_msgTypes[2].Exporter = func(v any, i int) any { file_app_proxyman_config_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SniffingConfig); i { switch v := v.(*SniffingConfig); i {
case 0: case 0:
return &v.state return &v.state
@@ -1004,7 +1004,7 @@ func file_app_proxyman_config_proto_init() {
return nil return nil
} }
} }
file_app_proxyman_config_proto_msgTypes[3].Exporter = func(v any, i int) any { file_app_proxyman_config_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ReceiverConfig); i { switch v := v.(*ReceiverConfig); i {
case 0: case 0:
return &v.state return &v.state
@@ -1016,7 +1016,7 @@ func file_app_proxyman_config_proto_init() {
return nil return nil
} }
} }
file_app_proxyman_config_proto_msgTypes[4].Exporter = func(v any, i int) any { file_app_proxyman_config_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*InboundHandlerConfig); i { switch v := v.(*InboundHandlerConfig); i {
case 0: case 0:
return &v.state return &v.state
@@ -1028,7 +1028,7 @@ func file_app_proxyman_config_proto_init() {
return nil return nil
} }
} }
file_app_proxyman_config_proto_msgTypes[5].Exporter = func(v any, i int) any { file_app_proxyman_config_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*OutboundConfig); i { switch v := v.(*OutboundConfig); i {
case 0: case 0:
return &v.state return &v.state
@@ -1040,7 +1040,7 @@ func file_app_proxyman_config_proto_init() {
return nil return nil
} }
} }
file_app_proxyman_config_proto_msgTypes[6].Exporter = func(v any, i int) any { file_app_proxyman_config_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SenderConfig); i { switch v := v.(*SenderConfig); i {
case 0: case 0:
return &v.state return &v.state
@@ -1052,7 +1052,7 @@ func file_app_proxyman_config_proto_init() {
return nil return nil
} }
} }
file_app_proxyman_config_proto_msgTypes[7].Exporter = func(v any, i int) any { file_app_proxyman_config_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MultiplexingConfig); i { switch v := v.(*MultiplexingConfig); i {
case 0: case 0:
return &v.state return &v.state
@@ -1064,7 +1064,7 @@ func file_app_proxyman_config_proto_init() {
return nil return nil
} }
} }
file_app_proxyman_config_proto_msgTypes[8].Exporter = func(v any, i int) any { file_app_proxyman_config_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AllocationStrategy_AllocationStrategyConcurrency); i { switch v := v.(*AllocationStrategy_AllocationStrategyConcurrency); i {
case 0: case 0:
return &v.state return &v.state
@@ -1076,7 +1076,7 @@ func file_app_proxyman_config_proto_init() {
return nil return nil
} }
} }
file_app_proxyman_config_proto_msgTypes[9].Exporter = func(v any, i int) any { file_app_proxyman_config_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AllocationStrategy_AllocationStrategyRefresh); i { switch v := v.(*AllocationStrategy_AllocationStrategyRefresh); i {
case 0: case 0:
return &v.state return &v.state

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.34.2 // protoc-gen-go v1.34.1
// protoc v5.27.0 // protoc v5.27.0
// source: app/reverse/config.proto // source: app/reverse/config.proto
@@ -338,7 +338,7 @@ func file_app_reverse_config_proto_rawDescGZIP() []byte {
var file_app_reverse_config_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_app_reverse_config_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_app_reverse_config_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_app_reverse_config_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_app_reverse_config_proto_goTypes = []any{ var file_app_reverse_config_proto_goTypes = []interface{}{
(Control_State)(0), // 0: xray.app.reverse.Control.State (Control_State)(0), // 0: xray.app.reverse.Control.State
(*Control)(nil), // 1: xray.app.reverse.Control (*Control)(nil), // 1: xray.app.reverse.Control
(*BridgeConfig)(nil), // 2: xray.app.reverse.BridgeConfig (*BridgeConfig)(nil), // 2: xray.app.reverse.BridgeConfig
@@ -362,7 +362,7 @@ func file_app_reverse_config_proto_init() {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_app_reverse_config_proto_msgTypes[0].Exporter = func(v any, i int) any { file_app_reverse_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Control); i { switch v := v.(*Control); i {
case 0: case 0:
return &v.state return &v.state
@@ -374,7 +374,7 @@ func file_app_reverse_config_proto_init() {
return nil return nil
} }
} }
file_app_reverse_config_proto_msgTypes[1].Exporter = func(v any, i int) any { file_app_reverse_config_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*BridgeConfig); i { switch v := v.(*BridgeConfig); i {
case 0: case 0:
return &v.state return &v.state
@@ -386,7 +386,7 @@ func file_app_reverse_config_proto_init() {
return nil return nil
} }
} }
file_app_reverse_config_proto_msgTypes[2].Exporter = func(v any, i int) any { file_app_reverse_config_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*PortalConfig); i { switch v := v.(*PortalConfig); i {
case 0: case 0:
return &v.state return &v.state
@@ -398,7 +398,7 @@ func file_app_reverse_config_proto_init() {
return nil return nil
} }
} }
file_app_reverse_config_proto_msgTypes[3].Exporter = func(v any, i int) any { file_app_reverse_config_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Config); i { switch v := v.(*Config); i {
case 0: case 0:
return &v.state return &v.state

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.34.2 // protoc-gen-go v1.34.1
// protoc v5.27.0 // protoc v5.27.0
// source: app/router/command/command.proto // source: app/router/command/command.proto
@@ -1019,7 +1019,7 @@ func file_app_router_command_command_proto_rawDescGZIP() []byte {
} }
var file_app_router_command_command_proto_msgTypes = make([]protoimpl.MessageInfo, 16) var file_app_router_command_command_proto_msgTypes = make([]protoimpl.MessageInfo, 16)
var file_app_router_command_command_proto_goTypes = []any{ var file_app_router_command_command_proto_goTypes = []interface{}{
(*RoutingContext)(nil), // 0: xray.app.router.command.RoutingContext (*RoutingContext)(nil), // 0: xray.app.router.command.RoutingContext
(*SubscribeRoutingStatsRequest)(nil), // 1: xray.app.router.command.SubscribeRoutingStatsRequest (*SubscribeRoutingStatsRequest)(nil), // 1: xray.app.router.command.SubscribeRoutingStatsRequest
(*TestRouteRequest)(nil), // 2: xray.app.router.command.TestRouteRequest (*TestRouteRequest)(nil), // 2: xray.app.router.command.TestRouteRequest
@@ -1072,7 +1072,7 @@ func file_app_router_command_command_proto_init() {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_app_router_command_command_proto_msgTypes[0].Exporter = func(v any, i int) any { file_app_router_command_command_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RoutingContext); i { switch v := v.(*RoutingContext); i {
case 0: case 0:
return &v.state return &v.state
@@ -1084,7 +1084,7 @@ func file_app_router_command_command_proto_init() {
return nil return nil
} }
} }
file_app_router_command_command_proto_msgTypes[1].Exporter = func(v any, i int) any { file_app_router_command_command_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SubscribeRoutingStatsRequest); i { switch v := v.(*SubscribeRoutingStatsRequest); i {
case 0: case 0:
return &v.state return &v.state
@@ -1096,7 +1096,7 @@ func file_app_router_command_command_proto_init() {
return nil return nil
} }
} }
file_app_router_command_command_proto_msgTypes[2].Exporter = func(v any, i int) any { file_app_router_command_command_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TestRouteRequest); i { switch v := v.(*TestRouteRequest); i {
case 0: case 0:
return &v.state return &v.state
@@ -1108,7 +1108,7 @@ func file_app_router_command_command_proto_init() {
return nil return nil
} }
} }
file_app_router_command_command_proto_msgTypes[3].Exporter = func(v any, i int) any { file_app_router_command_command_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*PrincipleTargetInfo); i { switch v := v.(*PrincipleTargetInfo); i {
case 0: case 0:
return &v.state return &v.state
@@ -1120,7 +1120,7 @@ func file_app_router_command_command_proto_init() {
return nil return nil
} }
} }
file_app_router_command_command_proto_msgTypes[4].Exporter = func(v any, i int) any { file_app_router_command_command_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*OverrideInfo); i { switch v := v.(*OverrideInfo); i {
case 0: case 0:
return &v.state return &v.state
@@ -1132,7 +1132,7 @@ func file_app_router_command_command_proto_init() {
return nil return nil
} }
} }
file_app_router_command_command_proto_msgTypes[5].Exporter = func(v any, i int) any { file_app_router_command_command_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*BalancerMsg); i { switch v := v.(*BalancerMsg); i {
case 0: case 0:
return &v.state return &v.state
@@ -1144,7 +1144,7 @@ func file_app_router_command_command_proto_init() {
return nil return nil
} }
} }
file_app_router_command_command_proto_msgTypes[6].Exporter = func(v any, i int) any { file_app_router_command_command_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetBalancerInfoRequest); i { switch v := v.(*GetBalancerInfoRequest); i {
case 0: case 0:
return &v.state return &v.state
@@ -1156,7 +1156,7 @@ func file_app_router_command_command_proto_init() {
return nil return nil
} }
} }
file_app_router_command_command_proto_msgTypes[7].Exporter = func(v any, i int) any { file_app_router_command_command_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetBalancerInfoResponse); i { switch v := v.(*GetBalancerInfoResponse); i {
case 0: case 0:
return &v.state return &v.state
@@ -1168,7 +1168,7 @@ func file_app_router_command_command_proto_init() {
return nil return nil
} }
} }
file_app_router_command_command_proto_msgTypes[8].Exporter = func(v any, i int) any { file_app_router_command_command_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*OverrideBalancerTargetRequest); i { switch v := v.(*OverrideBalancerTargetRequest); i {
case 0: case 0:
return &v.state return &v.state
@@ -1180,7 +1180,7 @@ func file_app_router_command_command_proto_init() {
return nil return nil
} }
} }
file_app_router_command_command_proto_msgTypes[9].Exporter = func(v any, i int) any { file_app_router_command_command_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*OverrideBalancerTargetResponse); i { switch v := v.(*OverrideBalancerTargetResponse); i {
case 0: case 0:
return &v.state return &v.state
@@ -1192,7 +1192,7 @@ func file_app_router_command_command_proto_init() {
return nil return nil
} }
} }
file_app_router_command_command_proto_msgTypes[10].Exporter = func(v any, i int) any { file_app_router_command_command_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AddRuleRequest); i { switch v := v.(*AddRuleRequest); i {
case 0: case 0:
return &v.state return &v.state
@@ -1204,7 +1204,7 @@ func file_app_router_command_command_proto_init() {
return nil return nil
} }
} }
file_app_router_command_command_proto_msgTypes[11].Exporter = func(v any, i int) any { file_app_router_command_command_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AddRuleResponse); i { switch v := v.(*AddRuleResponse); i {
case 0: case 0:
return &v.state return &v.state
@@ -1216,7 +1216,7 @@ func file_app_router_command_command_proto_init() {
return nil return nil
} }
} }
file_app_router_command_command_proto_msgTypes[12].Exporter = func(v any, i int) any { file_app_router_command_command_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RemoveRuleRequest); i { switch v := v.(*RemoveRuleRequest); i {
case 0: case 0:
return &v.state return &v.state
@@ -1228,7 +1228,7 @@ func file_app_router_command_command_proto_init() {
return nil return nil
} }
} }
file_app_router_command_command_proto_msgTypes[13].Exporter = func(v any, i int) any { file_app_router_command_command_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RemoveRuleResponse); i { switch v := v.(*RemoveRuleResponse); i {
case 0: case 0:
return &v.state return &v.state
@@ -1240,7 +1240,7 @@ func file_app_router_command_command_proto_init() {
return nil return nil
} }
} }
file_app_router_command_command_proto_msgTypes[14].Exporter = func(v any, i int) any { file_app_router_command_command_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Config); i { switch v := v.(*Config); i {
case 0: case 0:
return &v.state return &v.state

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT. // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions: // versions:
// - protoc-gen-go-grpc v1.5.1 // - protoc-gen-go-grpc v1.3.0
// - protoc v5.27.0 // - protoc v5.27.0
// source: app/router/command/command.proto // source: app/router/command/command.proto
@@ -15,8 +15,8 @@ import (
// This is a compile-time assertion to ensure that this generated file // This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against. // is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later. // Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion9 const _ = grpc.SupportPackageIsVersion7
const ( const (
RoutingService_SubscribeRoutingStats_FullMethodName = "/xray.app.router.command.RoutingService/SubscribeRoutingStats" RoutingService_SubscribeRoutingStats_FullMethodName = "/xray.app.router.command.RoutingService/SubscribeRoutingStats"
@@ -31,7 +31,7 @@ const (
// //
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type RoutingServiceClient interface { type RoutingServiceClient interface {
SubscribeRoutingStats(ctx context.Context, in *SubscribeRoutingStatsRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[RoutingContext], error) SubscribeRoutingStats(ctx context.Context, in *SubscribeRoutingStatsRequest, opts ...grpc.CallOption) (RoutingService_SubscribeRoutingStatsClient, error)
TestRoute(ctx context.Context, in *TestRouteRequest, opts ...grpc.CallOption) (*RoutingContext, error) TestRoute(ctx context.Context, in *TestRouteRequest, opts ...grpc.CallOption) (*RoutingContext, error)
GetBalancerInfo(ctx context.Context, in *GetBalancerInfoRequest, opts ...grpc.CallOption) (*GetBalancerInfoResponse, error) GetBalancerInfo(ctx context.Context, in *GetBalancerInfoRequest, opts ...grpc.CallOption) (*GetBalancerInfoResponse, error)
OverrideBalancerTarget(ctx context.Context, in *OverrideBalancerTargetRequest, opts ...grpc.CallOption) (*OverrideBalancerTargetResponse, error) OverrideBalancerTarget(ctx context.Context, in *OverrideBalancerTargetRequest, opts ...grpc.CallOption) (*OverrideBalancerTargetResponse, error)
@@ -47,13 +47,12 @@ func NewRoutingServiceClient(cc grpc.ClientConnInterface) RoutingServiceClient {
return &routingServiceClient{cc} return &routingServiceClient{cc}
} }
func (c *routingServiceClient) SubscribeRoutingStats(ctx context.Context, in *SubscribeRoutingStatsRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[RoutingContext], error) { func (c *routingServiceClient) SubscribeRoutingStats(ctx context.Context, in *SubscribeRoutingStatsRequest, opts ...grpc.CallOption) (RoutingService_SubscribeRoutingStatsClient, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &RoutingService_ServiceDesc.Streams[0], RoutingService_SubscribeRoutingStats_FullMethodName, opts...)
stream, err := c.cc.NewStream(ctx, &RoutingService_ServiceDesc.Streams[0], RoutingService_SubscribeRoutingStats_FullMethodName, cOpts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
x := &grpc.GenericClientStream[SubscribeRoutingStatsRequest, RoutingContext]{ClientStream: stream} x := &routingServiceSubscribeRoutingStatsClient{stream}
if err := x.ClientStream.SendMsg(in); err != nil { if err := x.ClientStream.SendMsg(in); err != nil {
return nil, err return nil, err
} }
@@ -63,13 +62,26 @@ func (c *routingServiceClient) SubscribeRoutingStats(ctx context.Context, in *Su
return x, nil return x, nil
} }
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. type RoutingService_SubscribeRoutingStatsClient interface {
type RoutingService_SubscribeRoutingStatsClient = grpc.ServerStreamingClient[RoutingContext] Recv() (*RoutingContext, error)
grpc.ClientStream
}
type routingServiceSubscribeRoutingStatsClient struct {
grpc.ClientStream
}
func (x *routingServiceSubscribeRoutingStatsClient) Recv() (*RoutingContext, error) {
m := new(RoutingContext)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func (c *routingServiceClient) TestRoute(ctx context.Context, in *TestRouteRequest, opts ...grpc.CallOption) (*RoutingContext, error) { func (c *routingServiceClient) TestRoute(ctx context.Context, in *TestRouteRequest, opts ...grpc.CallOption) (*RoutingContext, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(RoutingContext) out := new(RoutingContext)
err := c.cc.Invoke(ctx, RoutingService_TestRoute_FullMethodName, in, out, cOpts...) err := c.cc.Invoke(ctx, RoutingService_TestRoute_FullMethodName, in, out, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@@ -77,9 +89,8 @@ func (c *routingServiceClient) TestRoute(ctx context.Context, in *TestRouteReque
} }
func (c *routingServiceClient) GetBalancerInfo(ctx context.Context, in *GetBalancerInfoRequest, opts ...grpc.CallOption) (*GetBalancerInfoResponse, error) { func (c *routingServiceClient) GetBalancerInfo(ctx context.Context, in *GetBalancerInfoRequest, opts ...grpc.CallOption) (*GetBalancerInfoResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetBalancerInfoResponse) out := new(GetBalancerInfoResponse)
err := c.cc.Invoke(ctx, RoutingService_GetBalancerInfo_FullMethodName, in, out, cOpts...) err := c.cc.Invoke(ctx, RoutingService_GetBalancerInfo_FullMethodName, in, out, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@@ -87,9 +98,8 @@ func (c *routingServiceClient) GetBalancerInfo(ctx context.Context, in *GetBalan
} }
func (c *routingServiceClient) OverrideBalancerTarget(ctx context.Context, in *OverrideBalancerTargetRequest, opts ...grpc.CallOption) (*OverrideBalancerTargetResponse, error) { func (c *routingServiceClient) OverrideBalancerTarget(ctx context.Context, in *OverrideBalancerTargetRequest, opts ...grpc.CallOption) (*OverrideBalancerTargetResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(OverrideBalancerTargetResponse) out := new(OverrideBalancerTargetResponse)
err := c.cc.Invoke(ctx, RoutingService_OverrideBalancerTarget_FullMethodName, in, out, cOpts...) err := c.cc.Invoke(ctx, RoutingService_OverrideBalancerTarget_FullMethodName, in, out, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@@ -97,9 +107,8 @@ func (c *routingServiceClient) OverrideBalancerTarget(ctx context.Context, in *O
} }
func (c *routingServiceClient) AddRule(ctx context.Context, in *AddRuleRequest, opts ...grpc.CallOption) (*AddRuleResponse, error) { func (c *routingServiceClient) AddRule(ctx context.Context, in *AddRuleRequest, opts ...grpc.CallOption) (*AddRuleResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(AddRuleResponse) out := new(AddRuleResponse)
err := c.cc.Invoke(ctx, RoutingService_AddRule_FullMethodName, in, out, cOpts...) err := c.cc.Invoke(ctx, RoutingService_AddRule_FullMethodName, in, out, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@@ -107,9 +116,8 @@ func (c *routingServiceClient) AddRule(ctx context.Context, in *AddRuleRequest,
} }
func (c *routingServiceClient) RemoveRule(ctx context.Context, in *RemoveRuleRequest, opts ...grpc.CallOption) (*RemoveRuleResponse, error) { func (c *routingServiceClient) RemoveRule(ctx context.Context, in *RemoveRuleRequest, opts ...grpc.CallOption) (*RemoveRuleResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(RemoveRuleResponse) out := new(RemoveRuleResponse)
err := c.cc.Invoke(ctx, RoutingService_RemoveRule_FullMethodName, in, out, cOpts...) err := c.cc.Invoke(ctx, RoutingService_RemoveRule_FullMethodName, in, out, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@@ -118,9 +126,9 @@ func (c *routingServiceClient) RemoveRule(ctx context.Context, in *RemoveRuleReq
// RoutingServiceServer is the server API for RoutingService service. // RoutingServiceServer is the server API for RoutingService service.
// All implementations must embed UnimplementedRoutingServiceServer // All implementations must embed UnimplementedRoutingServiceServer
// for forward compatibility. // for forward compatibility
type RoutingServiceServer interface { type RoutingServiceServer interface {
SubscribeRoutingStats(*SubscribeRoutingStatsRequest, grpc.ServerStreamingServer[RoutingContext]) error SubscribeRoutingStats(*SubscribeRoutingStatsRequest, RoutingService_SubscribeRoutingStatsServer) error
TestRoute(context.Context, *TestRouteRequest) (*RoutingContext, error) TestRoute(context.Context, *TestRouteRequest) (*RoutingContext, error)
GetBalancerInfo(context.Context, *GetBalancerInfoRequest) (*GetBalancerInfoResponse, error) GetBalancerInfo(context.Context, *GetBalancerInfoRequest) (*GetBalancerInfoResponse, error)
OverrideBalancerTarget(context.Context, *OverrideBalancerTargetRequest) (*OverrideBalancerTargetResponse, error) OverrideBalancerTarget(context.Context, *OverrideBalancerTargetRequest) (*OverrideBalancerTargetResponse, error)
@@ -129,14 +137,11 @@ type RoutingServiceServer interface {
mustEmbedUnimplementedRoutingServiceServer() mustEmbedUnimplementedRoutingServiceServer()
} }
// UnimplementedRoutingServiceServer must be embedded to have // UnimplementedRoutingServiceServer must be embedded to have forward compatible implementations.
// forward compatible implementations. type UnimplementedRoutingServiceServer struct {
// }
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedRoutingServiceServer struct{}
func (UnimplementedRoutingServiceServer) SubscribeRoutingStats(*SubscribeRoutingStatsRequest, grpc.ServerStreamingServer[RoutingContext]) error { func (UnimplementedRoutingServiceServer) SubscribeRoutingStats(*SubscribeRoutingStatsRequest, RoutingService_SubscribeRoutingStatsServer) error {
return status.Errorf(codes.Unimplemented, "method SubscribeRoutingStats not implemented") return status.Errorf(codes.Unimplemented, "method SubscribeRoutingStats not implemented")
} }
func (UnimplementedRoutingServiceServer) TestRoute(context.Context, *TestRouteRequest) (*RoutingContext, error) { func (UnimplementedRoutingServiceServer) TestRoute(context.Context, *TestRouteRequest) (*RoutingContext, error) {
@@ -155,7 +160,6 @@ func (UnimplementedRoutingServiceServer) RemoveRule(context.Context, *RemoveRule
return nil, status.Errorf(codes.Unimplemented, "method RemoveRule not implemented") return nil, status.Errorf(codes.Unimplemented, "method RemoveRule not implemented")
} }
func (UnimplementedRoutingServiceServer) mustEmbedUnimplementedRoutingServiceServer() {} func (UnimplementedRoutingServiceServer) mustEmbedUnimplementedRoutingServiceServer() {}
func (UnimplementedRoutingServiceServer) testEmbeddedByValue() {}
// UnsafeRoutingServiceServer may be embedded to opt out of forward compatibility for this service. // UnsafeRoutingServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to RoutingServiceServer will // Use of this interface is not recommended, as added methods to RoutingServiceServer will
@@ -165,13 +169,6 @@ type UnsafeRoutingServiceServer interface {
} }
func RegisterRoutingServiceServer(s grpc.ServiceRegistrar, srv RoutingServiceServer) { func RegisterRoutingServiceServer(s grpc.ServiceRegistrar, srv RoutingServiceServer) {
// If the following call pancis, it indicates UnimplementedRoutingServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&RoutingService_ServiceDesc, srv) s.RegisterService(&RoutingService_ServiceDesc, srv)
} }
@@ -180,11 +177,21 @@ func _RoutingService_SubscribeRoutingStats_Handler(srv interface{}, stream grpc.
if err := stream.RecvMsg(m); err != nil { if err := stream.RecvMsg(m); err != nil {
return err return err
} }
return srv.(RoutingServiceServer).SubscribeRoutingStats(m, &grpc.GenericServerStream[SubscribeRoutingStatsRequest, RoutingContext]{ServerStream: stream}) return srv.(RoutingServiceServer).SubscribeRoutingStats(m, &routingServiceSubscribeRoutingStatsServer{stream})
} }
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. type RoutingService_SubscribeRoutingStatsServer interface {
type RoutingService_SubscribeRoutingStatsServer = grpc.ServerStreamingServer[RoutingContext] Send(*RoutingContext) error
grpc.ServerStream
}
type routingServiceSubscribeRoutingStatsServer struct {
grpc.ServerStream
}
func (x *routingServiceSubscribeRoutingStatsServer) Send(m *RoutingContext) error {
return x.ServerStream.SendMsg(m)
}
func _RoutingService_TestRoute_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { func _RoutingService_TestRoute_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(TestRouteRequest) in := new(TestRouteRequest)

View File

@@ -272,7 +272,7 @@ func TestServiceSubscribeSubsetOfFields(t *testing.T) {
} }
} }
func TestServiceTestRoute(t *testing.T) { func TestSerivceTestRoute(t *testing.T) {
c := stats.NewChannel(&stats.ChannelConfig{ c := stats.NewChannel(&stats.ChannelConfig{
SubscriberLimit: 1, SubscriberLimit: 1,
BufferSize: 16, BufferSize: 16,

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.34.2 // protoc-gen-go v1.34.1
// protoc v5.27.0 // protoc v5.27.0
// source: app/router/config.proto // source: app/router/config.proto
@@ -1275,7 +1275,7 @@ func file_app_router_config_proto_rawDescGZIP() []byte {
var file_app_router_config_proto_enumTypes = make([]protoimpl.EnumInfo, 2) var file_app_router_config_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
var file_app_router_config_proto_msgTypes = make([]protoimpl.MessageInfo, 13) var file_app_router_config_proto_msgTypes = make([]protoimpl.MessageInfo, 13)
var file_app_router_config_proto_goTypes = []any{ var file_app_router_config_proto_goTypes = []interface{}{
(Domain_Type)(0), // 0: xray.app.router.Domain.Type (Domain_Type)(0), // 0: xray.app.router.Domain.Type
(Config_DomainStrategy)(0), // 1: xray.app.router.Config.DomainStrategy (Config_DomainStrategy)(0), // 1: xray.app.router.Config.DomainStrategy
(*Domain)(nil), // 2: xray.app.router.Domain (*Domain)(nil), // 2: xray.app.router.Domain
@@ -1333,7 +1333,7 @@ func file_app_router_config_proto_init() {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_app_router_config_proto_msgTypes[0].Exporter = func(v any, i int) any { file_app_router_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Domain); i { switch v := v.(*Domain); i {
case 0: case 0:
return &v.state return &v.state
@@ -1345,7 +1345,7 @@ func file_app_router_config_proto_init() {
return nil return nil
} }
} }
file_app_router_config_proto_msgTypes[1].Exporter = func(v any, i int) any { file_app_router_config_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CIDR); i { switch v := v.(*CIDR); i {
case 0: case 0:
return &v.state return &v.state
@@ -1357,7 +1357,7 @@ func file_app_router_config_proto_init() {
return nil return nil
} }
} }
file_app_router_config_proto_msgTypes[2].Exporter = func(v any, i int) any { file_app_router_config_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GeoIP); i { switch v := v.(*GeoIP); i {
case 0: case 0:
return &v.state return &v.state
@@ -1369,7 +1369,7 @@ func file_app_router_config_proto_init() {
return nil return nil
} }
} }
file_app_router_config_proto_msgTypes[3].Exporter = func(v any, i int) any { file_app_router_config_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GeoIPList); i { switch v := v.(*GeoIPList); i {
case 0: case 0:
return &v.state return &v.state
@@ -1381,7 +1381,7 @@ func file_app_router_config_proto_init() {
return nil return nil
} }
} }
file_app_router_config_proto_msgTypes[4].Exporter = func(v any, i int) any { file_app_router_config_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GeoSite); i { switch v := v.(*GeoSite); i {
case 0: case 0:
return &v.state return &v.state
@@ -1393,7 +1393,7 @@ func file_app_router_config_proto_init() {
return nil return nil
} }
} }
file_app_router_config_proto_msgTypes[5].Exporter = func(v any, i int) any { file_app_router_config_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GeoSiteList); i { switch v := v.(*GeoSiteList); i {
case 0: case 0:
return &v.state return &v.state
@@ -1405,7 +1405,7 @@ func file_app_router_config_proto_init() {
return nil return nil
} }
} }
file_app_router_config_proto_msgTypes[6].Exporter = func(v any, i int) any { file_app_router_config_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RoutingRule); i { switch v := v.(*RoutingRule); i {
case 0: case 0:
return &v.state return &v.state
@@ -1417,7 +1417,7 @@ func file_app_router_config_proto_init() {
return nil return nil
} }
} }
file_app_router_config_proto_msgTypes[7].Exporter = func(v any, i int) any { file_app_router_config_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*BalancingRule); i { switch v := v.(*BalancingRule); i {
case 0: case 0:
return &v.state return &v.state
@@ -1429,7 +1429,7 @@ func file_app_router_config_proto_init() {
return nil return nil
} }
} }
file_app_router_config_proto_msgTypes[8].Exporter = func(v any, i int) any { file_app_router_config_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*StrategyWeight); i { switch v := v.(*StrategyWeight); i {
case 0: case 0:
return &v.state return &v.state
@@ -1441,7 +1441,7 @@ func file_app_router_config_proto_init() {
return nil return nil
} }
} }
file_app_router_config_proto_msgTypes[9].Exporter = func(v any, i int) any { file_app_router_config_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*StrategyLeastLoadConfig); i { switch v := v.(*StrategyLeastLoadConfig); i {
case 0: case 0:
return &v.state return &v.state
@@ -1453,7 +1453,7 @@ func file_app_router_config_proto_init() {
return nil return nil
} }
} }
file_app_router_config_proto_msgTypes[10].Exporter = func(v any, i int) any { file_app_router_config_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Config); i { switch v := v.(*Config); i {
case 0: case 0:
return &v.state return &v.state
@@ -1465,7 +1465,7 @@ func file_app_router_config_proto_init() {
return nil return nil
} }
} }
file_app_router_config_proto_msgTypes[11].Exporter = func(v any, i int) any { file_app_router_config_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Domain_Attribute); i { switch v := v.(*Domain_Attribute); i {
case 0: case 0:
return &v.state return &v.state
@@ -1478,11 +1478,11 @@ func file_app_router_config_proto_init() {
} }
} }
} }
file_app_router_config_proto_msgTypes[6].OneofWrappers = []any{ file_app_router_config_proto_msgTypes[6].OneofWrappers = []interface{}{
(*RoutingRule_Tag)(nil), (*RoutingRule_Tag)(nil),
(*RoutingRule_BalancingTag)(nil), (*RoutingRule_BalancingTag)(nil),
} }
file_app_router_config_proto_msgTypes[11].OneofWrappers = []any{ file_app_router_config_proto_msgTypes[11].OneofWrappers = []interface{}{
(*Domain_Attribute_BoolValue)(nil), (*Domain_Attribute_BoolValue)(nil),
(*Domain_Attribute_IntValue)(nil), (*Domain_Attribute_IntValue)(nil),
} }

View File

@@ -95,7 +95,7 @@ func TestStatsChannel(t *testing.T) {
} }
} }
func TestStatsChannelUnsubscribe(t *testing.T) { func TestStatsChannelUnsubcribe(t *testing.T) {
c := NewChannel(&ChannelConfig{Blocking: true}) c := NewChannel(&ChannelConfig{Blocking: true})
common.Must(c.Start()) common.Must(c.Start())
defer c.Close() defer c.Close()
@@ -203,7 +203,7 @@ func TestStatsChannelBlocking(t *testing.T) {
// Test blocking channel publishing // Test blocking channel publishing
go func() { go func() {
// Dummy message with no subscriber receiving, will block broadcasting goroutine // Dummy messsage with no subscriber receiving, will block broadcasting goroutine
c.Publish(context.Background(), nil) c.Publish(context.Background(), nil)
<-pauseCh <-pauseCh

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.34.2 // protoc-gen-go v1.34.1
// protoc v5.27.0 // protoc v5.27.0
// source: app/stats/command/command.proto // source: app/stats/command/command.proto
@@ -565,7 +565,7 @@ func file_app_stats_command_command_proto_rawDescGZIP() []byte {
} }
var file_app_stats_command_command_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_app_stats_command_command_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
var file_app_stats_command_command_proto_goTypes = []any{ var file_app_stats_command_command_proto_goTypes = []interface{}{
(*GetStatsRequest)(nil), // 0: xray.app.stats.command.GetStatsRequest (*GetStatsRequest)(nil), // 0: xray.app.stats.command.GetStatsRequest
(*Stat)(nil), // 1: xray.app.stats.command.Stat (*Stat)(nil), // 1: xray.app.stats.command.Stat
(*GetStatsResponse)(nil), // 2: xray.app.stats.command.GetStatsResponse (*GetStatsResponse)(nil), // 2: xray.app.stats.command.GetStatsResponse
@@ -597,7 +597,7 @@ func file_app_stats_command_command_proto_init() {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_app_stats_command_command_proto_msgTypes[0].Exporter = func(v any, i int) any { file_app_stats_command_command_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetStatsRequest); i { switch v := v.(*GetStatsRequest); i {
case 0: case 0:
return &v.state return &v.state
@@ -609,7 +609,7 @@ func file_app_stats_command_command_proto_init() {
return nil return nil
} }
} }
file_app_stats_command_command_proto_msgTypes[1].Exporter = func(v any, i int) any { file_app_stats_command_command_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Stat); i { switch v := v.(*Stat); i {
case 0: case 0:
return &v.state return &v.state
@@ -621,7 +621,7 @@ func file_app_stats_command_command_proto_init() {
return nil return nil
} }
} }
file_app_stats_command_command_proto_msgTypes[2].Exporter = func(v any, i int) any { file_app_stats_command_command_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetStatsResponse); i { switch v := v.(*GetStatsResponse); i {
case 0: case 0:
return &v.state return &v.state
@@ -633,7 +633,7 @@ func file_app_stats_command_command_proto_init() {
return nil return nil
} }
} }
file_app_stats_command_command_proto_msgTypes[3].Exporter = func(v any, i int) any { file_app_stats_command_command_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*QueryStatsRequest); i { switch v := v.(*QueryStatsRequest); i {
case 0: case 0:
return &v.state return &v.state
@@ -645,7 +645,7 @@ func file_app_stats_command_command_proto_init() {
return nil return nil
} }
} }
file_app_stats_command_command_proto_msgTypes[4].Exporter = func(v any, i int) any { file_app_stats_command_command_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*QueryStatsResponse); i { switch v := v.(*QueryStatsResponse); i {
case 0: case 0:
return &v.state return &v.state
@@ -657,7 +657,7 @@ func file_app_stats_command_command_proto_init() {
return nil return nil
} }
} }
file_app_stats_command_command_proto_msgTypes[5].Exporter = func(v any, i int) any { file_app_stats_command_command_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SysStatsRequest); i { switch v := v.(*SysStatsRequest); i {
case 0: case 0:
return &v.state return &v.state
@@ -669,7 +669,7 @@ func file_app_stats_command_command_proto_init() {
return nil return nil
} }
} }
file_app_stats_command_command_proto_msgTypes[6].Exporter = func(v any, i int) any { file_app_stats_command_command_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SysStatsResponse); i { switch v := v.(*SysStatsResponse); i {
case 0: case 0:
return &v.state return &v.state
@@ -681,7 +681,7 @@ func file_app_stats_command_command_proto_init() {
return nil return nil
} }
} }
file_app_stats_command_command_proto_msgTypes[7].Exporter = func(v any, i int) any { file_app_stats_command_command_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Config); i { switch v := v.(*Config); i {
case 0: case 0:
return &v.state return &v.state

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT. // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions: // versions:
// - protoc-gen-go-grpc v1.5.1 // - protoc-gen-go-grpc v1.3.0
// - protoc v5.27.0 // - protoc v5.27.0
// source: app/stats/command/command.proto // source: app/stats/command/command.proto
@@ -15,8 +15,8 @@ import (
// This is a compile-time assertion to ensure that this generated file // This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against. // is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later. // Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion9 const _ = grpc.SupportPackageIsVersion7
const ( const (
StatsService_GetStats_FullMethodName = "/xray.app.stats.command.StatsService/GetStats" StatsService_GetStats_FullMethodName = "/xray.app.stats.command.StatsService/GetStats"
@@ -42,9 +42,8 @@ func NewStatsServiceClient(cc grpc.ClientConnInterface) StatsServiceClient {
} }
func (c *statsServiceClient) GetStats(ctx context.Context, in *GetStatsRequest, opts ...grpc.CallOption) (*GetStatsResponse, error) { func (c *statsServiceClient) GetStats(ctx context.Context, in *GetStatsRequest, opts ...grpc.CallOption) (*GetStatsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetStatsResponse) out := new(GetStatsResponse)
err := c.cc.Invoke(ctx, StatsService_GetStats_FullMethodName, in, out, cOpts...) err := c.cc.Invoke(ctx, StatsService_GetStats_FullMethodName, in, out, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@@ -52,9 +51,8 @@ func (c *statsServiceClient) GetStats(ctx context.Context, in *GetStatsRequest,
} }
func (c *statsServiceClient) QueryStats(ctx context.Context, in *QueryStatsRequest, opts ...grpc.CallOption) (*QueryStatsResponse, error) { func (c *statsServiceClient) QueryStats(ctx context.Context, in *QueryStatsRequest, opts ...grpc.CallOption) (*QueryStatsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryStatsResponse) out := new(QueryStatsResponse)
err := c.cc.Invoke(ctx, StatsService_QueryStats_FullMethodName, in, out, cOpts...) err := c.cc.Invoke(ctx, StatsService_QueryStats_FullMethodName, in, out, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@@ -62,9 +60,8 @@ func (c *statsServiceClient) QueryStats(ctx context.Context, in *QueryStatsReque
} }
func (c *statsServiceClient) GetSysStats(ctx context.Context, in *SysStatsRequest, opts ...grpc.CallOption) (*SysStatsResponse, error) { func (c *statsServiceClient) GetSysStats(ctx context.Context, in *SysStatsRequest, opts ...grpc.CallOption) (*SysStatsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(SysStatsResponse) out := new(SysStatsResponse)
err := c.cc.Invoke(ctx, StatsService_GetSysStats_FullMethodName, in, out, cOpts...) err := c.cc.Invoke(ctx, StatsService_GetSysStats_FullMethodName, in, out, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@@ -73,7 +70,7 @@ func (c *statsServiceClient) GetSysStats(ctx context.Context, in *SysStatsReques
// StatsServiceServer is the server API for StatsService service. // StatsServiceServer is the server API for StatsService service.
// All implementations must embed UnimplementedStatsServiceServer // All implementations must embed UnimplementedStatsServiceServer
// for forward compatibility. // for forward compatibility
type StatsServiceServer interface { type StatsServiceServer interface {
GetStats(context.Context, *GetStatsRequest) (*GetStatsResponse, error) GetStats(context.Context, *GetStatsRequest) (*GetStatsResponse, error)
QueryStats(context.Context, *QueryStatsRequest) (*QueryStatsResponse, error) QueryStats(context.Context, *QueryStatsRequest) (*QueryStatsResponse, error)
@@ -81,12 +78,9 @@ type StatsServiceServer interface {
mustEmbedUnimplementedStatsServiceServer() mustEmbedUnimplementedStatsServiceServer()
} }
// UnimplementedStatsServiceServer must be embedded to have // UnimplementedStatsServiceServer must be embedded to have forward compatible implementations.
// forward compatible implementations. type UnimplementedStatsServiceServer struct {
// }
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedStatsServiceServer struct{}
func (UnimplementedStatsServiceServer) GetStats(context.Context, *GetStatsRequest) (*GetStatsResponse, error) { func (UnimplementedStatsServiceServer) GetStats(context.Context, *GetStatsRequest) (*GetStatsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetStats not implemented") return nil, status.Errorf(codes.Unimplemented, "method GetStats not implemented")
@@ -98,7 +92,6 @@ func (UnimplementedStatsServiceServer) GetSysStats(context.Context, *SysStatsReq
return nil, status.Errorf(codes.Unimplemented, "method GetSysStats not implemented") return nil, status.Errorf(codes.Unimplemented, "method GetSysStats not implemented")
} }
func (UnimplementedStatsServiceServer) mustEmbedUnimplementedStatsServiceServer() {} func (UnimplementedStatsServiceServer) mustEmbedUnimplementedStatsServiceServer() {}
func (UnimplementedStatsServiceServer) testEmbeddedByValue() {}
// UnsafeStatsServiceServer may be embedded to opt out of forward compatibility for this service. // UnsafeStatsServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to StatsServiceServer will // Use of this interface is not recommended, as added methods to StatsServiceServer will
@@ -108,13 +101,6 @@ type UnsafeStatsServiceServer interface {
} }
func RegisterStatsServiceServer(s grpc.ServiceRegistrar, srv StatsServiceServer) { func RegisterStatsServiceServer(s grpc.ServiceRegistrar, srv StatsServiceServer) {
// If the following call pancis, it indicates UnimplementedStatsServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&StatsService_ServiceDesc, srv) s.RegisterService(&StatsService_ServiceDesc, srv)
} }

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.34.2 // protoc-gen-go v1.34.1
// protoc v5.27.0 // protoc v5.27.0
// source: app/stats/config.proto // source: app/stats/config.proto
@@ -155,7 +155,7 @@ func file_app_stats_config_proto_rawDescGZIP() []byte {
} }
var file_app_stats_config_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_app_stats_config_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_app_stats_config_proto_goTypes = []any{ var file_app_stats_config_proto_goTypes = []interface{}{
(*Config)(nil), // 0: xray.app.stats.Config (*Config)(nil), // 0: xray.app.stats.Config
(*ChannelConfig)(nil), // 1: xray.app.stats.ChannelConfig (*ChannelConfig)(nil), // 1: xray.app.stats.ChannelConfig
} }
@@ -173,7 +173,7 @@ func file_app_stats_config_proto_init() {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_app_stats_config_proto_msgTypes[0].Exporter = func(v any, i int) any { file_app_stats_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Config); i { switch v := v.(*Config); i {
case 0: case 0:
return &v.state return &v.state
@@ -185,7 +185,7 @@ func file_app_stats_config_proto_init() {
return nil return nil
} }
} }
file_app_stats_config_proto_msgTypes[1].Exporter = func(v any, i int) any { file_app_stats_config_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ChannelConfig); i { switch v := v.(*ChannelConfig); i {
case 0: case 0:
return &v.state return &v.state

View File

@@ -18,7 +18,7 @@ func TestStatsCounter(t *testing.T) {
common.Must(err) common.Must(err)
if v := c.Add(1); v != 1 { if v := c.Add(1); v != 1 {
t.Fatal("unexpected Add(1) return: ", v, ", wanted ", 1) t.Fatal("unpexcted Add(1) return: ", v, ", wanted ", 1)
} }
if v := c.Set(0); v != 1 { if v := c.Set(0); v != 1 {

View File

@@ -106,7 +106,7 @@ func TestMultiBufferReadAllToByte(t *testing.T) {
common.Must(err) common.Must(err)
if l := len(b); l != 8*1024 { if l := len(b); l != 8*1024 {
t.Error("unexpected length from ReadAllToBytes", l) t.Error("unexpceted length from ReadAllToBytes", l)
} }
} }
{ {
@@ -139,7 +139,7 @@ func TestMultiBufferCopy(t *testing.T) {
mb.Copy(lbdst) mb.Copy(lbdst)
if d := cmp.Diff(lb, lbdst); d != "" { if d := cmp.Diff(lb, lbdst); d != "" {
t.Error("unexpected different from MultiBufferCopy ", d) t.Error("unexpceted different from MultiBufferCopy ", d)
} }
} }

View File

@@ -41,8 +41,8 @@ type BufferedReader struct {
Reader Reader Reader Reader
// Buffer is the internal buffer to be read from first // Buffer is the internal buffer to be read from first
Buffer MultiBuffer Buffer MultiBuffer
// Splitter is a function to read bytes from MultiBuffer // Spliter is a function to read bytes from MultiBuffer
Splitter func(MultiBuffer, []byte) (MultiBuffer, int) Spliter func(MultiBuffer, []byte) (MultiBuffer, int)
} }
// BufferedBytes returns the number of bytes that is cached in this reader. // BufferedBytes returns the number of bytes that is cached in this reader.
@@ -59,7 +59,7 @@ func (r *BufferedReader) ReadByte() (byte, error) {
// Read implements io.Reader. It reads from internal buffer first (if available) and then reads from the underlying reader. // Read implements io.Reader. It reads from internal buffer first (if available) and then reads from the underlying reader.
func (r *BufferedReader) Read(b []byte) (int, error) { func (r *BufferedReader) Read(b []byte) (int, error) {
spliter := r.Splitter spliter := r.Spliter
if spliter == nil { if spliter == nil {
spliter = SplitBytes spliter = SplitBytes
} }

View File

@@ -151,7 +151,7 @@ func LogInfo(ctx context.Context, msg ...interface{}) {
} }
func LogInfoInner(ctx context.Context, inner error, msg ...interface{}) { func LogInfoInner(ctx context.Context, inner error, msg ...interface{}) {
doLog(ctx, inner, log.Severity_Info, msg...) doLog(ctx, inner, log.Severity_Debug, msg...)
} }
func LogWarning(ctx context.Context, msg ...interface{}) { func LogWarning(ctx context.Context, msg ...interface{}) {
@@ -159,7 +159,7 @@ func LogWarning(ctx context.Context, msg ...interface{}) {
} }
func LogWarningInner(ctx context.Context, inner error, msg ...interface{}) { func LogWarningInner(ctx context.Context, inner error, msg ...interface{}) {
doLog(ctx, inner, log.Severity_Warning, msg...) doLog(ctx, inner, log.Severity_Debug, msg...)
} }
func LogError(ctx context.Context, msg ...interface{}) { func LogError(ctx context.Context, msg ...interface{}) {
@@ -167,7 +167,7 @@ func LogError(ctx context.Context, msg ...interface{}) {
} }
func LogErrorInner(ctx context.Context, inner error, msg ...interface{}) { func LogErrorInner(ctx context.Context, inner error, msg ...interface{}) {
doLog(ctx, inner, log.Severity_Error, msg...) doLog(ctx, inner, log.Severity_Debug, msg...)
} }
func doLog(ctx context.Context, inner error, severity log.Severity, msg ...interface{}) { func doLog(ctx context.Context, inner error, severity log.Severity, msg ...interface{}) {

View File

@@ -31,8 +31,6 @@ type AccessMessage struct {
func (m *AccessMessage) String() string { func (m *AccessMessage) String() string {
builder := strings.Builder{} builder := strings.Builder{}
builder.WriteString("from")
builder.WriteByte(' ')
builder.WriteString(serial.ToString(m.From)) builder.WriteString(serial.ToString(m.From))
builder.WriteByte(' ') builder.WriteByte(' ')
builder.WriteString(string(m.Status)) builder.WriteString(string(m.Status))

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.34.2 // protoc-gen-go v1.34.1
// protoc v5.27.0 // protoc v5.27.0
// source: common/log/log.proto // source: common/log/log.proto
@@ -106,7 +106,7 @@ func file_common_log_log_proto_rawDescGZIP() []byte {
} }
var file_common_log_log_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_common_log_log_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_common_log_log_proto_goTypes = []any{ var file_common_log_log_proto_goTypes = []interface{}{
(Severity)(0), // 0: xray.common.log.Severity (Severity)(0), // 0: xray.common.log.Severity
} }
var file_common_log_log_proto_depIdxs = []int32{ var file_common_log_log_proto_depIdxs = []int32{

View File

@@ -22,7 +22,7 @@ import (
) )
type ClientManager struct { type ClientManager struct {
Enabled bool // whether mux is enabled from user config Enabled bool // wheather mux is enabled from user config
Picker WorkerPicker Picker WorkerPicker
} }

View File

@@ -118,9 +118,6 @@ func (w *ServerWorker) handleStatusKeepAlive(meta *FrameMetadata, reader *buf.Bu
} }
func (w *ServerWorker) handleStatusNew(ctx context.Context, meta *FrameMetadata, reader *buf.BufferedReader) error { func (w *ServerWorker) handleStatusNew(ctx context.Context, meta *FrameMetadata, reader *buf.BufferedReader) error {
// deep-clone outbounds because it is going to be mutated concurrently
// (Target and OriginalTarget)
ctx = session.ContextCloneOutbounds(ctx)
errors.LogInfo(ctx, "received request for ", meta.Target) errors.LogInfo(ctx, "received request for ", meta.Target)
{ {
msg := &log.AccessMessage{ msg := &log.AccessMessage{

View File

@@ -1,124 +0,0 @@
package mux_test
import (
"context"
"testing"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/buf"
"github.com/xtls/xray-core/common/mux"
"github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/common/session"
"github.com/xtls/xray-core/features/routing"
"github.com/xtls/xray-core/transport"
"github.com/xtls/xray-core/transport/pipe"
)
func newLinkPair() (*transport.Link, *transport.Link) {
opt := pipe.WithoutSizeLimit()
uplinkReader, uplinkWriter := pipe.New(opt)
downlinkReader, downlinkWriter := pipe.New(opt)
uplink := &transport.Link{
Reader: uplinkReader,
Writer: downlinkWriter,
}
downlink := &transport.Link{
Reader: downlinkReader,
Writer: uplinkWriter,
}
return uplink, downlink
}
type TestDispatcher struct {
OnDispatch func(ctx context.Context, dest net.Destination) (*transport.Link, error)
}
func (d *TestDispatcher) Dispatch(ctx context.Context, dest net.Destination) (*transport.Link, error) {
return d.OnDispatch(ctx, dest)
}
func (d *TestDispatcher) DispatchLink(ctx context.Context, destination net.Destination, outbound *transport.Link) error {
return nil
}
func (d *TestDispatcher) Start() error {
return nil
}
func (d *TestDispatcher) Close() error {
return nil
}
func (*TestDispatcher) Type() interface{} {
return routing.DispatcherType()
}
func TestRegressionOutboundLeak(t *testing.T) {
originalOutbounds := []*session.Outbound{{}}
serverCtx := session.ContextWithOutbounds(context.Background(), originalOutbounds)
websiteUplink, websiteDownlink := newLinkPair()
dispatcher := TestDispatcher{
OnDispatch: func(ctx context.Context, dest net.Destination) (*transport.Link, error) {
// emulate what DefaultRouter.Dispatch does, and mutate something on the context
ob := session.OutboundsFromContext(ctx)[0]
ob.Target = dest
return websiteDownlink, nil
},
}
muxServerUplink, muxServerDownlink := newLinkPair()
_, err := mux.NewServerWorker(serverCtx, &dispatcher, muxServerUplink)
common.Must(err)
client, err := mux.NewClientWorker(*muxServerDownlink, mux.ClientStrategy{})
common.Must(err)
clientCtx := session.ContextWithOutbounds(context.Background(), []*session.Outbound{{
Target: net.TCPDestination(net.DomainAddress("www.example.com"), 80),
}})
muxClientUplink, muxClientDownlink := newLinkPair()
ok := client.Dispatch(clientCtx, muxClientUplink)
if !ok {
t.Error("failed to dispatch")
}
{
b := buf.FromBytes([]byte("hello"))
common.Must(muxClientDownlink.Writer.WriteMultiBuffer(buf.MultiBuffer{b}))
}
resMb, err := websiteUplink.Reader.ReadMultiBuffer()
common.Must(err)
res := resMb.String()
if res != "hello" {
t.Error("upload: ", res)
}
{
b := buf.FromBytes([]byte("world"))
common.Must(websiteUplink.Writer.WriteMultiBuffer(buf.MultiBuffer{b}))
}
resMb, err = muxClientDownlink.Reader.ReadMultiBuffer()
common.Must(err)
res = resMb.String()
if res != "world" {
t.Error("download: ", res)
}
outbounds := session.OutboundsFromContext(serverCtx)
if outbounds[0] != originalOutbounds[0] {
t.Error("outbound got reassigned: ", outbounds[0])
}
if outbounds[0].Target.Address != nil {
t.Error("outbound target got leaked: ", outbounds[0].Target.String())
}
}

View File

@@ -121,11 +121,6 @@ func IPAddress(ip []byte) Address {
} }
// DomainAddress creates an Address with given domain. // DomainAddress creates an Address with given domain.
// This is an internal function that forcibly converts a string to domain.
// It's mainly used in test files and mux.
// Unless you have a specific reason, use net.ParseAddress instead,
// as this function does not check whether the input is an IP address.
// Otherwise, you will get strange results like domain: 1.1.1.1
func DomainAddress(domain string) Address { func DomainAddress(domain string) Address {
return domainAddress(domain) return domainAddress(domain)
} }

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.34.2 // protoc-gen-go v1.34.1
// protoc v5.27.0 // protoc v5.27.0
// source: common/net/address.proto // source: common/net/address.proto
@@ -136,7 +136,7 @@ func file_common_net_address_proto_rawDescGZIP() []byte {
} }
var file_common_net_address_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_common_net_address_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_common_net_address_proto_goTypes = []any{ var file_common_net_address_proto_goTypes = []interface{}{
(*IPOrDomain)(nil), // 0: xray.common.net.IPOrDomain (*IPOrDomain)(nil), // 0: xray.common.net.IPOrDomain
} }
var file_common_net_address_proto_depIdxs = []int32{ var file_common_net_address_proto_depIdxs = []int32{
@@ -153,7 +153,7 @@ func file_common_net_address_proto_init() {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_common_net_address_proto_msgTypes[0].Exporter = func(v any, i int) any { file_common_net_address_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*IPOrDomain); i { switch v := v.(*IPOrDomain); i {
case 0: case 0:
return &v.state return &v.state
@@ -166,7 +166,7 @@ func file_common_net_address_proto_init() {
} }
} }
} }
file_common_net_address_proto_msgTypes[0].OneofWrappers = []any{ file_common_net_address_proto_msgTypes[0].OneofWrappers = []interface{}{
(*IPOrDomain_Ip)(nil), (*IPOrDomain_Ip)(nil),
(*IPOrDomain_Domain)(nil), (*IPOrDomain_Domain)(nil),
} }

View File

@@ -52,7 +52,7 @@ func ConnectionOutputMultiUDP(reader buf.Reader) ConnectionOption {
return func(c *connection) { return func(c *connection) {
c.reader = &buf.BufferedReader{ c.reader = &buf.BufferedReader{
Reader: reader, Reader: reader,
Splitter: buf.SplitFirstBytes, Spliter: buf.SplitFirstBytes,
} }
} }
} }

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.34.2 // protoc-gen-go v1.34.1
// protoc v5.27.0 // protoc v5.27.0
// source: common/net/destination.proto // source: common/net/destination.proto
@@ -123,7 +123,7 @@ func file_common_net_destination_proto_rawDescGZIP() []byte {
} }
var file_common_net_destination_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_common_net_destination_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_common_net_destination_proto_goTypes = []any{ var file_common_net_destination_proto_goTypes = []interface{}{
(*Endpoint)(nil), // 0: xray.common.net.Endpoint (*Endpoint)(nil), // 0: xray.common.net.Endpoint
(Network)(0), // 1: xray.common.net.Network (Network)(0), // 1: xray.common.net.Network
(*IPOrDomain)(nil), // 2: xray.common.net.IPOrDomain (*IPOrDomain)(nil), // 2: xray.common.net.IPOrDomain
@@ -146,7 +146,7 @@ func file_common_net_destination_proto_init() {
file_common_net_network_proto_init() file_common_net_network_proto_init()
file_common_net_address_proto_init() file_common_net_address_proto_init()
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_common_net_destination_proto_msgTypes[0].Exporter = func(v any, i int) any { file_common_net_destination_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Endpoint); i { switch v := v.(*Endpoint); i {
case 0: case 0:
return &v.state return &v.state

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.34.2 // protoc-gen-go v1.34.1
// protoc v5.27.0 // protoc v5.27.0
// source: common/net/network.proto // source: common/net/network.proto
@@ -160,7 +160,7 @@ func file_common_net_network_proto_rawDescGZIP() []byte {
var file_common_net_network_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_common_net_network_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_common_net_network_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_common_net_network_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_common_net_network_proto_goTypes = []any{ var file_common_net_network_proto_goTypes = []interface{}{
(Network)(0), // 0: xray.common.net.Network (Network)(0), // 0: xray.common.net.Network
(*NetworkList)(nil), // 1: xray.common.net.NetworkList (*NetworkList)(nil), // 1: xray.common.net.NetworkList
} }
@@ -179,7 +179,7 @@ func file_common_net_network_proto_init() {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_common_net_network_proto_msgTypes[0].Exporter = func(v any, i int) any { file_common_net_network_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*NetworkList); i { switch v := v.(*NetworkList); i {
case 0: case 0:
return &v.state return &v.state

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.34.2 // protoc-gen-go v1.34.1
// protoc v5.27.0 // protoc v5.27.0
// source: common/net/port.proto // source: common/net/port.proto
@@ -159,7 +159,7 @@ func file_common_net_port_proto_rawDescGZIP() []byte {
} }
var file_common_net_port_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_common_net_port_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_common_net_port_proto_goTypes = []any{ var file_common_net_port_proto_goTypes = []interface{}{
(*PortRange)(nil), // 0: xray.common.net.PortRange (*PortRange)(nil), // 0: xray.common.net.PortRange
(*PortList)(nil), // 1: xray.common.net.PortList (*PortList)(nil), // 1: xray.common.net.PortList
} }
@@ -178,7 +178,7 @@ func file_common_net_port_proto_init() {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_common_net_port_proto_msgTypes[0].Exporter = func(v any, i int) any { file_common_net_port_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*PortRange); i { switch v := v.(*PortRange); i {
case 0: case 0:
return &v.state return &v.state
@@ -190,7 +190,7 @@ func file_common_net_port_proto_init() {
return nil return nil
} }
} }
file_common_net_port_proto_msgTypes[1].Exporter = func(v any, i int) any { file_common_net_port_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*PortList); i { switch v := v.(*PortList); i {
case 0: case 0:
return &v.state return &v.state

View File

@@ -19,7 +19,7 @@ func GetToolLocation(file string) string {
return filepath.Join(toolPath, file+".exe") return filepath.Join(toolPath, file+".exe")
} }
// GetAssetLocation searches for `file` in the executable dir // GetAssetLocation searches for `file` in the excutable dir
func GetAssetLocation(file string) string { func GetAssetLocation(file string) string {
assetPath := NewEnvFlag(AssetLocation).GetValue(getExecutableDir) assetPath := NewEnvFlag(AssetLocation).GetValue(getExecutableDir)
return filepath.Join(assetPath, file) return filepath.Join(assetPath, file)

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.34.2 // protoc-gen-go v1.34.1
// protoc v5.27.0 // protoc v5.27.0
// source: common/protocol/headers.proto // source: common/protocol/headers.proto
@@ -165,7 +165,7 @@ func file_common_protocol_headers_proto_rawDescGZIP() []byte {
var file_common_protocol_headers_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_common_protocol_headers_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_common_protocol_headers_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_common_protocol_headers_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_common_protocol_headers_proto_goTypes = []any{ var file_common_protocol_headers_proto_goTypes = []interface{}{
(SecurityType)(0), // 0: xray.common.protocol.SecurityType (SecurityType)(0), // 0: xray.common.protocol.SecurityType
(*SecurityConfig)(nil), // 1: xray.common.protocol.SecurityConfig (*SecurityConfig)(nil), // 1: xray.common.protocol.SecurityConfig
} }
@@ -184,7 +184,7 @@ func file_common_protocol_headers_proto_init() {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_common_protocol_headers_proto_msgTypes[0].Exporter = func(v any, i int) any { file_common_protocol_headers_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SecurityConfig); i { switch v := v.(*SecurityConfig); i {
case 0: case 0:
return &v.state return &v.state

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.34.2 // protoc-gen-go v1.34.1
// protoc v5.27.0 // protoc v5.27.0
// source: common/protocol/server_spec.proto // source: common/protocol/server_spec.proto
@@ -125,7 +125,7 @@ func file_common_protocol_server_spec_proto_rawDescGZIP() []byte {
} }
var file_common_protocol_server_spec_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_common_protocol_server_spec_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_common_protocol_server_spec_proto_goTypes = []any{ var file_common_protocol_server_spec_proto_goTypes = []interface{}{
(*ServerEndpoint)(nil), // 0: xray.common.protocol.ServerEndpoint (*ServerEndpoint)(nil), // 0: xray.common.protocol.ServerEndpoint
(*net.IPOrDomain)(nil), // 1: xray.common.net.IPOrDomain (*net.IPOrDomain)(nil), // 1: xray.common.net.IPOrDomain
(*User)(nil), // 2: xray.common.protocol.User (*User)(nil), // 2: xray.common.protocol.User
@@ -147,7 +147,7 @@ func file_common_protocol_server_spec_proto_init() {
} }
file_common_protocol_user_proto_init() file_common_protocol_user_proto_init()
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_common_protocol_server_spec_proto_msgTypes[0].Exporter = func(v any, i int) any { file_common_protocol_server_spec_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ServerEndpoint); i { switch v := v.(*ServerEndpoint); i {
case 0: case 0:
return &v.state return &v.state

View File

@@ -19,7 +19,7 @@ import (
//go:generate go run github.com/xtls/xray-core/common/errors/errorgen //go:generate go run github.com/xtls/xray-core/common/errors/errorgen
type Certificate struct { type Certificate struct {
// certificate in ASN.1 DER format // Cerificate in ASN.1 DER format
Certificate []byte Certificate []byte
// Private key in ASN.1 DER format // Private key in ASN.1 DER format
PrivateKey []byte PrivateKey []byte
@@ -149,6 +149,10 @@ func Generate(parent *Certificate, opts ...Option) (*Certificate, error) {
BasicConstraintsValid: true, BasicConstraintsValid: true,
} }
for _, opt := range opts {
opt(template)
}
parentCert := template parentCert := template
if parent != nil { if parent != nil {
pCert, err := x509.ParseCertificate(parent.Certificate) pCert, err := x509.ParseCertificate(parent.Certificate)
@@ -158,17 +162,6 @@ func Generate(parent *Certificate, opts ...Option) (*Certificate, error) {
parentCert = pCert parentCert = pCert
} }
if parentCert.NotAfter.Before(template.NotAfter) {
template.NotAfter = parentCert.NotAfter
}
if parentCert.NotBefore.After(template.NotBefore) {
template.NotBefore = parentCert.NotBefore
}
for _, opt := range opts {
opt(template)
}
derBytes, err := x509.CreateCertificate(rand.Reader, template, parentCert, publicKey(selfKey), parentKey) derBytes, err := x509.CreateCertificate(rand.Reader, template, parentCert, publicKey(selfKey), parentKey)
if err != nil { if err != nil {
return nil, errors.New("failed to create certificate").Base(err) return nil, errors.New("failed to create certificate").Base(err)

View File

@@ -147,7 +147,7 @@ func TestTLSHeaders(t *testing.T) {
header, err := SniffTLS(test.input) header, err := SniffTLS(test.input)
if test.err { if test.err {
if err == nil { if err == nil {
t.Errorf("Expect error but nil in test %v", test) t.Errorf("Exepct error but nil in test %v", test)
} }
} else { } else {
if err != nil { if err != nil {

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.34.2 // protoc-gen-go v1.34.1
// protoc v5.27.0 // protoc v5.27.0
// source: common/protocol/user.proto // source: common/protocol/user.proto
@@ -21,7 +21,7 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
) )
// User is a generic user for all protocols. // User is a generic user for all procotols.
type User struct { type User struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
@@ -124,7 +124,7 @@ func file_common_protocol_user_proto_rawDescGZIP() []byte {
} }
var file_common_protocol_user_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_common_protocol_user_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_common_protocol_user_proto_goTypes = []any{ var file_common_protocol_user_proto_goTypes = []interface{}{
(*User)(nil), // 0: xray.common.protocol.User (*User)(nil), // 0: xray.common.protocol.User
(*serial.TypedMessage)(nil), // 1: xray.common.serial.TypedMessage (*serial.TypedMessage)(nil), // 1: xray.common.serial.TypedMessage
} }
@@ -143,7 +143,7 @@ func file_common_protocol_user_proto_init() {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_common_protocol_user_proto_msgTypes[0].Exporter = func(v any, i int) any { file_common_protocol_user_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*User); i { switch v := v.(*User); i {
case 0: case 0:
return &v.state return &v.state

View File

@@ -8,7 +8,7 @@ option java_multiple_files = true;
import "common/serial/typed_message.proto"; import "common/serial/typed_message.proto";
// User is a generic user for all protocols. // User is a generic user for all procotols.
message User { message User {
uint32 level = 1; uint32 level = 1;
string email = 2; string email = 2;

View File

@@ -1,36 +1,22 @@
package reflect package reflect
import ( import (
"bytes"
"encoding/json" "encoding/json"
"fmt"
"reflect" "reflect"
"strings"
cnet "github.com/xtls/xray-core/common/net"
cserial "github.com/xtls/xray-core/common/serial" cserial "github.com/xtls/xray-core/common/serial"
"github.com/xtls/xray-core/infra/conf"
) )
func MarshalToJson(v interface{}, insertTypeInfo bool) (string, bool) { func MarshalToJson(v interface{}) (string, bool) {
if itf := marshalInterface(v, true, insertTypeInfo); itf != nil { if itf := marshalInterface(v, true); itf != nil {
if b, err := JSONMarshalWithoutEscape(itf); err == nil { if b, err := json.MarshalIndent(itf, "", " "); err == nil {
return string(b[:]), true return string(b[:]), true
} }
} }
return "", false return "", false
} }
func JSONMarshalWithoutEscape(t interface{}) ([]byte, error) { func marshalTypedMessage(v *cserial.TypedMessage, ignoreNullValue bool) interface{} {
buffer := &bytes.Buffer{}
encoder := json.NewEncoder(buffer)
encoder.SetIndent("", " ")
encoder.SetEscapeHTML(false)
err := encoder.Encode(t)
return buffer.Bytes(), err
}
func marshalTypedMessage(v *cserial.TypedMessage, ignoreNullValue bool, insertTypeInfo bool) interface{} {
if v == nil { if v == nil {
return nil return nil
} }
@@ -38,67 +24,36 @@ func marshalTypedMessage(v *cserial.TypedMessage, ignoreNullValue bool, insertTy
if err != nil { if err != nil {
return nil return nil
} }
r := marshalInterface(tmsg, ignoreNullValue, insertTypeInfo) r := marshalInterface(tmsg, ignoreNullValue)
if msg, ok := r.(map[string]interface{}); ok && insertTypeInfo { if msg, ok := r.(map[string]interface{}); ok {
msg["_TypedMessage_"] = v.Type msg["_TypedMessage_"] = v.Type
} }
return r return r
} }
func marshalSlice(v reflect.Value, ignoreNullValue bool, insertTypeInfo bool) interface{} { func marshalSlice(v reflect.Value, ignoreNullValue bool) interface{} {
r := make([]interface{}, 0) r := make([]interface{}, 0)
for i := 0; i < v.Len(); i++ { for i := 0; i < v.Len(); i++ {
rv := v.Index(i) rv := v.Index(i)
if rv.CanInterface() { if rv.CanInterface() {
value := rv.Interface() value := rv.Interface()
r = append(r, marshalInterface(value, ignoreNullValue, insertTypeInfo)) r = append(r, marshalInterface(value, ignoreNullValue))
} }
} }
return r return r
} }
func isNullValue(f reflect.StructField, rv reflect.Value) bool { func marshalStruct(v reflect.Value, ignoreNullValue bool) interface{} {
if rv.Kind() == reflect.String && rv.Len() == 0 {
return true
} else if !isValueKind(rv.Kind()) && rv.IsNil() {
return true
} else if tag := f.Tag.Get("json"); strings.Contains(tag, "omitempty") {
if !rv.IsValid() || rv.IsZero() {
return true
}
}
return false
}
func toJsonName(f reflect.StructField) string {
if tags := f.Tag.Get("protobuf"); len(tags) > 0 {
for _, tag := range strings.Split(tags, ",") {
if before, after, ok := strings.Cut(tag, "="); ok && before == "json" {
return after
}
}
}
if tag := f.Tag.Get("json"); len(tag) > 0 {
if before, _, ok := strings.Cut(tag, ","); ok {
return before
} else {
return tag
}
}
return f.Name
}
func marshalStruct(v reflect.Value, ignoreNullValue bool, insertTypeInfo bool) interface{} {
r := make(map[string]interface{}) r := make(map[string]interface{})
t := v.Type() t := v.Type()
for i := 0; i < v.NumField(); i++ { for i := 0; i < v.NumField(); i++ {
rv := v.Field(i) rv := v.Field(i)
if rv.CanInterface() { if rv.CanInterface() {
ft := t.Field(i) ft := t.Field(i)
if !ignoreNullValue || !isNullValue(ft, rv) { name := ft.Name
name := toJsonName(ft)
value := rv.Interface() value := rv.Interface()
tv := marshalInterface(value, ignoreNullValue, insertTypeInfo) tv := marshalInterface(value, ignoreNullValue)
if tv != nil || !ignoreNullValue {
r[name] = tv r[name] = tv
} }
} }
@@ -106,7 +61,7 @@ func marshalStruct(v reflect.Value, ignoreNullValue bool, insertTypeInfo bool) i
return r return r
} }
func marshalMap(v reflect.Value, ignoreNullValue bool, insertTypeInfo bool) interface{} { func marshalMap(v reflect.Value, ignoreNullValue bool) interface{} {
// policy.level is map[uint32] *struct // policy.level is map[uint32] *struct
kt := v.Type().Key() kt := v.Type().Key()
vt := reflect.TypeOf((*interface{})(nil)) vt := reflect.TypeOf((*interface{})(nil))
@@ -116,7 +71,7 @@ func marshalMap(v reflect.Value, ignoreNullValue bool, insertTypeInfo bool) inte
rv := v.MapIndex(key) rv := v.MapIndex(key)
if rv.CanInterface() { if rv.CanInterface() {
iv := rv.Interface() iv := rv.Interface()
tv := marshalInterface(iv, ignoreNullValue, insertTypeInfo) tv := marshalInterface(iv, ignoreNullValue)
if tv != nil || !ignoreNullValue { if tv != nil || !ignoreNullValue {
r.SetMapIndex(key, reflect.ValueOf(&tv)) r.SetMapIndex(key, reflect.ValueOf(&tv))
} }
@@ -132,63 +87,27 @@ func marshalIString(v interface{}) (r string, ok bool) {
ok = false ok = false
} }
}() }()
if iStringFn, ok := v.(interface{ String() string }); ok { if iStringFn, ok := v.(interface{ String() string }); ok {
return iStringFn.String(), true return iStringFn.String(), true
} }
return "", false return "", false
} }
func serializePortList(portList *cnet.PortList) (interface{}, bool) { func marshalKnownType(v interface{}, ignoreNullValue bool) (interface{}, bool) {
if portList == nil {
return nil, false
}
n := len(portList.Range)
if n == 1 {
if first := portList.Range[0]; first.From == first.To {
return first.From, true
}
}
r := make([]string, 0, n)
for _, pr := range portList.Range {
if pr.From == pr.To {
r = append(r, pr.FromPort().String())
} else {
r = append(r, fmt.Sprintf("%d-%d", pr.From, pr.To))
}
}
return strings.Join(r, ","), true
}
func marshalKnownType(v interface{}, ignoreNullValue bool, insertTypeInfo bool) (interface{}, bool) {
switch ty := v.(type) { switch ty := v.(type) {
case cserial.TypedMessage: case cserial.TypedMessage:
return marshalTypedMessage(&ty, ignoreNullValue, insertTypeInfo), true return marshalTypedMessage(&ty, ignoreNullValue), true
case *cserial.TypedMessage: case *cserial.TypedMessage:
return marshalTypedMessage(ty, ignoreNullValue, insertTypeInfo), true return marshalTypedMessage(ty, ignoreNullValue), true
case map[string]json.RawMessage: case map[string]json.RawMessage:
return ty, true return ty, true
case []json.RawMessage: case []json.RawMessage:
return ty, true return ty, true
case *json.RawMessage, json.RawMessage: case *json.RawMessage:
return ty, true
case json.RawMessage:
return ty, true return ty, true
case *cnet.IPOrDomain:
if domain := v.(*cnet.IPOrDomain); domain != nil {
return domain.AsAddress().String(), true
}
return nil, false
case *cnet.PortList:
npl := v.(*cnet.PortList)
return serializePortList(npl)
case *conf.PortList:
cpl := v.(*conf.PortList)
return serializePortList(cpl.Build())
case cnet.Address:
if addr := v.(cnet.Address); addr != nil {
return addr.String(), true
}
return nil, false
default: default:
return nil, false return nil, false
} }
@@ -219,9 +138,9 @@ func isValueKind(kind reflect.Kind) bool {
} }
} }
func marshalInterface(v interface{}, ignoreNullValue bool, insertTypeInfo bool) interface{} { func marshalInterface(v interface{}, ignoreNullValue bool) interface{} {
if r, ok := marshalKnownType(v, ignoreNullValue, insertTypeInfo); ok { if r, ok := marshalKnownType(v, ignoreNullValue); ok {
return r return r
} }
@@ -233,27 +152,19 @@ func marshalInterface(v interface{}, ignoreNullValue bool, insertTypeInfo bool)
if k == reflect.Invalid { if k == reflect.Invalid {
return nil return nil
} }
if isValueKind(k) {
if ty := rv.Type().Name(); isValueKind(k) {
if k.String() != ty {
if s, ok := marshalIString(v); ok {
return s
}
}
return v return v
} }
// fmt.Println("kind:", k, "type:", rv.Type().Name())
switch k { switch k {
case reflect.Struct: case reflect.Struct:
return marshalStruct(rv, ignoreNullValue, insertTypeInfo) return marshalStruct(rv, ignoreNullValue)
case reflect.Slice: case reflect.Slice:
return marshalSlice(rv, ignoreNullValue, insertTypeInfo) return marshalSlice(rv, ignoreNullValue)
case reflect.Array: case reflect.Array:
return marshalSlice(rv, ignoreNullValue, insertTypeInfo) return marshalSlice(rv, ignoreNullValue)
case reflect.Map: case reflect.Map:
return marshalMap(rv, ignoreNullValue, insertTypeInfo) return marshalMap(rv, ignoreNullValue)
default: default:
break break
} }

View File

@@ -6,40 +6,11 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/xtls/xray-core/common/protocol"
. "github.com/xtls/xray-core/common/reflect" . "github.com/xtls/xray-core/common/reflect"
cserial "github.com/xtls/xray-core/common/serial" cserial "github.com/xtls/xray-core/common/serial"
iserial "github.com/xtls/xray-core/infra/conf/serial" iserial "github.com/xtls/xray-core/infra/conf/serial"
"github.com/xtls/xray-core/proxy/shadowsocks"
) )
func TestMashalAccount(t *testing.T) {
account := &shadowsocks.Account{
Password: "shadowsocks-password",
CipherType: shadowsocks.CipherType_CHACHA20_POLY1305,
}
user := &protocol.User{
Level: 0,
Email: "love@v2ray.com",
Account: cserial.ToTypedMessage(account),
}
j, ok := MarshalToJson(user, false)
if !ok || strings.Contains(j, "_TypedMessage_") {
t.Error("marshal account failed")
}
kws := []string{"CHACHA20_POLY1305", "cipherType", "shadowsocks-password"}
for _, kw := range kws {
if !strings.Contains(j, kw) {
t.Error("marshal account failed")
}
}
// t.Log(j)
}
func TestMashalStruct(t *testing.T) { func TestMashalStruct(t *testing.T) {
type Foo = struct { type Foo = struct {
N int `json:"n"` N int `json:"n"`
@@ -65,8 +36,8 @@ func TestMashalStruct(t *testing.T) {
Arr: &arr, Arr: &arr,
} }
s, ok1 := MarshalToJson(f1, true) s, ok1 := MarshalToJson(f1)
sp, ok2 := MarshalToJson(&f1, true) sp, ok2 := MarshalToJson(&f1)
if !ok1 || !ok2 || s != sp { if !ok1 || !ok2 || s != sp {
t.Error("marshal failed") t.Error("marshal failed")
@@ -98,7 +69,7 @@ func TestMarshalConfigJson(t *testing.T) {
} }
tmsg := cserial.ToTypedMessage(bc) tmsg := cserial.ToTypedMessage(bc)
tc, ok := MarshalToJson(tmsg, true) tc, ok := MarshalToJson(tmsg)
if !ok { if !ok {
t.Error("marshal config failed") t.Error("marshal config failed")
} }
@@ -108,14 +79,15 @@ func TestMarshalConfigJson(t *testing.T) {
keywords := []string{ keywords := []string{
"4784f9b8-a879-4fec-9718-ebddefa47750", "4784f9b8-a879-4fec-9718-ebddefa47750",
"bing.com", "bing.com",
"inboundTag", "DomainStrategy",
"level", "InboundTag",
"stats", "Level",
"userDownlink", "Stats",
"userUplink", "UserDownlink",
"system", "UserUplink",
"inboundDownlink", "System",
"outboundUplink", "InboundDownlink",
"OutboundUplink",
} }
for _, kw := range keywords { for _, kw := range keywords {
if !strings.Contains(tc, kw) { if !strings.Contains(tc, kw) {

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.34.2 // protoc-gen-go v1.34.1
// protoc v5.27.0 // protoc v5.27.0
// source: common/serial/typed_message.proto // source: common/serial/typed_message.proto
@@ -110,7 +110,7 @@ func file_common_serial_typed_message_proto_rawDescGZIP() []byte {
} }
var file_common_serial_typed_message_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_common_serial_typed_message_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_common_serial_typed_message_proto_goTypes = []any{ var file_common_serial_typed_message_proto_goTypes = []interface{}{
(*TypedMessage)(nil), // 0: xray.common.serial.TypedMessage (*TypedMessage)(nil), // 0: xray.common.serial.TypedMessage
} }
var file_common_serial_typed_message_proto_depIdxs = []int32{ var file_common_serial_typed_message_proto_depIdxs = []int32{
@@ -127,7 +127,7 @@ func file_common_serial_typed_message_proto_init() {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_common_serial_typed_message_proto_msgTypes[0].Exporter = func(v any, i int) any { file_common_serial_typed_message_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TypedMessage); i { switch v := v.(*TypedMessage); i {
case 0: case 0:
return &v.state return &v.state

View File

@@ -16,7 +16,7 @@ const (
inboundSessionKey ctx.SessionKey = 1 inboundSessionKey ctx.SessionKey = 1
outboundSessionKey ctx.SessionKey = 2 outboundSessionKey ctx.SessionKey = 2
contentSessionKey ctx.SessionKey = 3 contentSessionKey ctx.SessionKey = 3
muxPreferredSessionKey ctx.SessionKey = 4 muxPreferedSessionKey ctx.SessionKey = 4
sockoptSessionKey ctx.SessionKey = 5 sockoptSessionKey ctx.SessionKey = 5
trackedConnectionErrorKey ctx.SessionKey = 6 trackedConnectionErrorKey ctx.SessionKey = 6
dispatcherKey ctx.SessionKey = 7 dispatcherKey ctx.SessionKey = 7
@@ -40,22 +40,6 @@ func ContextWithOutbounds(ctx context.Context, outbounds []*Outbound) context.Co
return context.WithValue(ctx, outboundSessionKey, outbounds) return context.WithValue(ctx, outboundSessionKey, outbounds)
} }
func ContextCloneOutbounds(ctx context.Context) context.Context {
outbounds := OutboundsFromContext(ctx)
newOutbounds := make([]*Outbound, len(outbounds))
for i, ob := range outbounds {
if ob == nil {
continue
}
// copy outbound by value
v := *ob
newOutbounds[i] = &v
}
return ContextWithOutbounds(ctx, newOutbounds)
}
func OutboundsFromContext(ctx context.Context) []*Outbound { func OutboundsFromContext(ctx context.Context) []*Outbound {
if outbounds, ok := ctx.Value(outboundSessionKey).([]*Outbound); ok { if outbounds, ok := ctx.Value(outboundSessionKey).([]*Outbound); ok {
return outbounds return outbounds
@@ -74,14 +58,14 @@ func ContentFromContext(ctx context.Context) *Content {
return nil return nil
} }
// ContextWithMuxPreferred returns a new context with the given bool // ContextWithMuxPrefered returns a new context with the given bool
func ContextWithMuxPreferred(ctx context.Context, forced bool) context.Context { func ContextWithMuxPrefered(ctx context.Context, forced bool) context.Context {
return context.WithValue(ctx, muxPreferredSessionKey, forced) return context.WithValue(ctx, muxPreferedSessionKey, forced)
} }
// MuxPreferredFromContext returns value in this context, or false if not contained. // MuxPreferedFromContext returns value in this context, or false if not contained.
func MuxPreferredFromContext(ctx context.Context) bool { func MuxPreferedFromContext(ctx context.Context) bool {
if val, ok := ctx.Value(muxPreferredSessionKey).(bool); ok { if val, ok := ctx.Value(muxPreferedSessionKey).(bool); ok {
return val return val
} }
return false return false

View File

@@ -29,7 +29,7 @@ func TestActivityTimerUpdate(t *testing.T) {
timer.SetTimeout(time.Second * 1) timer.SetTimeout(time.Second * 1)
time.Sleep(time.Second * 2) time.Sleep(time.Second * 2)
if ctx.Err() == nil { if ctx.Err() == nil {
t.Error("expected some error, but got nil") t.Error("expcted some error, but got nil")
} }
runtime.KeepAlive(timer) runtime.KeepAlive(timer)
} }

View File

@@ -19,19 +19,14 @@ type ConfigFormat struct {
Loader ConfigLoader Loader ConfigLoader
} }
type ConfigSource struct {
Name string
Format string
}
// ConfigLoader is a utility to load Xray config from external source. // ConfigLoader is a utility to load Xray config from external source.
type ConfigLoader func(input interface{}) (*Config, error) type ConfigLoader func(input interface{}) (*Config, error)
// ConfigBuilder is a builder to build core.Config from filenames and formats // ConfigBuilder is a builder to build core.Config from filenames and formats
type ConfigBuilder func(files []*ConfigSource) (*Config, error) type ConfigBuilder func(files []string, formats []string) (*Config, error)
// ConfigsMerger merge multiple json configs into on config // ConfigsMerger merge multiple json configs into on config
type ConfigsMerger func(files []*ConfigSource) (string, error) type ConfigsMerger func(files []string, formats []string) (string, error)
var ( var (
configLoaderByName = make(map[string]*ConfigFormat) configLoaderByName = make(map[string]*ConfigFormat)
@@ -60,21 +55,20 @@ func RegisterConfigLoader(format *ConfigFormat) error {
} }
func GetMergedConfig(args cmdarg.Arg) (string, error) { func GetMergedConfig(args cmdarg.Arg) (string, error) {
var files []*ConfigSource files := make([]string, 0)
formats := make([]string, 0)
supported := []string{"json", "yaml", "toml"} supported := []string{"json", "yaml", "toml"}
for _, file := range args { for _, file := range args {
format := getFormat(file) format := getFormat(file)
for _, s := range supported { for _, s := range supported {
if s == format { if s == format {
files = append(files, &ConfigSource{ files = append(files, file)
Name: file, formats = append(formats, format)
Format: format,
})
break break
} }
} }
} }
return ConfigMergedFormFiles(files) return ConfigMergedFormFiles(files, formats)
} }
func GetFormatByExtension(ext string) string { func GetFormatByExtension(ext string) string {
@@ -107,7 +101,7 @@ func getFormat(filename string) string {
func LoadConfig(formatName string, input interface{}) (*Config, error) { func LoadConfig(formatName string, input interface{}) (*Config, error) {
switch v := input.(type) { switch v := input.(type) {
case cmdarg.Arg: case cmdarg.Arg:
files := make([]*ConfigSource, len(v)) formats := make([]string, len(v))
hasProtobuf := false hasProtobuf := false
for i, file := range v { for i, file := range v {
var f string var f string
@@ -129,10 +123,7 @@ func LoadConfig(formatName string, input interface{}) (*Config, error) {
if f == "protobuf" { if f == "protobuf" {
hasProtobuf = true hasProtobuf = true
} }
files[i] = &ConfigSource{ formats[i] = f
Name: file,
Format: f,
}
} }
// only one protobuf config file is allowed // only one protobuf config file is allowed
@@ -145,7 +136,8 @@ func LoadConfig(formatName string, input interface{}) (*Config, error) {
} }
// to avoid import cycle // to avoid import cycle
return ConfigBuilderForFiles(files) return ConfigBuilderForFiles(v, formats)
case io.Reader: case io.Reader:
if f, found := configLoaderByName[formatName]; found { if f, found := configLoaderByName[formatName]; found {
return f.Loader(v) return f.Loader(v)
@@ -182,7 +174,7 @@ func init() {
common.Must(err) common.Must(err)
return loadProtobufConfig(data) return loadProtobufConfig(data)
default: default:
return nil, errors.New("unknown type") return nil, errors.New("unknow type")
} }
}, },
})) }))

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.34.2 // protoc-gen-go v1.34.1
// protoc v5.27.0 // protoc v5.27.0
// source: core/config.proto // source: core/config.proto
@@ -347,7 +347,7 @@ func file_core_config_proto_rawDescGZIP() []byte {
} }
var file_core_config_proto_msgTypes = make([]protoimpl.MessageInfo, 3) var file_core_config_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_core_config_proto_goTypes = []any{ var file_core_config_proto_goTypes = []interface{}{
(*Config)(nil), // 0: xray.core.Config (*Config)(nil), // 0: xray.core.Config
(*InboundHandlerConfig)(nil), // 1: xray.core.InboundHandlerConfig (*InboundHandlerConfig)(nil), // 1: xray.core.InboundHandlerConfig
(*OutboundHandlerConfig)(nil), // 2: xray.core.OutboundHandlerConfig (*OutboundHandlerConfig)(nil), // 2: xray.core.OutboundHandlerConfig
@@ -377,7 +377,7 @@ func file_core_config_proto_init() {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_core_config_proto_msgTypes[0].Exporter = func(v any, i int) any { file_core_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Config); i { switch v := v.(*Config); i {
case 0: case 0:
return &v.state return &v.state
@@ -389,7 +389,7 @@ func file_core_config_proto_init() {
return nil return nil
} }
} }
file_core_config_proto_msgTypes[1].Exporter = func(v any, i int) any { file_core_config_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*InboundHandlerConfig); i { switch v := v.(*InboundHandlerConfig); i {
case 0: case 0:
return &v.state return &v.state
@@ -401,7 +401,7 @@ func file_core_config_proto_init() {
return nil return nil
} }
} }
file_core_config_proto_msgTypes[2].Exporter = func(v any, i int) any { file_core_config_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*OutboundHandlerConfig); i { switch v := v.(*OutboundHandlerConfig); i {
case 0: case 0:
return &v.state return &v.state

View File

@@ -21,7 +21,7 @@ import (
var ( var (
Version_x byte = 1 Version_x byte = 1
Version_y byte = 8 Version_y byte = 8
Version_z byte = 24 Version_z byte = 16
) )
var ( var (

View File

@@ -1,5 +1,5 @@
package core package core
//go:generate go install -v google.golang.org/protobuf/cmd/protoc-gen-go@v1.34.2 //go:generate go install -v google.golang.org/protobuf/cmd/protoc-gen-go@latest
//go:generate go install -v google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.5.1 //go:generate go install -v google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
//go:generate go run ../infra/vprotogen/main.go -pwd ./.. //go:generate go run ../infra/vprotogen/main.go -pwd ./..

33
go.mod
View File

@@ -1,33 +1,33 @@
module github.com/xtls/xray-core module github.com/xtls/xray-core
go 1.21.4 go 1.22
require ( require (
github.com/OmarTariq612/goech v0.0.0-20240405204721-8e2e1dafd3a0 github.com/OmarTariq612/goech v0.0.0-20240405204721-8e2e1dafd3a0
github.com/cloudflare/circl v1.4.0 github.com/cloudflare/circl v1.3.9
github.com/ghodss/yaml v1.0.1-0.20220118164431-d8423dcdf344 github.com/ghodss/yaml v1.0.1-0.20220118164431-d8423dcdf344
github.com/golang/mock v1.7.0-rc.1 github.com/golang/mock v1.7.0-rc.1
github.com/google/go-cmp v0.6.0 github.com/google/go-cmp v0.6.0
github.com/gorilla/websocket v1.5.3 github.com/gorilla/websocket v1.5.3
github.com/miekg/dns v1.1.62 github.com/miekg/dns v1.1.61
github.com/pelletier/go-toml v1.9.5 github.com/pelletier/go-toml v1.9.5
github.com/pires/go-proxyproto v0.7.0 github.com/pires/go-proxyproto v0.7.0
github.com/quic-go/quic-go v0.46.0 github.com/quic-go/quic-go v0.45.1
github.com/refraction-networking/utls v1.6.7 github.com/refraction-networking/utls v1.6.6
github.com/sagernet/sing v0.4.1 github.com/sagernet/sing v0.4.1
github.com/sagernet/sing-shadowsocks v0.2.7 github.com/sagernet/sing-shadowsocks v0.2.6
github.com/seiflotfy/cuckoofilter v0.0.0-20240715131351-a2f2c23f1771 github.com/seiflotfy/cuckoofilter v0.0.0-20220411075957-e3b120b3f5fb
github.com/stretchr/testify v1.9.0 github.com/stretchr/testify v1.9.0
github.com/v2fly/ss-bloomring v0.0.0-20210312155135-28617310f63e github.com/v2fly/ss-bloomring v0.0.0-20210312155135-28617310f63e
github.com/vishvananda/netlink v1.3.0 github.com/vishvananda/netlink v1.2.1-beta.2.0.20230316163032-ced5aaba43e3
github.com/xtls/reality v0.0.0-20240712055506-48f0b2d5ed6d github.com/xtls/reality v0.0.0-20240429224917-ecc4401070cc
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba go4.org/netipx v0.0.0-20231129151722-fdeea329fbba
golang.org/x/crypto v0.26.0 golang.org/x/crypto v0.24.0
golang.org/x/net v0.28.0 golang.org/x/net v0.26.0
golang.org/x/sync v0.8.0 golang.org/x/sync v0.7.0
golang.org/x/sys v0.24.0 golang.org/x/sys v0.21.0
golang.zx2c4.com/wireguard v0.0.0-20231211153847-12269c276173 golang.zx2c4.com/wireguard v0.0.0-20231211153847-12269c276173
google.golang.org/grpc v1.66.0 google.golang.org/grpc v1.65.0
google.golang.org/protobuf v1.34.2 google.golang.org/protobuf v1.34.2
gvisor.dev/gvisor v0.0.0-20231202080848-1f7806d17489 gvisor.dev/gvisor v0.0.0-20231202080848-1f7806d17489
h12.io/socks v1.0.3 h12.io/socks v1.0.3
@@ -46,17 +46,16 @@ require (
github.com/klauspost/cpuid/v2 v2.2.7 // indirect github.com/klauspost/cpuid/v2 v2.2.7 // indirect
github.com/onsi/ginkgo/v2 v2.19.0 // indirect github.com/onsi/ginkgo/v2 v2.19.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/quic-go/qpack v0.4.0 // indirect
github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3 // indirect github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3 // indirect
github.com/vishvananda/netns v0.0.4 // indirect github.com/vishvananda/netns v0.0.4 // indirect
go.uber.org/mock v0.4.0 // indirect go.uber.org/mock v0.4.0 // indirect
golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect
golang.org/x/mod v0.18.0 // indirect golang.org/x/mod v0.18.0 // indirect
golang.org/x/text v0.17.0 // indirect golang.org/x/text v0.16.0 // indirect
golang.org/x/time v0.5.0 // indirect golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.22.0 // indirect golang.org/x/tools v0.22.0 // indirect
golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 // indirect golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect
) )

67
go.sum
View File

@@ -17,8 +17,8 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24
github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g=
github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cloudflare/circl v1.4.0 h1:BV7h5MgrktNzytKmWjpOtdYrf0lkkbF8YMlBGPhJQrY= github.com/cloudflare/circl v1.3.9 h1:QFrlgFYf2Qpi8bSpVPK1HBvWpx16v/1TZivyo7pGuBE=
github.com/cloudflare/circl v1.4.0/go.mod h1:PDRU+oXvdD7KCtgKxW95M5Z8BpSCJXQORiZFnBQS5QU= github.com/cloudflare/circl v1.3.9/go.mod h1:PDRU+oXvdD7KCtgKxW95M5Z8BpSCJXQORiZFnBQS5QU=
github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
@@ -86,8 +86,8 @@ github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm
github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4= github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4=
github.com/miekg/dns v1.1.62 h1:cN8OuEF1/x5Rq6Np+h1epln8OiyPWV+lROx9LxcGgIQ= github.com/miekg/dns v1.1.61 h1:nLxbwF3XxhwVSm8g9Dghm9MHPaUZuqhPiGL+675ZmEs=
github.com/miekg/dns v1.1.62/go.mod h1:mvDlcItzm+br7MToIKqkglaGhlFMHJ9DTNNWONWXbNQ= github.com/miekg/dns v1.1.61/go.mod h1:mnAarhS3nWaW+NVP2wTkYVIZyHNJ098SJZUki3eykwQ=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo= github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo=
@@ -110,21 +110,19 @@ github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXP
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo= github.com/quic-go/quic-go v0.45.1 h1:tPfeYCk+uZHjmDRwHHQmvHRYL2t44ROTujLeFVBmjCA=
github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1Knj9A= github.com/quic-go/quic-go v0.45.1/go.mod h1:1dLehS7TIR64+vxGR70GDcatWTOtMX2PUtnKsjbTurI=
github.com/quic-go/quic-go v0.46.0 h1:uuwLClEEyk1DNvchH8uCByQVjo3yKL9opKulExNDs7Y= github.com/refraction-networking/utls v1.6.6 h1:igFsYBUJPYM8Rno9xUuDoM5GQrVEqY4llzEXOkL43Ig=
github.com/quic-go/quic-go v0.46.0/go.mod h1:1dLehS7TIR64+vxGR70GDcatWTOtMX2PUtnKsjbTurI= github.com/refraction-networking/utls v1.6.6/go.mod h1:BC3O4vQzye5hqpmDTWUqi4P5DDhzJfkV1tdqtawQIH0=
github.com/refraction-networking/utls v1.6.7 h1:zVJ7sP1dJx/WtVuITug3qYUq034cDq9B2MR1K67ULZM=
github.com/refraction-networking/utls v1.6.7/go.mod h1:BC3O4vQzye5hqpmDTWUqi4P5DDhzJfkV1tdqtawQIH0=
github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3 h1:f/FNXud6gA3MNr8meMVVGxhp+QBTqY91tM8HjEuMjGg= github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3 h1:f/FNXud6gA3MNr8meMVVGxhp+QBTqY91tM8HjEuMjGg=
github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3/go.mod h1:HgjTstvQsPGkxUsCd2KWxErBblirPizecHcpD3ffK+s= github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3/go.mod h1:HgjTstvQsPGkxUsCd2KWxErBblirPizecHcpD3ffK+s=
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/sagernet/sing v0.4.1 h1:zVlpE+7k7AFoC2pv6ReqLf0PIHjihL/jsBl5k05PQFk= github.com/sagernet/sing v0.4.1 h1:zVlpE+7k7AFoC2pv6ReqLf0PIHjihL/jsBl5k05PQFk=
github.com/sagernet/sing v0.4.1/go.mod h1:ieZHA/+Y9YZfXs2I3WtuwgyCZ6GPsIR7HdKb1SdEnls= github.com/sagernet/sing v0.4.1/go.mod h1:ieZHA/+Y9YZfXs2I3WtuwgyCZ6GPsIR7HdKb1SdEnls=
github.com/sagernet/sing-shadowsocks v0.2.7 h1:zaopR1tbHEw5Nk6FAkM05wCslV6ahVegEZaKMv9ipx8= github.com/sagernet/sing-shadowsocks v0.2.6 h1:xr7ylAS/q1cQYS8oxKKajhuQcchd5VJJ4K4UZrrpp0s=
github.com/sagernet/sing-shadowsocks v0.2.7/go.mod h1:0rIKJZBR65Qi0zwdKezt4s57y/Tl1ofkaq6NlkzVuyE= github.com/sagernet/sing-shadowsocks v0.2.6/go.mod h1:j2YZBIpWIuElPFL/5sJAj470bcn/3QQ5lxZUNKLDNAM=
github.com/seiflotfy/cuckoofilter v0.0.0-20240715131351-a2f2c23f1771 h1:emzAzMZ1L9iaKCTxdy3Em8Wv4ChIAGnfiz18Cda70g4= github.com/seiflotfy/cuckoofilter v0.0.0-20220411075957-e3b120b3f5fb h1:XfLJSPIOUX+osiMraVgIrMR27uMXnRJWGm1+GL8/63U=
github.com/seiflotfy/cuckoofilter v0.0.0-20240715131351-a2f2c23f1771/go.mod h1:bR6DqgcAl1zTcOX8/pE2Qkj9XO00eCNqmKb7lXP8EAg= github.com/seiflotfy/cuckoofilter v0.0.0-20220411075957-e3b120b3f5fb/go.mod h1:bR6DqgcAl1zTcOX8/pE2Qkj9XO00eCNqmKb7lXP8EAg=
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
github.com/shurcooL/component v0.0.0-20170202220835-f88ec8f54cc4/go.mod h1:XhFIlyj5a1fBNx5aJTbKoIq0mNaPvOagO+HjB3EtxrY= github.com/shurcooL/component v0.0.0-20170202220835-f88ec8f54cc4/go.mod h1:XhFIlyj5a1fBNx5aJTbKoIq0mNaPvOagO+HjB3EtxrY=
github.com/shurcooL/events v0.0.0-20181021180414-410e4ca65f48/go.mod h1:5u70Mqkb5O5cxEA8nxTsgrgLehJeAw6Oc4Ab1c/P1HM= github.com/shurcooL/events v0.0.0-20181021180414-410e4ca65f48/go.mod h1:5u70Mqkb5O5cxEA8nxTsgrgLehJeAw6Oc4Ab1c/P1HM=
@@ -160,12 +158,13 @@ github.com/v2fly/ss-bloomring v0.0.0-20210312155135-28617310f63e h1:5QefA066A1tF
github.com/v2fly/ss-bloomring v0.0.0-20210312155135-28617310f63e/go.mod h1:5t19P9LBIrNamL6AcMQOncg/r10y3Pc01AbHeMhwlpU= github.com/v2fly/ss-bloomring v0.0.0-20210312155135-28617310f63e/go.mod h1:5t19P9LBIrNamL6AcMQOncg/r10y3Pc01AbHeMhwlpU=
github.com/viant/assertly v0.4.8/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49uaYMPRU= github.com/viant/assertly v0.4.8/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49uaYMPRU=
github.com/viant/toolbox v0.24.0/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMILuUhzM= github.com/viant/toolbox v0.24.0/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMILuUhzM=
github.com/vishvananda/netlink v1.3.0 h1:X7l42GfcV4S6E4vHTsw48qbrV+9PVojNfIhZcwQdrZk= github.com/vishvananda/netlink v1.2.1-beta.2.0.20230316163032-ced5aaba43e3 h1:tkMT5pTye+1NlKIXETU78NXw0fyjnaNHmJyyLyzw8+U=
github.com/vishvananda/netlink v1.3.0/go.mod h1:i6NetklAujEcC6fK0JPjT8qSwWyO0HLn4UKG+hGqeJs= github.com/vishvananda/netlink v1.2.1-beta.2.0.20230316163032-ced5aaba43e3/go.mod h1:cAAsePK2e15YDAMJNyOpGYEWNe4sIghTY7gpz4cX/Ik=
github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0=
github.com/vishvananda/netns v0.0.4 h1:Oeaw1EM2JMxD51g9uhtC0D7erkIjgmj8+JZc26m1YX8= github.com/vishvananda/netns v0.0.4 h1:Oeaw1EM2JMxD51g9uhtC0D7erkIjgmj8+JZc26m1YX8=
github.com/vishvananda/netns v0.0.4/go.mod h1:SpkAiCQRtJ6TvvxPnOSyH3BMl6unz3xZlaprSwhNNJM= github.com/vishvananda/netns v0.0.4/go.mod h1:SpkAiCQRtJ6TvvxPnOSyH3BMl6unz3xZlaprSwhNNJM=
github.com/xtls/reality v0.0.0-20240712055506-48f0b2d5ed6d h1:+B97uD9uHLgAAulhigmys4BVwZZypzK7gPN3WtpgRJg= github.com/xtls/reality v0.0.0-20240429224917-ecc4401070cc h1:0Nj8T1n7F7+v4vRVroaJIvY6R0vNABLfPH+lzPHRJvI=
github.com/xtls/reality v0.0.0-20240712055506-48f0b2d5ed6d/go.mod h1:dm4y/1QwzjGaK17ofi0Vs6NpKAHegZky8qk6J2JJZAE= github.com/xtls/reality v0.0.0-20240429224917-ecc4401070cc/go.mod h1:dm4y/1QwzjGaK17ofi0Vs6NpKAHegZky8qk6J2JJZAE=
github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA= go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA=
go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU=
@@ -178,8 +177,8 @@ golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnf
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw= golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI=
golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc h1:O9NuF4s+E/PvMIy+9IUZB9znFwUIXEWSstNjek6VpVg= golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc h1:O9NuF4s+E/PvMIy+9IUZB9znFwUIXEWSstNjek6VpVg=
golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc= golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc=
@@ -200,8 +199,8 @@ golang.org/x/net v0.0.0-20190313220215-9f648a60d977/go.mod h1:t9HGtf8HONx5eT2rtn
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ=
golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
@@ -213,29 +212,29 @@ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181029174526-d69651ed3497/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181029174526-d69651ed3497/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190316082340-a2f829d7f35f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190316082340-a2f829d7f35f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200217220822-9197077df867/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220804214406-8e32c043e418/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
@@ -268,14 +267,14 @@ google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoA
google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20181202183823-bd91e49a0898/go.mod h1:7Ep/1NZk928CDR8SjdVbjWNpdIf6nzjE3BTgJDr2Atg= google.golang.org/genproto v0.0.0-20181202183823-bd91e49a0898/go.mod h1:7Ep/1NZk928CDR8SjdVbjWNpdIf6nzjE3BTgJDr2Atg=
google.golang.org/genproto v0.0.0-20190306203927-b5d61aea6440/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190306203927-b5d61aea6440/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 h1:1GBuWVLM/KMVUv1t1En5Gs+gFZCNd360GGb4sSxtrhU= google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 h1:Zy9XzmMEflZ/MAaA7vNcoebnRAld7FsPW1EeBB7V0m8=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0=
google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio=
google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c= google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc=
google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ=
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=

View File

@@ -2,7 +2,6 @@ package conf
import ( import (
"encoding/json" "encoding/json"
"strconv"
"strings" "strings"
"github.com/xtls/xray-core/common/errors" "github.com/xtls/xray-core/common/errors"
@@ -243,33 +242,3 @@ func (v *User) Build() *protocol.User {
Level: uint32(v.LevelByte), Level: uint32(v.LevelByte),
} }
} }
// Int32Range deserializes from "1-2" or 1, so can deserialize from both int and number.
// Negative integers can be passed as sentinel values, but do not parse as ranges.
type Int32Range struct {
From int32
To int32
}
func (v *Int32Range) UnmarshalJSON(data []byte) error {
var stringrange string
var rawint int32
if err := json.Unmarshal(data, &stringrange); err == nil {
pair := strings.SplitN(stringrange, "-", 2)
if len(pair) == 2 {
from, err := strconv.Atoi(pair[0])
to, err2 := strconv.Atoi(pair[1])
if err == nil && err2 == nil {
v.From = int32(from)
v.To = int32(to)
return nil
}
}
} else if err := json.Unmarshal(data, &rawint); err == nil {
v.From = rawint
v.To = rawint
return nil
}
return errors.New("Invalid integer range, expected either string of form \"1-2\" or plain integer.")
}

View File

@@ -18,7 +18,6 @@ type FreedomConfig struct {
Redirect string `json:"redirect"` Redirect string `json:"redirect"`
UserLevel uint32 `json:"userLevel"` UserLevel uint32 `json:"userLevel"`
Fragment *Fragment `json:"fragment"` Fragment *Fragment `json:"fragment"`
Noise *Noise `json:"noise"`
ProxyProtocol uint32 `json:"proxyProtocol"` ProxyProtocol uint32 `json:"proxyProtocol"`
} }
@@ -28,11 +27,6 @@ type Fragment struct {
Interval string `json:"interval"` Interval string `json:"interval"`
} }
type Noise struct {
Packet string `json:"packet"`
Delay string `json:"delay"`
}
// Build implements Buildable // Build implements Buildable
func (c *FreedomConfig) Build() (proto.Message, error) { func (c *FreedomConfig) Build() (proto.Message, error) {
config := new(freedom.Config) config := new(freedom.Config)
@@ -149,76 +143,6 @@ func (c *FreedomConfig) Build() (proto.Message, error) {
} }
} }
} }
if c.Noise != nil {
config.Noise = new(freedom.Noise)
var err, err2 error
p := strings.Split(strings.ToLower(c.Noise.Packet), ":")
if len(p) != 2 {
return nil, errors.New("invalid type for packet")
}
switch p[0] {
case "rand":
randValue := strings.Split(p[1], "-")
if len(randValue) > 2 {
return nil, errors.New("Only 2 values are allowed for rand")
}
if len(randValue) == 2 {
config.Noise.LengthMin, err = strconv.ParseUint(randValue[0], 10, 64)
config.Noise.LengthMax, err2 = strconv.ParseUint(randValue[1], 10, 64)
}
if len(randValue) == 1 {
config.Noise.LengthMin, err = strconv.ParseUint(randValue[0], 10, 64)
config.Noise.LengthMax = config.Noise.LengthMin
}
if err != nil {
return nil, errors.New("invalid value for rand LengthMin").Base(err)
}
if err2 != nil {
return nil, errors.New("invalid value for rand LengthMax").Base(err2)
}
if config.Noise.LengthMin > config.Noise.LengthMax {
config.Noise.LengthMin, config.Noise.LengthMax = config.Noise.LengthMax, config.Noise.LengthMin
}
if config.Noise.LengthMin == 0 {
return nil, errors.New("rand lengthMin or lengthMax cannot be 0")
}
case "str":
//user input string
config.Noise.StrNoise = strings.TrimSpace(p[1])
default:
return nil, errors.New("Invalid packet,only rand and str are supported")
}
if c.Noise.Delay != "" {
d := strings.Split(strings.ToLower(c.Noise.Delay), "-")
if len(d) > 2 {
return nil, errors.New("Invalid delay value")
}
if len(d) == 2 {
config.Noise.DelayMin, err = strconv.ParseUint(d[0], 10, 64)
config.Noise.DelayMax, err2 = strconv.ParseUint(d[1], 10, 64)
} else {
config.Noise.DelayMin, err = strconv.ParseUint(d[0], 10, 64)
config.Noise.DelayMax = config.Noise.DelayMin
}
if err != nil {
return nil, errors.New("Invalid value for DelayMin").Base(err)
}
if err2 != nil {
return nil, errors.New("Invalid value for DelayMax").Base(err2)
}
if config.Noise.DelayMin > config.Noise.DelayMax {
config.Noise.DelayMin, config.Noise.DelayMax = config.Noise.DelayMax, config.Noise.DelayMin
}
if config.Noise.DelayMin == 0 {
return nil, errors.New("DelayMin or DelayMax cannot be 0")
}
} else {
config.Noise.DelayMin = 0
}
}
if c.Timeout != nil { if c.Timeout != nil {
config.Timeout = *c.Timeout config.Timeout = *c.Timeout

View File

@@ -11,27 +11,27 @@ import (
"github.com/xtls/xray-core/main/confloader" "github.com/xtls/xray-core/main/confloader"
) )
func MergeConfigFromFiles(files []*core.ConfigSource) (string, error) { func MergeConfigFromFiles(files []string, formats []string) (string, error) {
c, err := mergeConfigs(files) c, err := mergeConfigs(files, formats)
if err != nil { if err != nil {
return "", err return "", err
} }
if j, ok := creflect.MarshalToJson(c, true); ok { if j, ok := creflect.MarshalToJson(c); ok {
return j, nil return j, nil
} }
return "", errors.New("marshal to json failed.").AtError() return "", errors.New("marshal to json failed.").AtError()
} }
func mergeConfigs(files []*core.ConfigSource) (*conf.Config, error) { func mergeConfigs(files []string, formats []string) (*conf.Config, error) {
cf := &conf.Config{} cf := &conf.Config{}
for i, file := range files { for i, file := range files {
errors.LogInfo(context.Background(), "Reading config: ", file) errors.LogInfo(context.Background(), "Reading config: ", file)
r, err := confloader.LoadConfig(file.Name) r, err := confloader.LoadConfig(file)
if err != nil { if err != nil {
return nil, errors.New("failed to read config: ", file).Base(err) return nil, errors.New("failed to read config: ", file).Base(err)
} }
c, err := ReaderDecoderByFormat[file.Format](r) c, err := ReaderDecoderByFormat[formats[i]](r)
if err != nil { if err != nil {
return nil, errors.New("failed to decode config: ", file).Base(err) return nil, errors.New("failed to decode config: ", file).Base(err)
} }
@@ -39,13 +39,13 @@ func mergeConfigs(files []*core.ConfigSource) (*conf.Config, error) {
*cf = *c *cf = *c
continue continue
} }
cf.Override(c, file.Name) cf.Override(c, file)
} }
return cf, nil return cf, nil
} }
func BuildConfig(files []*core.ConfigSource) (*core.Config, error) { func BuildConfig(files []string, formats []string) (*core.Config, error) {
config, err := mergeConfigs(files) config, err := mergeConfigs(files, formats)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@@ -229,22 +229,8 @@ type SplitHTTPConfig struct {
Host string `json:"host"` Host string `json:"host"`
Path string `json:"path"` Path string `json:"path"`
Headers map[string]string `json:"headers"` Headers map[string]string `json:"headers"`
ScMaxConcurrentPosts *Int32Range `json:"scMaxConcurrentPosts"` MaxConcurrentUploads int32 `json:"maxConcurrentUploads"`
ScMaxEachPostBytes *Int32Range `json:"scMaxEachPostBytes"` MaxUploadSize int32 `json:"maxUploadSize"`
ScMinPostsIntervalMs *Int32Range `json:"scMinPostsIntervalMs"`
NoSSEHeader bool `json:"noSSEHeader"`
XPaddingBytes *Int32Range `json:"xPaddingBytes"`
}
func splithttpNewRandRangeConfig(input *Int32Range) *splithttp.RandRangeConfig {
if input == nil {
return nil
}
return &splithttp.RandRangeConfig{
From: input.From,
To: input.To,
}
} }
// Build implements Buildable. // Build implements Buildable.
@@ -261,11 +247,8 @@ func (c *SplitHTTPConfig) Build() (proto.Message, error) {
Path: c.Path, Path: c.Path,
Host: c.Host, Host: c.Host,
Header: c.Headers, Header: c.Headers,
ScMaxConcurrentPosts: splithttpNewRandRangeConfig(c.ScMaxConcurrentPosts), MaxConcurrentUploads: c.MaxConcurrentUploads,
ScMaxEachPostBytes: splithttpNewRandRangeConfig(c.ScMaxEachPostBytes), MaxUploadSize: c.MaxUploadSize,
ScMinPostsIntervalMs: splithttpNewRandRangeConfig(c.ScMinPostsIntervalMs),
NoSSEHeader: c.NoSSEHeader,
XPaddingBytes: splithttpNewRandRangeConfig(c.XPaddingBytes),
} }
return config, nil return config, nil
} }
@@ -389,7 +372,6 @@ type TLSCertConfig struct {
Usage string `json:"usage"` Usage string `json:"usage"`
OcspStapling uint64 `json:"ocspStapling"` OcspStapling uint64 `json:"ocspStapling"`
OneTimeLoading bool `json:"oneTimeLoading"` OneTimeLoading bool `json:"oneTimeLoading"`
BuildChain bool `json:"buildChain"`
} }
// Build implements Buildable. // Build implements Buildable.
@@ -428,7 +410,6 @@ func (c *TLSCertConfig) Build() (*tls.Certificate, error) {
certificate.OneTimeLoading = c.OneTimeLoading certificate.OneTimeLoading = c.OneTimeLoading
} }
certificate.OcspStapling = c.OcspStapling certificate.OcspStapling = c.OcspStapling
certificate.BuildChain = c.BuildChain
return certificate, nil return certificate, nil
} }
@@ -704,13 +685,6 @@ func (p TransportProtocol) Build() (string, error) {
} }
} }
type CustomSockoptConfig struct {
Level string `json:"level"`
Opt string `json:"opt"`
Value string `json:"value"`
Type string `json:"type"`
}
type SocketConfig struct { type SocketConfig struct {
Mark int32 `json:"mark"` Mark int32 `json:"mark"`
TFO interface{} `json:"tcpFastOpen"` TFO interface{} `json:"tcpFastOpen"`
@@ -728,7 +702,6 @@ type SocketConfig struct {
V6only bool `json:"v6only"` V6only bool `json:"v6only"`
Interface string `json:"interface"` Interface string `json:"interface"`
TcpMptcp bool `json:"tcpMptcp"` TcpMptcp bool `json:"tcpMptcp"`
CustomSockopt []*CustomSockoptConfig `json:"customSockopt"`
} }
// Build implements Buildable. // Build implements Buildable.
@@ -786,18 +759,6 @@ func (c *SocketConfig) Build() (*internet.SocketConfig, error) {
return nil, errors.New("unsupported domain strategy: ", c.DomainStrategy) return nil, errors.New("unsupported domain strategy: ", c.DomainStrategy)
} }
var customSockopts []*internet.CustomSockopt
for _, copt := range c.CustomSockopt {
customSockopt := &internet.CustomSockopt{
Level: copt.Level,
Opt: copt.Opt,
Value: copt.Value,
Type: copt.Type,
}
customSockopts = append(customSockopts, customSockopt)
}
return &internet.SocketConfig{ return &internet.SocketConfig{
Mark: c.Mark, Mark: c.Mark,
Tfo: tfo, Tfo: tfo,
@@ -815,7 +776,6 @@ func (c *SocketConfig) Build() (*internet.SocketConfig, error) {
V6Only: c.V6only, V6Only: c.V6only,
Interface: c.Interface, Interface: c.Interface,
TcpMptcp: c.TcpMptcp, TcpMptcp: c.TcpMptcp,
CustomSockopt: customSockopts,
}, nil }, nil
} }

View File

@@ -13,10 +13,10 @@ import (
"time" "time"
"google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/credentials/insecure"
"google.golang.org/protobuf/encoding/protojson"
"github.com/xtls/xray-core/common/buf" "github.com/xtls/xray-core/common/buf"
"github.com/xtls/xray-core/main/commands/base" "github.com/xtls/xray-core/main/commands/base"
creflect "github.com/xtls/xray-core/common/reflect"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/protobuf/proto" "google.golang.org/protobuf/proto"
) )
@@ -107,16 +107,20 @@ func fetchHTTPContent(target string) ([]byte, error) {
return content, nil return content, nil
} }
func protoToJSONString(m proto.Message, prefix, indent string) (string, error) {
return strings.TrimSpace(protojson.MarshalOptions{Indent: indent}.Format(m)), nil
}
func showJSONResponse(m proto.Message) { func showJSONResponse(m proto.Message) {
if isNil(m) { if isNil(m) {
return return
} }
if j, ok := creflect.MarshalToJson(m, true); ok { output, err := protoToJSONString(m, "", " ")
fmt.Println(j) if err != nil {
} else {
fmt.Fprintf(os.Stdout, "%v\n", m) fmt.Fprintf(os.Stdout, "%v\n", m)
base.Fatalf("error encode json") base.Fatalf("error encode json: %s", err)
} }
fmt.Println(output)
} }
func isNil(i interface{}) bool { func isNil(i interface{}) bool {

View File

@@ -2,7 +2,6 @@ package all
import ( import (
"github.com/xtls/xray-core/main/commands/all/api" "github.com/xtls/xray-core/main/commands/all/api"
"github.com/xtls/xray-core/main/commands/all/convert"
"github.com/xtls/xray-core/main/commands/all/tls" "github.com/xtls/xray-core/main/commands/all/tls"
"github.com/xtls/xray-core/main/commands/base" "github.com/xtls/xray-core/main/commands/base"
) )
@@ -13,7 +12,7 @@ func init() {
base.RootCommand.Commands = append( base.RootCommand.Commands = append(
base.RootCommand.Commands, base.RootCommand.Commands,
api.CmdAPI, api.CmdAPI,
convert.CmdConvert, // cmdConvert,
tls.CmdTLS, tls.CmdTLS,
cmdUUID, cmdUUID,
cmdX25519, cmdX25519,

View File

@@ -0,0 +1,126 @@
package all
import (
"bytes"
"fmt"
"io"
"net/http"
"net/url"
"os"
"strings"
"time"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/buf"
"github.com/xtls/xray-core/common/errors"
"github.com/xtls/xray-core/infra/conf"
"github.com/xtls/xray-core/infra/conf/serial"
"github.com/xtls/xray-core/main/commands/base"
"google.golang.org/protobuf/proto"
)
var cmdConvert = &base.Command{
UsageLine: "{{.Exec}} convert [json file] [json file] ...",
Short: "Convert multiple json config to protobuf",
Long: `
Convert multiple json config to protobuf.
Examples:
{{.Exec}} convert config.json c1.json c2.json <url>.json
`,
}
func init() {
cmdConvert.Run = executeConvert // break init loop
}
func executeConvert(cmd *base.Command, args []string) {
unnamedArgs := cmdConvert.Flag.Args()
if len(unnamedArgs) < 1 {
base.Fatalf("empty config list")
}
conf := &conf.Config{}
for _, arg := range unnamedArgs {
fmt.Fprintf(os.Stderr, "Read config: %s", arg)
r, err := loadArg(arg)
common.Must(err)
c, err := serial.DecodeJSONConfig(r)
if err != nil {
base.Fatalf(err.Error())
}
conf.Override(c, arg)
}
pbConfig, err := conf.Build()
if err != nil {
base.Fatalf(err.Error())
}
bytesConfig, err := proto.Marshal(pbConfig)
if err != nil {
base.Fatalf("failed to marshal proto config: %s", err)
}
if _, err := os.Stdout.Write(bytesConfig); err != nil {
base.Fatalf("failed to write proto config: %s", err)
}
}
// loadArg loads one arg, maybe an remote url, or local file path
func loadArg(arg string) (out io.Reader, err error) {
var data []byte
switch {
case strings.HasPrefix(arg, "http://"), strings.HasPrefix(arg, "https://"):
data, err = FetchHTTPContent(arg)
case arg == "stdin:":
data, err = io.ReadAll(os.Stdin)
default:
data, err = os.ReadFile(arg)
}
if err != nil {
return
}
out = bytes.NewBuffer(data)
return
}
// FetchHTTPContent dials https for remote content
func FetchHTTPContent(target string) ([]byte, error) {
parsedTarget, err := url.Parse(target)
if err != nil {
return nil, errors.New("invalid URL: ", target).Base(err)
}
if s := strings.ToLower(parsedTarget.Scheme); s != "http" && s != "https" {
return nil, errors.New("invalid scheme: ", parsedTarget.Scheme)
}
client := &http.Client{
Timeout: 30 * time.Second,
}
resp, err := client.Do(&http.Request{
Method: "GET",
URL: parsedTarget,
Close: true,
})
if err != nil {
return nil, errors.New("failed to dial to ", target).Base(err)
}
defer resp.Body.Close()
if resp.StatusCode != 200 {
return nil, errors.New("unexpected HTTP status code: ", resp.StatusCode)
}
content, err := buf.ReadAllToBytes(resp.Body)
if err != nil {
return nil, errors.New("failed to read HTTP response").Base(err)
}
return content, nil
}

View File

@@ -1,17 +0,0 @@
package convert
import (
"github.com/xtls/xray-core/main/commands/base"
)
// CmdConvert do config convertion
var CmdConvert = &base.Command{
UsageLine: "{{.Exec}} convert",
Short: "Convert configs",
Long: `{{.Exec}} {{.LongName}} provides tools to convert config.
`,
Commands: []*base.Command{
cmdProtobuf,
cmdJson,
},
}

View File

@@ -1,71 +0,0 @@
package convert
import (
"encoding/json"
"fmt"
"io"
creflect "github.com/xtls/xray-core/common/reflect"
cserial "github.com/xtls/xray-core/common/serial"
"github.com/xtls/xray-core/main/commands/base"
"github.com/xtls/xray-core/main/confloader"
)
var cmdJson = &base.Command{
CustomFlags: true,
UsageLine: "{{.Exec}} convert json [-type] [stdin:] [typedMessage file] ",
Short: "Convert typedMessage to json",
Long: `
Convert ONE typedMessage to json.
Where typedMessage file need to be in the following format:
{
"type": "xray.proxy.shadowsocks.Account",
"value": "CgMxMTEQBg=="
}
Arguments:
-t, -type
Inject type infomation.
Examples:
{{.Exec}} convert json user.tmsg
`,
Run: executeTypedMessageToJson,
}
func executeTypedMessageToJson(cmd *base.Command, args []string) {
var injectTypeInfo bool
cmd.Flag.BoolVar(&injectTypeInfo, "t", false, "")
cmd.Flag.BoolVar(&injectTypeInfo, "type", false, "")
cmd.Flag.Parse(args)
if cmd.Flag.NArg() < 1 {
base.Fatalf("empty input list")
}
reader, err := confloader.LoadConfig(cmd.Flag.Arg(0))
if err != nil {
base.Fatalf(err.Error())
}
b, err := io.ReadAll(reader)
if err != nil {
base.Fatalf(err.Error())
}
tm := cserial.TypedMessage{}
if err = json.Unmarshal(b, &tm); err != nil {
base.Fatalf(err.Error())
}
if j, ok := creflect.MarshalToJson(&tm, injectTypeInfo); ok {
fmt.Println(j)
} else {
base.Fatalf("marshal TypedMessage to json failed")
}
}

View File

@@ -1,81 +0,0 @@
package convert
import (
"fmt"
"os"
"github.com/xtls/xray-core/common/cmdarg"
creflect "github.com/xtls/xray-core/common/reflect"
"github.com/xtls/xray-core/core"
"github.com/xtls/xray-core/main/commands/base"
"google.golang.org/protobuf/proto"
)
var cmdProtobuf = &base.Command{
CustomFlags: true,
UsageLine: "{{.Exec}} convert pb [-debug] [-type] [json file] [json file] ...",
Short: "Convert multiple json configs to protobuf",
Long: `
Convert multiple json configs to protobuf.
Arguments:
-d, -debug
Show mix.pb as json.
FOR DEBUGGING ONLY!
DO NOT PASS THIS OUTPUT TO XRAY-CORE!
-t, -type
Inject type information into debug output.
Examples:
{{.Exec}} convert pb config.json c1.json c2.json c3.json > mix.pb
`,
Run: executeConvertConfigsToProtobuf,
}
func executeConvertConfigsToProtobuf(cmd *base.Command, args []string) {
var optDump bool
var optType bool
cmd.Flag.BoolVar(&optDump, "d", false, "")
cmd.Flag.BoolVar(&optDump, "debug", false, "")
cmd.Flag.BoolVar(&optType, "t", false, "")
cmd.Flag.BoolVar(&optType, "type", false, "")
cmd.Flag.Parse(args)
unnamedArgs := cmdarg.Arg{}
for _, v := range cmd.Flag.Args() {
unnamedArgs.Set(v)
}
if len(unnamedArgs) < 1 {
base.Fatalf("empty config list")
}
pbConfig, err := core.LoadConfig("auto", unnamedArgs)
if err != nil {
base.Fatalf(err.Error())
}
if optDump {
if j, ok := creflect.MarshalToJson(pbConfig, optType); ok {
fmt.Println(j)
return
} else {
base.Fatalf("failed to marshal proto config to json.")
}
}
bytesConfig, err := proto.Marshal(pbConfig)
if err != nil {
base.Fatalf("failed to marshal proto config: %s", err)
}
if _, err := os.Stdout.Write(bytesConfig); err != nil {
base.Fatalf("failed to write proto config: %s", err)
}
}

View File

@@ -1,8 +1,13 @@
package base package base
import (
"os"
"path"
)
// CommandEnvHolder is a struct holds the environment info of commands // CommandEnvHolder is a struct holds the environment info of commands
type CommandEnvHolder struct { type CommandEnvHolder struct {
// Executable name of current binary // Excutable name of current binary
Exec string Exec string
// commands column width of current command // commands column width of current command
CommandsWidth int CommandsWidth int
@@ -12,12 +17,10 @@ type CommandEnvHolder struct {
var CommandEnv CommandEnvHolder var CommandEnv CommandEnvHolder
func init() { func init() {
/*
exec, err := os.Executable() exec, err := os.Executable()
if err != nil { if err != nil {
return return
} }
CommandEnv.Exec = path.Base(exec) CommandEnv.Exec = path.Base(exec)
*/
CommandEnv.Exec = "xray" CommandEnv.Exec = "xray"
} }

View File

@@ -12,7 +12,7 @@ import (
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// copied from "github.com/golang/go/main.go" // copied from "github.com/golang/go/main.go"
// Execute execute the commands // Execute excute the commands
func Execute() { func Execute() {
flag.Parse() flag.Parse()
args := flag.Args() args := flag.Args()

View File

@@ -43,7 +43,7 @@ func init() {
case io.Reader: case io.Reader:
return serial.LoadJSONConfig(v) return serial.LoadJSONConfig(v)
default: default:
return nil, errors.New("unknown type") return nil, errors.New("unknow type")
} }
}, },
})) }))

View File

@@ -43,7 +43,7 @@ func init() {
case io.Reader: case io.Reader:
return serial.LoadTOMLConfig(v) return serial.LoadTOMLConfig(v)
default: default:
return nil, errors.New("unknown type") return nil, errors.New("unknow type")
} }
}, },
})) }))

View File

@@ -43,7 +43,7 @@ func init() {
case io.Reader: case io.Reader:
return serial.LoadYAMLConfig(v) return serial.LoadYAMLConfig(v)
default: default:
return nil, errors.New("unknown type") return nil, errors.New("unknow type")
} }
}, },
})) }))

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.34.2 // protoc-gen-go v1.34.1
// protoc v5.27.0 // protoc v5.27.0
// source: proxy/blackhole/config.proto // source: proxy/blackhole/config.proto
@@ -181,7 +181,7 @@ func file_proxy_blackhole_config_proto_rawDescGZIP() []byte {
} }
var file_proxy_blackhole_config_proto_msgTypes = make([]protoimpl.MessageInfo, 3) var file_proxy_blackhole_config_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_proxy_blackhole_config_proto_goTypes = []any{ var file_proxy_blackhole_config_proto_goTypes = []interface{}{
(*NoneResponse)(nil), // 0: xray.proxy.blackhole.NoneResponse (*NoneResponse)(nil), // 0: xray.proxy.blackhole.NoneResponse
(*HTTPResponse)(nil), // 1: xray.proxy.blackhole.HTTPResponse (*HTTPResponse)(nil), // 1: xray.proxy.blackhole.HTTPResponse
(*Config)(nil), // 2: xray.proxy.blackhole.Config (*Config)(nil), // 2: xray.proxy.blackhole.Config
@@ -202,7 +202,7 @@ func file_proxy_blackhole_config_proto_init() {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_proxy_blackhole_config_proto_msgTypes[0].Exporter = func(v any, i int) any { file_proxy_blackhole_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*NoneResponse); i { switch v := v.(*NoneResponse); i {
case 0: case 0:
return &v.state return &v.state
@@ -214,7 +214,7 @@ func file_proxy_blackhole_config_proto_init() {
return nil return nil
} }
} }
file_proxy_blackhole_config_proto_msgTypes[1].Exporter = func(v any, i int) any { file_proxy_blackhole_config_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*HTTPResponse); i { switch v := v.(*HTTPResponse); i {
case 0: case 0:
return &v.state return &v.state
@@ -226,7 +226,7 @@ func file_proxy_blackhole_config_proto_init() {
return nil return nil
} }
} }
file_proxy_blackhole_config_proto_msgTypes[2].Exporter = func(v any, i int) any { file_proxy_blackhole_config_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Config); i { switch v := v.(*Config); i {
case 0: case 0:
return &v.state return &v.state

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.34.2 // protoc-gen-go v1.34.1
// protoc v5.27.0 // protoc v5.27.0
// source: proxy/dns/config.proto // source: proxy/dns/config.proto
@@ -122,7 +122,7 @@ func file_proxy_dns_config_proto_rawDescGZIP() []byte {
} }
var file_proxy_dns_config_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_proxy_dns_config_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_proxy_dns_config_proto_goTypes = []any{ var file_proxy_dns_config_proto_goTypes = []interface{}{
(*Config)(nil), // 0: xray.proxy.dns.Config (*Config)(nil), // 0: xray.proxy.dns.Config
(*net.Endpoint)(nil), // 1: xray.common.net.Endpoint (*net.Endpoint)(nil), // 1: xray.common.net.Endpoint
} }
@@ -141,7 +141,7 @@ func file_proxy_dns_config_proto_init() {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_proxy_dns_config_proto_msgTypes[0].Exporter = func(v any, i int) any { file_proxy_dns_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Config); i { switch v := v.(*Config); i {
case 0: case 0:
return &v.state return &v.state

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.34.2 // protoc-gen-go v1.34.1
// protoc v5.27.0 // protoc v5.27.0
// source: proxy/dokodemo/config.proto // source: proxy/dokodemo/config.proto
@@ -175,7 +175,7 @@ func file_proxy_dokodemo_config_proto_rawDescGZIP() []byte {
} }
var file_proxy_dokodemo_config_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_proxy_dokodemo_config_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_proxy_dokodemo_config_proto_goTypes = []any{ var file_proxy_dokodemo_config_proto_goTypes = []interface{}{
(*Config)(nil), // 0: xray.proxy.dokodemo.Config (*Config)(nil), // 0: xray.proxy.dokodemo.Config
(*net.IPOrDomain)(nil), // 1: xray.common.net.IPOrDomain (*net.IPOrDomain)(nil), // 1: xray.common.net.IPOrDomain
(*net.NetworkList)(nil), // 2: xray.common.net.NetworkList (*net.NetworkList)(nil), // 2: xray.common.net.NetworkList
@@ -198,7 +198,7 @@ func file_proxy_dokodemo_config_proto_init() {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_proxy_dokodemo_config_proto_msgTypes[0].Exporter = func(v any, i int) any { file_proxy_dokodemo_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Config); i { switch v := v.(*Config); i {
case 0: case 0:
return &v.state return &v.state

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.34.2 // protoc-gen-go v1.34.1
// protoc v5.27.0 // protoc v5.27.0
// source: proxy/freedom/config.proto // source: proxy/freedom/config.proto
@@ -91,7 +91,7 @@ func (x Config_DomainStrategy) Number() protoreflect.EnumNumber {
// Deprecated: Use Config_DomainStrategy.Descriptor instead. // Deprecated: Use Config_DomainStrategy.Descriptor instead.
func (Config_DomainStrategy) EnumDescriptor() ([]byte, []int) { func (Config_DomainStrategy) EnumDescriptor() ([]byte, []int) {
return file_proxy_freedom_config_proto_rawDescGZIP(), []int{3, 0} return file_proxy_freedom_config_proto_rawDescGZIP(), []int{2, 0}
} }
type DestinationOverride struct { type DestinationOverride struct {
@@ -228,85 +228,6 @@ func (x *Fragment) GetIntervalMax() uint64 {
return 0 return 0
} }
type Noise struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
LengthMin uint64 `protobuf:"varint,1,opt,name=length_min,json=lengthMin,proto3" json:"length_min,omitempty"`
LengthMax uint64 `protobuf:"varint,2,opt,name=length_max,json=lengthMax,proto3" json:"length_max,omitempty"`
DelayMin uint64 `protobuf:"varint,3,opt,name=delay_min,json=delayMin,proto3" json:"delay_min,omitempty"`
DelayMax uint64 `protobuf:"varint,4,opt,name=delay_max,json=delayMax,proto3" json:"delay_max,omitempty"`
StrNoise string `protobuf:"bytes,5,opt,name=str_noise,json=strNoise,proto3" json:"str_noise,omitempty"`
}
func (x *Noise) Reset() {
*x = Noise{}
if protoimpl.UnsafeEnabled {
mi := &file_proxy_freedom_config_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Noise) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Noise) ProtoMessage() {}
func (x *Noise) ProtoReflect() protoreflect.Message {
mi := &file_proxy_freedom_config_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Noise.ProtoReflect.Descriptor instead.
func (*Noise) Descriptor() ([]byte, []int) {
return file_proxy_freedom_config_proto_rawDescGZIP(), []int{2}
}
func (x *Noise) GetLengthMin() uint64 {
if x != nil {
return x.LengthMin
}
return 0
}
func (x *Noise) GetLengthMax() uint64 {
if x != nil {
return x.LengthMax
}
return 0
}
func (x *Noise) GetDelayMin() uint64 {
if x != nil {
return x.DelayMin
}
return 0
}
func (x *Noise) GetDelayMax() uint64 {
if x != nil {
return x.DelayMax
}
return 0
}
func (x *Noise) GetStrNoise() string {
if x != nil {
return x.StrNoise
}
return ""
}
type Config struct { type Config struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
@@ -319,13 +240,12 @@ type Config struct {
UserLevel uint32 `protobuf:"varint,4,opt,name=user_level,json=userLevel,proto3" json:"user_level,omitempty"` UserLevel uint32 `protobuf:"varint,4,opt,name=user_level,json=userLevel,proto3" json:"user_level,omitempty"`
Fragment *Fragment `protobuf:"bytes,5,opt,name=fragment,proto3" json:"fragment,omitempty"` Fragment *Fragment `protobuf:"bytes,5,opt,name=fragment,proto3" json:"fragment,omitempty"`
ProxyProtocol uint32 `protobuf:"varint,6,opt,name=proxy_protocol,json=proxyProtocol,proto3" json:"proxy_protocol,omitempty"` ProxyProtocol uint32 `protobuf:"varint,6,opt,name=proxy_protocol,json=proxyProtocol,proto3" json:"proxy_protocol,omitempty"`
Noise *Noise `protobuf:"bytes,7,opt,name=noise,proto3" json:"noise,omitempty"`
} }
func (x *Config) Reset() { func (x *Config) Reset() {
*x = Config{} *x = Config{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_proxy_freedom_config_proto_msgTypes[3] mi := &file_proxy_freedom_config_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -338,7 +258,7 @@ func (x *Config) String() string {
func (*Config) ProtoMessage() {} func (*Config) ProtoMessage() {}
func (x *Config) ProtoReflect() protoreflect.Message { func (x *Config) ProtoReflect() protoreflect.Message {
mi := &file_proxy_freedom_config_proto_msgTypes[3] mi := &file_proxy_freedom_config_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -351,7 +271,7 @@ func (x *Config) ProtoReflect() protoreflect.Message {
// Deprecated: Use Config.ProtoReflect.Descriptor instead. // Deprecated: Use Config.ProtoReflect.Descriptor instead.
func (*Config) Descriptor() ([]byte, []int) { func (*Config) Descriptor() ([]byte, []int) {
return file_proxy_freedom_config_proto_rawDescGZIP(), []int{3} return file_proxy_freedom_config_proto_rawDescGZIP(), []int{2}
} }
func (x *Config) GetDomainStrategy() Config_DomainStrategy { func (x *Config) GetDomainStrategy() Config_DomainStrategy {
@@ -397,13 +317,6 @@ func (x *Config) GetProxyProtocol() uint32 {
return 0 return 0
} }
func (x *Config) GetNoise() *Noise {
if x != nil {
return x.Noise
}
return nil
}
var File_proxy_freedom_config_proto protoreflect.FileDescriptor var File_proxy_freedom_config_proto protoreflect.FileDescriptor
var file_proxy_freedom_config_proto_rawDesc = []byte{ var file_proxy_freedom_config_proto_rawDesc = []byte{
@@ -430,42 +343,29 @@ var file_proxy_freedom_config_proto_rawDesc = []byte{
0x6c, 0x5f, 0x6d, 0x69, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x69, 0x6e, 0x74, 0x6c, 0x5f, 0x6d, 0x69, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x69, 0x6e, 0x74,
0x65, 0x72, 0x76, 0x61, 0x6c, 0x4d, 0x69, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x6e, 0x74, 0x65, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x4d, 0x69, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x6e, 0x74, 0x65,
0x72, 0x76, 0x61, 0x6c, 0x5f, 0x6d, 0x61, 0x78, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x72, 0x76, 0x61, 0x6c, 0x5f, 0x6d, 0x61, 0x78, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b,
0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x4d, 0x61, 0x78, 0x22, 0x9c, 0x01, 0x0a, 0x05, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x4d, 0x61, 0x78, 0x22, 0x82, 0x04, 0x0a, 0x06,
0x4e, 0x6f, 0x69, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x5f, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x52, 0x0a, 0x0f, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e,
0x6d, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32,
0x68, 0x4d, 0x69, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x5f, 0x6d, 0x29, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x66, 0x72, 0x65,
0x61, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x65, 0x64, 0x6f, 0x6d, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x44, 0x6f, 0x6d, 0x61,
0x4d, 0x61, 0x78, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x65, 0x6c, 0x61, 0x79, 0x5f, 0x6d, 0x69, 0x6e, 0x69, 0x6e, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x52, 0x0e, 0x64, 0x6f, 0x6d, 0x61,
0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x64, 0x65, 0x6c, 0x61, 0x79, 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x12, 0x1c, 0x0a, 0x07, 0x74, 0x69,
0x12, 0x1b, 0x0a, 0x09, 0x64, 0x65, 0x6c, 0x61, 0x79, 0x5f, 0x6d, 0x61, 0x78, 0x18, 0x04, 0x20, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x42, 0x02, 0x18, 0x01, 0x52,
0x01, 0x28, 0x04, 0x52, 0x08, 0x64, 0x65, 0x6c, 0x61, 0x79, 0x4d, 0x61, 0x78, 0x12, 0x1b, 0x0a, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x5a, 0x0a, 0x14, 0x64, 0x65, 0x73, 0x74,
0x09, 0x73, 0x74, 0x72, 0x5f, 0x6e, 0x6f, 0x69, 0x73, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65,
0x52, 0x08, 0x73, 0x74, 0x72, 0x4e, 0x6f, 0x69, 0x73, 0x65, 0x22, 0xb3, 0x04, 0x0a, 0x06, 0x43, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x70, 0x72,
0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x52, 0x0a, 0x0f, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x5f, 0x6f, 0x78, 0x79, 0x2e, 0x66, 0x72, 0x65, 0x65, 0x64, 0x6f, 0x6d, 0x2e, 0x44, 0x65, 0x73, 0x74,
0x73, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x29, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x52,
0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x66, 0x72, 0x65, 0x65, 0x13, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x76, 0x65, 0x72,
0x64, 0x6f, 0x6d, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x72, 0x69, 0x64, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6c, 0x65, 0x76,
0x6e, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x52, 0x0e, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x65, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x75, 0x73, 0x65, 0x72, 0x4c, 0x65,
0x6e, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x12, 0x1c, 0x0a, 0x07, 0x74, 0x69, 0x6d, 0x76, 0x65, 0x6c, 0x12, 0x38, 0x0a, 0x08, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x18,
0x65, 0x6f, 0x75, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x42, 0x02, 0x18, 0x01, 0x52, 0x07, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x5a, 0x0a, 0x14, 0x64, 0x65, 0x73, 0x74, 0x69, 0x78, 0x79, 0x2e, 0x66, 0x72, 0x65, 0x65, 0x64, 0x6f, 0x6d, 0x2e, 0x46, 0x72, 0x61, 0x67, 0x6d,
0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x18, 0x65, 0x6e, 0x74, 0x52, 0x08, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x25, 0x0a,
0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x0e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18,
0x78, 0x79, 0x2e, 0x66, 0x72, 0x65, 0x65, 0x64, 0x6f, 0x6d, 0x2e, 0x44, 0x65, 0x73, 0x74, 0x69, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0d, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x50, 0x72, 0x6f, 0x74,
0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x52, 0x13, 0x6f, 0x63, 0x6f, 0x6c, 0x22, 0xa9, 0x01, 0x0a, 0x0e, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x53,
0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x76, 0x65, 0x72, 0x72,
0x69, 0x64, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6c, 0x65, 0x76, 0x65,
0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x75, 0x73, 0x65, 0x72, 0x4c, 0x65, 0x76,
0x65, 0x6c, 0x12, 0x38, 0x0a, 0x08, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x78,
0x79, 0x2e, 0x66, 0x72, 0x65, 0x65, 0x64, 0x6f, 0x6d, 0x2e, 0x46, 0x72, 0x61, 0x67, 0x6d, 0x65,
0x6e, 0x74, 0x52, 0x08, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x25, 0x0a, 0x0e,
0x70, 0x72, 0x6f, 0x78, 0x79, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x06,
0x20, 0x01, 0x28, 0x0d, 0x52, 0x0d, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f,
0x63, 0x6f, 0x6c, 0x12, 0x2f, 0x0a, 0x05, 0x6e, 0x6f, 0x69, 0x73, 0x65, 0x18, 0x07, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x19, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e,
0x66, 0x72, 0x65, 0x65, 0x64, 0x6f, 0x6d, 0x2e, 0x4e, 0x6f, 0x69, 0x73, 0x65, 0x52, 0x05, 0x6e,
0x6f, 0x69, 0x73, 0x65, 0x22, 0xa9, 0x01, 0x0a, 0x0e, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x53,
0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x53, 0x5f, 0x49, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x53, 0x5f, 0x49, 0x53,
0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x55, 0x53, 0x45, 0x5f, 0x49, 0x50, 0x10, 0x01, 0x12, 0x0b, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x55, 0x53, 0x45, 0x5f, 0x49, 0x50, 0x10, 0x01, 0x12, 0x0b,
0x0a, 0x07, 0x55, 0x53, 0x45, 0x5f, 0x49, 0x50, 0x34, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x0a, 0x07, 0x55, 0x53, 0x45, 0x5f, 0x49, 0x50, 0x34, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x55,
@@ -498,26 +398,24 @@ func file_proxy_freedom_config_proto_rawDescGZIP() []byte {
} }
var file_proxy_freedom_config_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_proxy_freedom_config_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_proxy_freedom_config_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_proxy_freedom_config_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_proxy_freedom_config_proto_goTypes = []any{ var file_proxy_freedom_config_proto_goTypes = []interface{}{
(Config_DomainStrategy)(0), // 0: xray.proxy.freedom.Config.DomainStrategy (Config_DomainStrategy)(0), // 0: xray.proxy.freedom.Config.DomainStrategy
(*DestinationOverride)(nil), // 1: xray.proxy.freedom.DestinationOverride (*DestinationOverride)(nil), // 1: xray.proxy.freedom.DestinationOverride
(*Fragment)(nil), // 2: xray.proxy.freedom.Fragment (*Fragment)(nil), // 2: xray.proxy.freedom.Fragment
(*Noise)(nil), // 3: xray.proxy.freedom.Noise (*Config)(nil), // 3: xray.proxy.freedom.Config
(*Config)(nil), // 4: xray.proxy.freedom.Config (*protocol.ServerEndpoint)(nil), // 4: xray.common.protocol.ServerEndpoint
(*protocol.ServerEndpoint)(nil), // 5: xray.common.protocol.ServerEndpoint
} }
var file_proxy_freedom_config_proto_depIdxs = []int32{ var file_proxy_freedom_config_proto_depIdxs = []int32{
5, // 0: xray.proxy.freedom.DestinationOverride.server:type_name -> xray.common.protocol.ServerEndpoint 4, // 0: xray.proxy.freedom.DestinationOverride.server:type_name -> xray.common.protocol.ServerEndpoint
0, // 1: xray.proxy.freedom.Config.domain_strategy:type_name -> xray.proxy.freedom.Config.DomainStrategy 0, // 1: xray.proxy.freedom.Config.domain_strategy:type_name -> xray.proxy.freedom.Config.DomainStrategy
1, // 2: xray.proxy.freedom.Config.destination_override:type_name -> xray.proxy.freedom.DestinationOverride 1, // 2: xray.proxy.freedom.Config.destination_override:type_name -> xray.proxy.freedom.DestinationOverride
2, // 3: xray.proxy.freedom.Config.fragment:type_name -> xray.proxy.freedom.Fragment 2, // 3: xray.proxy.freedom.Config.fragment:type_name -> xray.proxy.freedom.Fragment
3, // 4: xray.proxy.freedom.Config.noise:type_name -> xray.proxy.freedom.Noise 4, // [4:4] is the sub-list for method output_type
5, // [5:5] is the sub-list for method output_type 4, // [4:4] is the sub-list for method input_type
5, // [5:5] is the sub-list for method input_type 4, // [4:4] is the sub-list for extension type_name
5, // [5:5] is the sub-list for extension type_name 4, // [4:4] is the sub-list for extension extendee
5, // [5:5] is the sub-list for extension extendee 0, // [0:4] is the sub-list for field type_name
0, // [0:5] is the sub-list for field type_name
} }
func init() { file_proxy_freedom_config_proto_init() } func init() { file_proxy_freedom_config_proto_init() }
@@ -526,7 +424,7 @@ func file_proxy_freedom_config_proto_init() {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_proxy_freedom_config_proto_msgTypes[0].Exporter = func(v any, i int) any { file_proxy_freedom_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DestinationOverride); i { switch v := v.(*DestinationOverride); i {
case 0: case 0:
return &v.state return &v.state
@@ -538,7 +436,7 @@ func file_proxy_freedom_config_proto_init() {
return nil return nil
} }
} }
file_proxy_freedom_config_proto_msgTypes[1].Exporter = func(v any, i int) any { file_proxy_freedom_config_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Fragment); i { switch v := v.(*Fragment); i {
case 0: case 0:
return &v.state return &v.state
@@ -550,19 +448,7 @@ func file_proxy_freedom_config_proto_init() {
return nil return nil
} }
} }
file_proxy_freedom_config_proto_msgTypes[2].Exporter = func(v any, i int) any { file_proxy_freedom_config_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Noise); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_proxy_freedom_config_proto_msgTypes[3].Exporter = func(v any, i int) any {
switch v := v.(*Config); i { switch v := v.(*Config); i {
case 0: case 0:
return &v.state return &v.state
@@ -581,7 +467,7 @@ func file_proxy_freedom_config_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_proxy_freedom_config_proto_rawDesc, RawDescriptor: file_proxy_freedom_config_proto_rawDesc,
NumEnums: 1, NumEnums: 1,
NumMessages: 4, NumMessages: 3,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,
}, },

View File

@@ -20,13 +20,6 @@ message Fragment {
uint64 interval_min = 5; uint64 interval_min = 5;
uint64 interval_max = 6; uint64 interval_max = 6;
} }
message Noise {
uint64 length_min = 1;
uint64 length_max = 2;
uint64 delay_min = 3;
uint64 delay_max = 4;
string str_noise = 5;
}
message Config { message Config {
enum DomainStrategy { enum DomainStrategy {
@@ -48,5 +41,4 @@ message Config {
uint32 user_level = 4; uint32 user_level = 4;
Fragment fragment = 5; Fragment fragment = 5;
uint32 proxy_protocol = 6; uint32 proxy_protocol = 6;
Noise noise = 7;
} }

View File

@@ -28,7 +28,6 @@ import (
"github.com/xtls/xray-core/transport" "github.com/xtls/xray-core/transport"
"github.com/xtls/xray-core/transport/internet" "github.com/xtls/xray-core/transport/internet"
"github.com/xtls/xray-core/transport/internet/stat" "github.com/xtls/xray-core/transport/internet/stat"
"github.com/xtls/xray-core/transport/internet/tls"
) )
var useSplice bool var useSplice bool
@@ -208,16 +207,6 @@ func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer inte
} }
} else { } else {
writer = NewPacketWriter(conn, h, ctx, UDPOverride) writer = NewPacketWriter(conn, h, ctx, UDPOverride)
if h.config.Noise != nil {
errors.LogDebug(ctx, "NOISE", h.config.Noise.StrNoise, h.config.Noise.LengthMin, h.config.Noise.LengthMax,
h.config.Noise.DelayMin, h.config.Noise.DelayMax)
writer = &NoisePacketWriter{
Writer: writer,
noise: h.config.Noise,
firstWrite: true,
UDPOverride: UDPOverride,
}
}
} }
if err := buf.Copy(input, writer, buf.UpdateActivity(timer)); err != nil { if err := buf.Copy(input, writer, buf.UpdateActivity(timer)); err != nil {
@@ -236,16 +225,9 @@ func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer inte
writeConn = inbound.Conn writeConn = inbound.Conn
inTimer = inbound.Timer inTimer = inbound.Timer
} }
if !isTLSConn(conn) { // it would be tls conn in special use case of MITM, we need to let link handle traffic
return proxy.CopyRawConnIfExist(ctx, conn, writeConn, link.Writer, timer, inTimer) return proxy.CopyRawConnIfExist(ctx, conn, writeConn, link.Writer, timer, inTimer)
} }
} reader := NewPacketReader(conn, UDPOverride)
var reader buf.Reader
if destination.Network == net.Network_TCP {
reader = buf.NewReader(conn)
} else {
reader = NewPacketReader(conn, UDPOverride)
}
if err := buf.Copy(reader, output, buf.UpdateActivity(timer)); err != nil { if err := buf.Copy(reader, output, buf.UpdateActivity(timer)); err != nil {
return errors.New("failed to process response").Base(err) return errors.New("failed to process response").Base(err)
} }
@@ -263,19 +245,6 @@ func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer inte
return nil return nil
} }
func isTLSConn(conn stat.Connection) bool {
if conn != nil {
statConn, ok := conn.(*stat.CounterConnection)
if ok {
conn = statConn.Connection
}
if _, ok := conn.(*tls.Conn); ok {
return true
}
}
return false
}
func NewPacketReader(conn net.Conn, UDPOverride net.Destination) buf.Reader { func NewPacketReader(conn net.Conn, UDPOverride net.Destination) buf.Reader {
iConn := conn iConn := conn
statConn, ok := iConn.(*stat.CounterConnection) statConn, ok := iConn.(*stat.CounterConnection)
@@ -286,9 +255,9 @@ func NewPacketReader(conn net.Conn, UDPOverride net.Destination) buf.Reader {
if statConn != nil { if statConn != nil {
counter = statConn.ReadCounter counter = statConn.ReadCounter
} }
if c, ok := iConn.(net.PacketConn); ok && UDPOverride.Address == nil && UDPOverride.Port == 0 { if c, ok := iConn.(*internet.PacketConnWrapper); ok && UDPOverride.Address == nil && UDPOverride.Port == 0 {
return &PacketReader{ return &PacketReader{
PacketConn: c, PacketConnWrapper: c,
Counter: counter, Counter: counter,
} }
} }
@@ -296,14 +265,14 @@ func NewPacketReader(conn net.Conn, UDPOverride net.Destination) buf.Reader {
} }
type PacketReader struct { type PacketReader struct {
net.PacketConn *internet.PacketConnWrapper
stats.Counter stats.Counter
} }
func (r *PacketReader) ReadMultiBuffer() (buf.MultiBuffer, error) { func (r *PacketReader) ReadMultiBuffer() (buf.MultiBuffer, error) {
b := buf.New() b := buf.New()
b.Resize(0, buf.Size) b.Resize(0, buf.Size)
n, d, err := r.PacketConn.ReadFrom(b.Bytes()) n, d, err := r.PacketConnWrapper.ReadFrom(b.Bytes())
if err != nil { if err != nil {
b.Release() b.Release()
return nil, err return nil, err
@@ -330,27 +299,24 @@ func NewPacketWriter(conn net.Conn, h *Handler, ctx context.Context, UDPOverride
if statConn != nil { if statConn != nil {
counter = statConn.WriteCounter counter = statConn.WriteCounter
} }
if c, ok := iConn.(net.PacketConn); ok { if c, ok := iConn.(*internet.PacketConnWrapper); ok {
return &PacketWriter{ return &PacketWriter{
PacketConn: c, PacketConnWrapper: c,
Counter: counter, Counter: counter,
Handler: h, Handler: h,
Context: ctx, Context: ctx,
UDPOverride: UDPOverride, UDPOverride: UDPOverride,
Conn: iConn,
} }
} }
return &buf.SequentialWriter{Writer: conn} return &buf.SequentialWriter{Writer: conn}
} }
type PacketWriter struct { type PacketWriter struct {
net.PacketConn *internet.PacketConnWrapper
stats.Counter stats.Counter
*Handler *Handler
context.Context context.Context
UDPOverride net.Destination UDPOverride net.Destination
Conn net.Conn
} }
func (w *PacketWriter) WriteMultiBuffer(mb buf.MultiBuffer) error { func (w *PacketWriter) WriteMultiBuffer(mb buf.MultiBuffer) error {
@@ -380,9 +346,9 @@ func (w *PacketWriter) WriteMultiBuffer(mb buf.MultiBuffer) error {
b.Release() b.Release()
continue continue
} }
n, err = w.PacketConn.WriteTo(b.Bytes(), destAddr) n, err = w.PacketConnWrapper.WriteTo(b.Bytes(), destAddr)
} else { } else {
n, err = w.Conn.Write(b.Bytes()) n, err = w.PacketConnWrapper.Write(b.Bytes())
} }
b.Release() b.Release()
if err != nil { if err != nil {
@@ -396,45 +362,6 @@ func (w *PacketWriter) WriteMultiBuffer(mb buf.MultiBuffer) error {
return nil return nil
} }
type NoisePacketWriter struct {
buf.Writer
noise *Noise
firstWrite bool
UDPOverride net.Destination
}
// MultiBuffer writer with Noise in first packet
func (w *NoisePacketWriter) WriteMultiBuffer(mb buf.MultiBuffer) error {
if w.firstWrite {
w.firstWrite = false
//Do not send Noise for dns requests(just to be safe)
if w.UDPOverride.Port == 53 {
return w.Writer.WriteMultiBuffer(mb)
}
var noise []byte
var err error
//User input string
if w.noise.StrNoise != "" {
noise = []byte(w.noise.StrNoise)
} else {
//Random noise
noise, err = GenerateRandomBytes(randBetween(int64(w.noise.LengthMin),
int64(w.noise.LengthMax)))
}
if err != nil {
return err
}
w.Writer.WriteMultiBuffer(buf.MultiBuffer{buf.FromBytes(noise)})
if w.noise.DelayMin != 0 {
time.Sleep(time.Duration(randBetween(int64(w.noise.DelayMin), int64(w.noise.DelayMax))) * time.Millisecond)
}
}
return w.Writer.WriteMultiBuffer(mb)
}
type FragmentWriter struct { type FragmentWriter struct {
fragment *Fragment fragment *Fragment
writer io.Writer writer io.Writer
@@ -454,7 +381,6 @@ func (f *FragmentWriter) Write(b []byte) (int, error) {
} }
data := b[5:recordLen] data := b[5:recordLen]
buf := make([]byte, 1024) buf := make([]byte, 1024)
var hello []byte
for from := 0; ; { for from := 0; ; {
to := from + int(randBetween(int64(f.fragment.LengthMin), int64(f.fragment.LengthMax))) to := from + int(randBetween(int64(f.fragment.LengthMin), int64(f.fragment.LengthMax)))
if to > len(data) { if to > len(data) {
@@ -466,22 +392,12 @@ func (f *FragmentWriter) Write(b []byte) (int, error) {
from = to from = to
buf[3] = byte(l >> 8) buf[3] = byte(l >> 8)
buf[4] = byte(l) buf[4] = byte(l)
if f.fragment.IntervalMax == 0 { // combine fragmented tlshello if interval is 0
hello = append(hello, buf[:5+l]...)
} else {
_, err := f.writer.Write(buf[:5+l]) _, err := f.writer.Write(buf[:5+l])
time.Sleep(time.Duration(randBetween(int64(f.fragment.IntervalMin), int64(f.fragment.IntervalMax))) * time.Millisecond) time.Sleep(time.Duration(randBetween(int64(f.fragment.IntervalMin), int64(f.fragment.IntervalMax))) * time.Millisecond)
if err != nil { if err != nil {
return 0, err return 0, err
} }
}
if from == len(data) { if from == len(data) {
if len(hello) > 0 {
_, err := f.writer.Write(hello)
if err != nil {
return 0, err
}
}
if len(b) > recordLen { if len(b) > recordLen {
n, err := f.writer.Write(b[recordLen:]) n, err := f.writer.Write(b[recordLen:])
if err != nil { if err != nil {
@@ -521,13 +437,3 @@ func randBetween(left int64, right int64) int64 {
bigInt, _ := rand.Int(rand.Reader, big.NewInt(right-left)) bigInt, _ := rand.Int(rand.Reader, big.NewInt(right-left))
return left + bigInt.Int64() return left + bigInt.Int64()
} }
func GenerateRandomBytes(n int64) ([]byte, error) {
b := make([]byte, n)
_, err := rand.Read(b)
// Note that err == nil only if we read len(b) bytes.
if err != nil {
return nil, err
}
return b, nil
}

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.34.2 // protoc-gen-go v1.34.1
// protoc v5.27.0 // protoc v5.27.0
// source: proxy/http/config.proto // source: proxy/http/config.proto
@@ -322,7 +322,7 @@ func file_proxy_http_config_proto_rawDescGZIP() []byte {
} }
var file_proxy_http_config_proto_msgTypes = make([]protoimpl.MessageInfo, 5) var file_proxy_http_config_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_proxy_http_config_proto_goTypes = []any{ var file_proxy_http_config_proto_goTypes = []interface{}{
(*Account)(nil), // 0: xray.proxy.http.Account (*Account)(nil), // 0: xray.proxy.http.Account
(*ServerConfig)(nil), // 1: xray.proxy.http.ServerConfig (*ServerConfig)(nil), // 1: xray.proxy.http.ServerConfig
(*Header)(nil), // 2: xray.proxy.http.Header (*Header)(nil), // 2: xray.proxy.http.Header
@@ -347,7 +347,7 @@ func file_proxy_http_config_proto_init() {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_proxy_http_config_proto_msgTypes[0].Exporter = func(v any, i int) any { file_proxy_http_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Account); i { switch v := v.(*Account); i {
case 0: case 0:
return &v.state return &v.state
@@ -359,7 +359,7 @@ func file_proxy_http_config_proto_init() {
return nil return nil
} }
} }
file_proxy_http_config_proto_msgTypes[1].Exporter = func(v any, i int) any { file_proxy_http_config_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ServerConfig); i { switch v := v.(*ServerConfig); i {
case 0: case 0:
return &v.state return &v.state
@@ -371,7 +371,7 @@ func file_proxy_http_config_proto_init() {
return nil return nil
} }
} }
file_proxy_http_config_proto_msgTypes[2].Exporter = func(v any, i int) any { file_proxy_http_config_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Header); i { switch v := v.(*Header); i {
case 0: case 0:
return &v.state return &v.state
@@ -383,7 +383,7 @@ func file_proxy_http_config_proto_init() {
return nil return nil
} }
} }
file_proxy_http_config_proto_msgTypes[3].Exporter = func(v any, i int) any { file_proxy_http_config_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ClientConfig); i { switch v := v.(*ClientConfig); i {
case 0: case 0:
return &v.state return &v.state

View File

@@ -2,7 +2,6 @@ package http
import ( import (
"bufio" "bufio"
"bytes"
"context" "context"
"encoding/base64" "encoding/base64"
"io" "io"
@@ -84,28 +83,14 @@ type readerOnly struct {
} }
func (s *Server) Process(ctx context.Context, network net.Network, conn stat.Connection, dispatcher routing.Dispatcher) error { func (s *Server) Process(ctx context.Context, network net.Network, conn stat.Connection, dispatcher routing.Dispatcher) error {
return s.ProcessWithFirstbyte(ctx, network, conn, dispatcher)
}
// Firstbyte is for forwarded conn from SOCKS inbound
// Because it needs first byte to choose protocol
// We need to add it back
// Other parts are the same as the process function
func (s *Server) ProcessWithFirstbyte(ctx context.Context, network net.Network, conn stat.Connection, dispatcher routing.Dispatcher, firstbyte ...byte) error {
inbound := session.InboundFromContext(ctx) inbound := session.InboundFromContext(ctx)
inbound.Name = "http" inbound.Name = "http"
inbound.CanSpliceCopy = 2 inbound.CanSpliceCopy = 2
inbound.User = &protocol.MemoryUser{ inbound.User = &protocol.MemoryUser{
Level: s.config.UserLevel, Level: s.config.UserLevel,
} }
var reader *bufio.Reader
if len(firstbyte) > 0 { reader := bufio.NewReaderSize(readerOnly{conn}, buf.Size)
readerWithoutFirstbyte := bufio.NewReaderSize(readerOnly{conn}, buf.Size)
multiReader := io.MultiReader(bytes.NewReader(firstbyte), readerWithoutFirstbyte)
reader = bufio.NewReaderSize(multiReader, buf.Size)
} else {
reader = bufio.NewReaderSize(readerOnly{conn}, buf.Size)
}
Start: Start:
if err := conn.SetReadDeadline(time.Now().Add(s.policy().Timeouts.Handshake)); err != nil { if err := conn.SetReadDeadline(time.Now().Add(s.policy().Timeouts.Handshake)); err != nil {

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.34.2 // protoc-gen-go v1.34.1
// protoc v5.27.0 // protoc v5.27.0
// source: proxy/loopback/config.proto // source: proxy/loopback/config.proto
@@ -98,7 +98,7 @@ func file_proxy_loopback_config_proto_rawDescGZIP() []byte {
} }
var file_proxy_loopback_config_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_proxy_loopback_config_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_proxy_loopback_config_proto_goTypes = []any{ var file_proxy_loopback_config_proto_goTypes = []interface{}{
(*Config)(nil), // 0: xray.proxy.loopback.Config (*Config)(nil), // 0: xray.proxy.loopback.Config
} }
var file_proxy_loopback_config_proto_depIdxs = []int32{ var file_proxy_loopback_config_proto_depIdxs = []int32{
@@ -115,7 +115,7 @@ func file_proxy_loopback_config_proto_init() {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_proxy_loopback_config_proto_msgTypes[0].Exporter = func(v any, i int) any { file_proxy_loopback_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Config); i { switch v := v.(*Config); i {
case 0: case 0:
return &v.state return &v.state

View File

@@ -243,7 +243,7 @@ func (w *VisionWriter) WriteMultiBuffer(mb buf.MultiBuffer) error {
return w.Writer.WriteMultiBuffer(mb) return w.Writer.WriteMultiBuffer(mb)
} }
// ReshapeMultiBuffer prepare multi buffer for padding structure (max 21 bytes) // ReshapeMultiBuffer prepare multi buffer for padding stucture (max 21 bytes)
func ReshapeMultiBuffer(ctx context.Context, buffer buf.MultiBuffer) buf.MultiBuffer { func ReshapeMultiBuffer(ctx context.Context, buffer buf.MultiBuffer) buf.MultiBuffer {
needReshape := 0 needReshape := 0
for _, b := range buffer { for _, b := range buffer {
@@ -278,7 +278,7 @@ func ReshapeMultiBuffer(ctx context.Context, buffer buf.MultiBuffer) buf.MultiBu
return mb2 return mb2
} }
// XtlsPadding add padding to eliminate length signature during tls handshake // XtlsPadding add padding to eliminate length siganature during tls handshake
func XtlsPadding(b *buf.Buffer, command byte, userUUID *[]byte, longPadding bool, ctx context.Context) *buf.Buffer { func XtlsPadding(b *buf.Buffer, command byte, userUUID *[]byte, longPadding bool, ctx context.Context) *buf.Buffer {
var contentLen int32 = 0 var contentLen int32 = 0
var paddingLen int32 = 0 var paddingLen int32 = 0
@@ -319,7 +319,7 @@ func XtlsPadding(b *buf.Buffer, command byte, userUUID *[]byte, longPadding bool
// XtlsUnpadding remove padding and parse command // XtlsUnpadding remove padding and parse command
func XtlsUnpadding(b *buf.Buffer, s *TrafficState, ctx context.Context) *buf.Buffer { func XtlsUnpadding(b *buf.Buffer, s *TrafficState, ctx context.Context) *buf.Buffer {
if s.RemainingCommand == -1 && s.RemainingContent == -1 && s.RemainingPadding == -1 { // initial state if s.RemainingCommand == -1 && s.RemainingContent == -1 && s.RemainingPadding == -1 { // inital state
if b.Len() >= 21 && bytes.Equal(s.UserUUID, b.BytesTo(16)) { if b.Len() >= 21 && bytes.Equal(s.UserUUID, b.BytesTo(16)) {
b.Advance(16) b.Advance(16)
s.RemainingCommand = 5 s.RemainingCommand = 5

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.34.2 // protoc-gen-go v1.34.1
// protoc v5.27.0 // protoc v5.27.0
// source: proxy/shadowsocks/config.proto // source: proxy/shadowsocks/config.proto
@@ -309,7 +309,7 @@ func file_proxy_shadowsocks_config_proto_rawDescGZIP() []byte {
var file_proxy_shadowsocks_config_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_proxy_shadowsocks_config_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_proxy_shadowsocks_config_proto_msgTypes = make([]protoimpl.MessageInfo, 3) var file_proxy_shadowsocks_config_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_proxy_shadowsocks_config_proto_goTypes = []any{ var file_proxy_shadowsocks_config_proto_goTypes = []interface{}{
(CipherType)(0), // 0: xray.proxy.shadowsocks.CipherType (CipherType)(0), // 0: xray.proxy.shadowsocks.CipherType
(*Account)(nil), // 1: xray.proxy.shadowsocks.Account (*Account)(nil), // 1: xray.proxy.shadowsocks.Account
(*ServerConfig)(nil), // 2: xray.proxy.shadowsocks.ServerConfig (*ServerConfig)(nil), // 2: xray.proxy.shadowsocks.ServerConfig
@@ -336,7 +336,7 @@ func file_proxy_shadowsocks_config_proto_init() {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_proxy_shadowsocks_config_proto_msgTypes[0].Exporter = func(v any, i int) any { file_proxy_shadowsocks_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Account); i { switch v := v.(*Account); i {
case 0: case 0:
return &v.state return &v.state
@@ -348,7 +348,7 @@ func file_proxy_shadowsocks_config_proto_init() {
return nil return nil
} }
} }
file_proxy_shadowsocks_config_proto_msgTypes[1].Exporter = func(v any, i int) any { file_proxy_shadowsocks_config_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ServerConfig); i { switch v := v.(*ServerConfig); i {
case 0: case 0:
return &v.state return &v.state
@@ -360,7 +360,7 @@ func file_proxy_shadowsocks_config_proto_init() {
return nil return nil
} }
} }
file_proxy_shadowsocks_config_proto_msgTypes[2].Exporter = func(v any, i int) any { file_proxy_shadowsocks_config_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ClientConfig); i { switch v := v.(*ClientConfig); i {
case 0: case 0:
return &v.state return &v.state

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.34.2 // protoc-gen-go v1.34.1
// protoc v5.27.0 // protoc v5.27.0
// source: proxy/shadowsocks_2022/config.proto // source: proxy/shadowsocks_2022/config.proto
@@ -566,7 +566,7 @@ func file_proxy_shadowsocks_2022_config_proto_rawDescGZIP() []byte {
} }
var file_proxy_shadowsocks_2022_config_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_proxy_shadowsocks_2022_config_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_proxy_shadowsocks_2022_config_proto_goTypes = []any{ var file_proxy_shadowsocks_2022_config_proto_goTypes = []interface{}{
(*ServerConfig)(nil), // 0: xray.proxy.shadowsocks_2022.ServerConfig (*ServerConfig)(nil), // 0: xray.proxy.shadowsocks_2022.ServerConfig
(*MultiUserServerConfig)(nil), // 1: xray.proxy.shadowsocks_2022.MultiUserServerConfig (*MultiUserServerConfig)(nil), // 1: xray.proxy.shadowsocks_2022.MultiUserServerConfig
(*RelayDestination)(nil), // 2: xray.proxy.shadowsocks_2022.RelayDestination (*RelayDestination)(nil), // 2: xray.proxy.shadowsocks_2022.RelayDestination
@@ -597,7 +597,7 @@ func file_proxy_shadowsocks_2022_config_proto_init() {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_proxy_shadowsocks_2022_config_proto_msgTypes[0].Exporter = func(v any, i int) any { file_proxy_shadowsocks_2022_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ServerConfig); i { switch v := v.(*ServerConfig); i {
case 0: case 0:
return &v.state return &v.state
@@ -609,7 +609,7 @@ func file_proxy_shadowsocks_2022_config_proto_init() {
return nil return nil
} }
} }
file_proxy_shadowsocks_2022_config_proto_msgTypes[1].Exporter = func(v any, i int) any { file_proxy_shadowsocks_2022_config_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MultiUserServerConfig); i { switch v := v.(*MultiUserServerConfig); i {
case 0: case 0:
return &v.state return &v.state
@@ -621,7 +621,7 @@ func file_proxy_shadowsocks_2022_config_proto_init() {
return nil return nil
} }
} }
file_proxy_shadowsocks_2022_config_proto_msgTypes[2].Exporter = func(v any, i int) any { file_proxy_shadowsocks_2022_config_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RelayDestination); i { switch v := v.(*RelayDestination); i {
case 0: case 0:
return &v.state return &v.state
@@ -633,7 +633,7 @@ func file_proxy_shadowsocks_2022_config_proto_init() {
return nil return nil
} }
} }
file_proxy_shadowsocks_2022_config_proto_msgTypes[3].Exporter = func(v any, i int) any { file_proxy_shadowsocks_2022_config_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RelayServerConfig); i { switch v := v.(*RelayServerConfig); i {
case 0: case 0:
return &v.state return &v.state
@@ -645,7 +645,7 @@ func file_proxy_shadowsocks_2022_config_proto_init() {
return nil return nil
} }
} }
file_proxy_shadowsocks_2022_config_proto_msgTypes[4].Exporter = func(v any, i int) any { file_proxy_shadowsocks_2022_config_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*User); i { switch v := v.(*User); i {
case 0: case 0:
return &v.state return &v.state
@@ -657,7 +657,7 @@ func file_proxy_shadowsocks_2022_config_proto_init() {
return nil return nil
} }
} }
file_proxy_shadowsocks_2022_config_proto_msgTypes[5].Exporter = func(v any, i int) any { file_proxy_shadowsocks_2022_config_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ClientConfig); i { switch v := v.(*ClientConfig); i {
case 0: case 0:
return &v.state return &v.state

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.34.2 // protoc-gen-go v1.34.1
// protoc v5.27.0 // protoc v5.27.0
// source: proxy/socks/config.proto // source: proxy/socks/config.proto
@@ -26,7 +26,7 @@ const (
type AuthType int32 type AuthType int32
const ( const (
// NO_AUTH is for anonymous authentication. // NO_AUTH is for anounymous authentication.
AuthType_NO_AUTH AuthType = 0 AuthType_NO_AUTH AuthType = 0
// PASSWORD is for username/password authentication. // PASSWORD is for username/password authentication.
AuthType_PASSWORD AuthType = 1 AuthType_PASSWORD AuthType = 1
@@ -395,7 +395,7 @@ func file_proxy_socks_config_proto_rawDescGZIP() []byte {
var file_proxy_socks_config_proto_enumTypes = make([]protoimpl.EnumInfo, 2) var file_proxy_socks_config_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
var file_proxy_socks_config_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_proxy_socks_config_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_proxy_socks_config_proto_goTypes = []any{ var file_proxy_socks_config_proto_goTypes = []interface{}{
(AuthType)(0), // 0: xray.proxy.socks.AuthType (AuthType)(0), // 0: xray.proxy.socks.AuthType
(Version)(0), // 1: xray.proxy.socks.Version (Version)(0), // 1: xray.proxy.socks.Version
(*Account)(nil), // 2: xray.proxy.socks.Account (*Account)(nil), // 2: xray.proxy.socks.Account
@@ -424,7 +424,7 @@ func file_proxy_socks_config_proto_init() {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_proxy_socks_config_proto_msgTypes[0].Exporter = func(v any, i int) any { file_proxy_socks_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Account); i { switch v := v.(*Account); i {
case 0: case 0:
return &v.state return &v.state
@@ -436,7 +436,7 @@ func file_proxy_socks_config_proto_init() {
return nil return nil
} }
} }
file_proxy_socks_config_proto_msgTypes[1].Exporter = func(v any, i int) any { file_proxy_socks_config_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ServerConfig); i { switch v := v.(*ServerConfig); i {
case 0: case 0:
return &v.state return &v.state
@@ -448,7 +448,7 @@ func file_proxy_socks_config_proto_init() {
return nil return nil
} }
} }
file_proxy_socks_config_proto_msgTypes[2].Exporter = func(v any, i int) any { file_proxy_socks_config_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ClientConfig); i { switch v := v.(*ClientConfig); i {
case 0: case 0:
return &v.state return &v.state

Some files were not shown because too many files have changed in this diff Show More