mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-09-25 08:08:00 +03:00
Compare commits
113
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
544eccca83 | ||
|
|
e0ab00f6a8 | ||
|
|
157e65b34d | ||
|
|
c1b67a961e | ||
|
|
9e09399087 | ||
|
|
bb05684407 | ||
|
|
06dc4cf8bd | ||
|
|
35800e953e | ||
|
|
50fc324728 | ||
|
|
ec732b0b40 | ||
|
|
85f1234863 | ||
|
|
695a28c424 | ||
|
|
9fd3d9a1eb | ||
|
|
e86c365572 | ||
|
|
0321cdd0d2 | ||
|
|
766fa71eb1 | ||
|
|
01951163fd | ||
|
|
acb06e831b | ||
|
|
a204873d79 | ||
|
|
ea87941b77 | ||
|
|
88a2589498 | ||
|
|
5138ffcf22 | ||
|
|
0ac13bd910 | ||
|
|
eec280262d | ||
|
|
78fc2865ea | ||
|
|
ee8eb99bed | ||
|
|
52e4abd2ba | ||
|
|
1dbac90b22 | ||
|
|
0b8ec6804f | ||
|
|
9514e988d8 | ||
|
|
7dada1da2b | ||
|
|
0bffea3390 | ||
|
|
2805774f72 | ||
|
|
e6207e3a97 | ||
|
|
f0f765f9eb | ||
|
|
efdf21efb5 | ||
|
|
07374ae5a5 | ||
|
|
b6a7609c87 | ||
|
|
b43276c6d3 | ||
|
|
6a909b2507 | ||
|
|
7abad3fac0 | ||
|
|
1fe6d4a0f5 | ||
|
|
d100be5ad5 | ||
|
|
7dc3f87cd8 | ||
|
|
a079890ef0 | ||
|
|
fb0fa80c8c | ||
|
|
e3e7b28c08 | ||
|
|
12ee51e4bb | ||
|
|
957e5a6b15 | ||
|
|
0710c2b195 | ||
|
|
4632984b66 | ||
|
|
b7a22c729b | ||
|
|
8c3f246dcb | ||
|
|
888c0d2e1f | ||
|
|
74c726ff62 | ||
|
|
d14767d4f3 | ||
|
|
af2f0484b9 | ||
|
|
25d16914ff | ||
|
|
a6ec3b6e70 | ||
|
|
20cf00c271 | ||
|
|
c180c5980c | ||
|
|
5b849d51a9 | ||
|
|
61e1153157 | ||
|
|
afcfdbca70 | ||
|
|
2c92339f95 | ||
|
|
9c46a2d55a | ||
|
|
19186edfa1 | ||
|
|
f6a7e93923 | ||
|
|
077070dbe0 | ||
|
|
c3af657c0e | ||
|
|
9a04eecaf9 | ||
|
|
1951a278ac | ||
|
|
f1aee0b7c5 | ||
|
|
5173e5c15d | ||
|
|
daf9cba29f | ||
|
|
445c0d456c | ||
|
|
0a42dba13e | ||
|
|
cd8aab9544 | ||
|
|
59dc2cee2e | ||
|
|
5846f94784 | ||
|
|
e0ee2350fc | ||
|
|
48164c8267 | ||
|
|
2d2102f654 | ||
|
|
262770564f | ||
|
|
777e31302c | ||
|
|
30d6a5221b | ||
|
|
a778d3d273 | ||
|
|
e813a3744f | ||
|
|
66628943d8 | ||
|
|
7ff06f65ec | ||
|
|
1cf5662949 | ||
|
|
a6aca101d6 | ||
|
|
5836f36f69 | ||
|
|
6d6c045a5a | ||
|
|
cfc78b3ac1 | ||
|
|
5f7474120f | ||
|
|
09f619d67c | ||
|
|
760223ad70 | ||
|
|
d75b33a3a3 | ||
|
|
7c418486c8 | ||
|
|
a384be0f84 | ||
|
|
649e989fa2 | ||
|
|
0443de7798 | ||
|
|
9a121a489b | ||
|
|
4bdf6e5c92 | ||
|
|
ef2a967f12 | ||
|
|
92ada2dd1d | ||
|
|
8a9dbd407f | ||
|
|
de6be7c5a9 | ||
|
|
e742e84ded | ||
|
|
7726fbece0 | ||
|
|
0c09f4342b | ||
|
|
14e171ac8e |
@@ -29,6 +29,5 @@
|
|||||||
"openbsd-arm7": { "friendlyName": "openbsd-arm32-v7a" },
|
"openbsd-arm7": { "friendlyName": "openbsd-arm32-v7a" },
|
||||||
"windows-386": { "friendlyName": "windows-32" },
|
"windows-386": { "friendlyName": "windows-32" },
|
||||||
"windows-amd64": { "friendlyName": "windows-64" },
|
"windows-amd64": { "friendlyName": "windows-64" },
|
||||||
"windows-arm64": { "friendlyName": "windows-arm64-v8a" },
|
"windows-arm64": { "friendlyName": "windows-arm64-v8a" }
|
||||||
"windows-arm7": { "friendlyName": "windows-arm32-v7a" }
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,13 +68,13 @@ jobs:
|
|||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v4
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v4
|
||||||
|
|
||||||
- name: Login to GitHub Container Registry
|
- name: Login to GitHub Container Registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v4
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.repository_owner }}
|
username: ${{ github.repository_owner }}
|
||||||
@@ -82,7 +82,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Build Docker image (main architectures)
|
- name: Build Docker image (main architectures)
|
||||||
id: build_main_arches
|
id: build_main_arches
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v7
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: .github/docker/Dockerfile
|
file: .github/docker/Dockerfile
|
||||||
@@ -97,7 +97,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Build Docker image (additional architectures)
|
- name: Build Docker image (additional architectures)
|
||||||
id: build_additional_arches
|
id: build_additional_arches
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v7
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: .github/docker/Dockerfile.usa
|
file: .github/docker/Dockerfile.usa
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ jobs:
|
|||||||
file_glob: true
|
file_glob: true
|
||||||
|
|
||||||
- name: Upload files to Artifacts
|
- name: Upload files to Artifacts
|
||||||
uses: actions/upload-artifact@v6
|
uses: actions/upload-artifact@v7
|
||||||
with:
|
with:
|
||||||
name: Xray-${{ env.ASSET_NAME }}
|
name: Xray-${{ env.ASSET_NAME }}
|
||||||
path: |
|
path: |
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ jobs:
|
|||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
LIST=('amd64' 'x86' 'arm64' 'arm')
|
LIST=('amd64' 'x86' 'arm64')
|
||||||
for ARCHITECTURE in "${LIST[@]}"
|
for ARCHITECTURE in "${LIST[@]}"
|
||||||
do
|
do
|
||||||
echo -e "Checking wintun.dll for ${ARCHITECTURE}..."
|
echo -e "Checking wintun.dll for ${ARCHITECTURE}..."
|
||||||
@@ -114,9 +114,6 @@ jobs:
|
|||||||
# Windows ARM
|
# Windows ARM
|
||||||
- goos: windows
|
- goos: windows
|
||||||
goarch: arm64
|
goarch: arm64
|
||||||
- goos: windows
|
|
||||||
goarch: arm
|
|
||||||
goarm: 7
|
|
||||||
# BEGIN Other architectures
|
# BEGIN Other architectures
|
||||||
# BEGIN riscv64 & ARM64 & LOONG64
|
# BEGIN riscv64 & ARM64 & LOONG64
|
||||||
- goos: linux
|
- goos: linux
|
||||||
@@ -250,9 +247,6 @@ jobs:
|
|||||||
if [[ ${GOARCH} == 'arm64' ]]; then
|
if [[ ${GOARCH} == 'arm64' ]]; then
|
||||||
mv resources/wintun/bin/arm64/wintun.dll build_assets/
|
mv resources/wintun/bin/arm64/wintun.dll build_assets/
|
||||||
fi
|
fi
|
||||||
if [[ ${GOARCH} == 'arm' ]]; then
|
|
||||||
mv resources/wintun/bin/arm/wintun.dll build_assets/
|
|
||||||
fi
|
|
||||||
mv resources/wintun/LICENSE.txt build_assets/LICENSE-wintun.txt
|
mv resources/wintun/LICENSE.txt build_assets/LICENSE-wintun.txt
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -286,7 +280,7 @@ jobs:
|
|||||||
file_glob: true
|
file_glob: true
|
||||||
|
|
||||||
- name: Upload files to Artifacts
|
- name: Upload files to Artifacts
|
||||||
uses: actions/upload-artifact@v6
|
uses: actions/upload-artifact@v7
|
||||||
with:
|
with:
|
||||||
name: Xray-${{ env.ASSET_NAME }}
|
name: Xray-${{ env.ASSET_NAME }}
|
||||||
path: |
|
path: |
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ jobs:
|
|||||||
max_attempts: 60
|
max_attempts: 60
|
||||||
command: |
|
command: |
|
||||||
[ -d 'resources' ] || mkdir resources
|
[ -d 'resources' ] || mkdir resources
|
||||||
LIST=('amd64' 'x86' 'arm64' 'arm')
|
LIST=('amd64' 'x86' 'arm64')
|
||||||
for ARCHITECTURE in "${LIST[@]}"
|
for ARCHITECTURE in "${LIST[@]}"
|
||||||
do
|
do
|
||||||
FILE_PATH="resources/wintun/bin/${ARCHITECTURE}/wintun.dll"
|
FILE_PATH="resources/wintun/bin/${ARCHITECTURE}/wintun.dll"
|
||||||
|
|||||||
@@ -34,6 +34,22 @@ jobs:
|
|||||||
if: steps.check-assets.outputs.missing == 'true'
|
if: steps.check-assets.outputs.missing == 'true'
|
||||||
run: sleep 90
|
run: sleep 90
|
||||||
|
|
||||||
|
check-proto:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout codebase
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
- name: Check Proto Version Header
|
||||||
|
run: |
|
||||||
|
head -n 4 core/config.pb.go > ref.txt
|
||||||
|
find . -name "*.pb.go" ! -name "*_grpc.pb.go" -print0 | while IFS= read -r -d '' file; do
|
||||||
|
if ! cmp -s ref.txt <(head -n 4 "$file"); then
|
||||||
|
echo "Error: Header mismatch in $file"
|
||||||
|
head -n 4 "$file"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
test:
|
test:
|
||||||
needs: check-assets
|
needs: check-assets
|
||||||
permissions:
|
permissions:
|
||||||
|
|||||||
@@ -10,6 +10,8 @@
|
|||||||
|
|
||||||
[](https://happ.su)
|
[](https://happ.su)
|
||||||
|
|
||||||
|
[](https://blanc.link/VMTSDqW)
|
||||||
|
|
||||||
[**Sponsor Xray-core**](https://github.com/XTLS/Xray-core/issues/3668)
|
[**Sponsor Xray-core**](https://github.com/XTLS/Xray-core/issues/3668)
|
||||||
|
|
||||||
## Donation & NFTs
|
## Donation & NFTs
|
||||||
@@ -70,6 +72,7 @@
|
|||||||
- [Xray_bash_onekey](https://github.com/hello-yunshu/Xray_bash_onekey), [XTool](https://github.com/LordPenguin666/XTool), [VPainLess](https://github.com/vpainless/vpainless)
|
- [Xray_bash_onekey](https://github.com/hello-yunshu/Xray_bash_onekey), [XTool](https://github.com/LordPenguin666/XTool), [VPainLess](https://github.com/vpainless/vpainless)
|
||||||
- [v2ray-agent](https://github.com/mack-a/v2ray-agent), [Xray_onekey](https://github.com/wulabing/Xray_onekey), [ProxySU](https://github.com/proxysu/ProxySU)
|
- [v2ray-agent](https://github.com/mack-a/v2ray-agent), [Xray_onekey](https://github.com/wulabing/Xray_onekey), [ProxySU](https://github.com/proxysu/ProxySU)
|
||||||
- Magisk
|
- Magisk
|
||||||
|
- [NetProxy-Magisk](https://github.com/Fanju6/NetProxy-Magisk)
|
||||||
- [Xray4Magisk](https://github.com/Asterisk4Magisk/Xray4Magisk)
|
- [Xray4Magisk](https://github.com/Asterisk4Magisk/Xray4Magisk)
|
||||||
- [Xray_For_Magisk](https://github.com/E7KMbb/Xray_For_Magisk)
|
- [Xray_For_Magisk](https://github.com/E7KMbb/Xray_For_Magisk)
|
||||||
- Homebrew
|
- Homebrew
|
||||||
@@ -95,28 +98,32 @@
|
|||||||
## GUI Clients
|
## GUI Clients
|
||||||
|
|
||||||
- OpenWrt
|
- OpenWrt
|
||||||
- [PassWall](https://github.com/xiaorouji/openwrt-passwall), [PassWall 2](https://github.com/xiaorouji/openwrt-passwall2)
|
- [PassWall](https://github.com/Openwrt-Passwall/openwrt-passwall), [PassWall 2](https://github.com/Openwrt-Passwall/openwrt-passwall2)
|
||||||
- [ShadowSocksR Plus+](https://github.com/fw876/helloworld)
|
- [ShadowSocksR Plus+](https://github.com/fw876/helloworld)
|
||||||
- [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))
|
||||||
- Asuswrt-Merlin
|
- Asuswrt-Merlin
|
||||||
- [XRAYUI](https://github.com/DanielLavrushin/asuswrt-merlin-xrayui)
|
- [XRAYUI](https://github.com/DanielLavrushin/asuswrt-merlin-xrayui)
|
||||||
|
- [fancyss](https://github.com/hq450/fancyss)
|
||||||
- Windows
|
- Windows
|
||||||
- [v2rayN](https://github.com/2dust/v2rayN)
|
- [v2rayN](https://github.com/2dust/v2rayN)
|
||||||
- [Furious](https://github.com/LorenEteval/Furious)
|
- [Furious](https://github.com/LorenEteval/Furious)
|
||||||
- [Invisible Man - Xray](https://github.com/InvisibleManVPN/InvisibleMan-XRayClient)
|
- [Invisible Man - Xray](https://github.com/InvisibleManVPN/InvisibleMan-XRayClient)
|
||||||
- [AnyPortal](https://github.com/AnyPortal/AnyPortal)
|
- [AnyPortal](https://github.com/AnyPortal/AnyPortal)
|
||||||
|
- [GenyConnect](https://github.com/genyleap/GenyConnect)
|
||||||
- Android
|
- Android
|
||||||
- [v2rayNG](https://github.com/2dust/v2rayNG)
|
- [v2rayNG](https://github.com/2dust/v2rayNG)
|
||||||
- [X-flutter](https://github.com/XTLS/X-flutter)
|
- [X-flutter](https://github.com/XTLS/X-flutter)
|
||||||
- [SaeedDev94/Xray](https://github.com/SaeedDev94/Xray)
|
- [SaeedDev94/Xray](https://github.com/SaeedDev94/Xray)
|
||||||
- [SimpleXray](https://github.com/lhear/SimpleXray)
|
- [SimpleXray](https://github.com/lhear/SimpleXray)
|
||||||
|
- [XrayFA](https://github.com/Q7DF1/XrayFA)
|
||||||
- [AnyPortal](https://github.com/AnyPortal/AnyPortal)
|
- [AnyPortal](https://github.com/AnyPortal/AnyPortal)
|
||||||
|
- [NetProxy-Magisk](https://github.com/Fanju6/NetProxy-Magisk)
|
||||||
- iOS & macOS arm64 & tvOS
|
- iOS & macOS arm64 & tvOS
|
||||||
- [Happ](https://apps.apple.com/app/happ-proxy-utility/id6504287215) ([tvOS](https://apps.apple.com/us/app/happ-proxy-utility-for-tv/id6748297274))
|
- [Happ](https://apps.apple.com/app/happ-proxy-utility/id6504287215) | [Happ RU](https://apps.apple.com/ru/app/happ-proxy-utility-plus/id6746188973) | [Happ tvOS](https://apps.apple.com/us/app/happ-proxy-utility-for-tv/id6748297274)
|
||||||
- [Streisand](https://apps.apple.com/app/streisand/id6450534064)
|
- [Streisand](https://apps.apple.com/app/streisand/id6450534064)
|
||||||
- [OneXray](https://github.com/OneXray/OneXray)
|
- [OneXray](https://github.com/OneXray/OneXray)
|
||||||
- macOS arm64 & x64
|
- macOS arm64 & x64
|
||||||
- [Happ](https://apps.apple.com/app/happ-proxy-utility/id6504287215)
|
- [Happ](https://apps.apple.com/app/happ-proxy-utility/id6504287215) | [Happ RU](https://apps.apple.com/ru/app/happ-proxy-utility-plus/id6746188973)
|
||||||
- [V2rayU](https://github.com/yanue/V2rayU)
|
- [V2rayU](https://github.com/yanue/V2rayU)
|
||||||
- [V2RayXS](https://github.com/tzmax/V2RayXS)
|
- [V2RayXS](https://github.com/tzmax/V2RayXS)
|
||||||
- [Furious](https://github.com/LorenEteval/Furious)
|
- [Furious](https://github.com/LorenEteval/Furious)
|
||||||
@@ -124,6 +131,7 @@
|
|||||||
- [GoXRay](https://github.com/goxray/desktop)
|
- [GoXRay](https://github.com/goxray/desktop)
|
||||||
- [AnyPortal](https://github.com/AnyPortal/AnyPortal)
|
- [AnyPortal](https://github.com/AnyPortal/AnyPortal)
|
||||||
- [v2rayN](https://github.com/2dust/v2rayN)
|
- [v2rayN](https://github.com/2dust/v2rayN)
|
||||||
|
- [GenyConnect](https://github.com/genyleap/GenyConnect)
|
||||||
- Linux
|
- Linux
|
||||||
- [v2rayA](https://github.com/v2rayA/v2rayA)
|
- [v2rayA](https://github.com/v2rayA/v2rayA)
|
||||||
- [Furious](https://github.com/LorenEteval/Furious)
|
- [Furious](https://github.com/LorenEteval/Furious)
|
||||||
@@ -131,12 +139,15 @@
|
|||||||
- [GoXRay](https://github.com/goxray/desktop)
|
- [GoXRay](https://github.com/goxray/desktop)
|
||||||
- [AnyPortal](https://github.com/AnyPortal/AnyPortal)
|
- [AnyPortal](https://github.com/AnyPortal/AnyPortal)
|
||||||
- [v2rayN](https://github.com/2dust/v2rayN)
|
- [v2rayN](https://github.com/2dust/v2rayN)
|
||||||
|
- [GenyConnect](https://github.com/genyleap/GenyConnect)
|
||||||
|
|
||||||
## Others that support VLESS, XTLS, REALITY, XUDP, PLUX...
|
## Others that support VLESS, XTLS, REALITY, XUDP, PLUX...
|
||||||
|
|
||||||
- iOS & macOS arm64 & tvOS
|
- iOS & macOS arm64 & tvOS
|
||||||
- [Shadowrocket](https://apps.apple.com/app/shadowrocket/id932747118)
|
- [Shadowrocket](https://apps.apple.com/app/shadowrocket/id932747118)
|
||||||
- [Loon](https://apps.apple.com/us/app/loon/id1373567447)
|
- [Loon](https://apps.apple.com/us/app/loon/id1373567447)
|
||||||
|
- [Egern](https://apps.apple.com/us/app/egern/id1616105820)
|
||||||
|
- [Quantumult X](https://apps.apple.com/us/app/quantumult-x/id1443988620)
|
||||||
- Xray Tools
|
- Xray Tools
|
||||||
- [xray-knife](https://github.com/lilendian0x00/xray-knife)
|
- [xray-knife](https://github.com/lilendian0x00/xray-knife)
|
||||||
- [xray-checker](https://github.com/kutovoys/xray-checker)
|
- [xray-checker](https://github.com/kutovoys/xray-checker)
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
# Security Policy
|
||||||
|
|
||||||
|
If you found an issue related to security vulnerability or protocol-identification problem, please report it to us via "[Report a vulnerability](https://github.com/XTLS/Xray-core/security/advisories/new)" privately, instead of publish it publicly before we release the fixed version.
|
||||||
|
|
||||||
|
Thanks for your contribution to the FREE Internet!
|
||||||
+21
-35
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.35.1
|
// protoc-gen-go v1.36.11
|
||||||
// protoc v5.28.2
|
// protoc v6.33.5
|
||||||
// source: app/commander/config.proto
|
// source: app/commander/config.proto
|
||||||
|
|
||||||
package commander
|
package commander
|
||||||
@@ -12,6 +12,7 @@ import (
|
|||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
sync "sync"
|
sync "sync"
|
||||||
|
unsafe "unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -23,17 +24,16 @@ const (
|
|||||||
|
|
||||||
// Config is the settings for Commander.
|
// Config is the settings for Commander.
|
||||||
type Config struct {
|
type Config struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
// Tag of the outbound handler that handles grpc connections.
|
// Tag of the outbound handler that handles grpc connections.
|
||||||
Tag string `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"`
|
Tag string `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"`
|
||||||
// Network address of commander grpc service.
|
// Network address of commander grpc service.
|
||||||
Listen string `protobuf:"bytes,3,opt,name=listen,proto3" json:"listen,omitempty"`
|
Listen string `protobuf:"bytes,3,opt,name=listen,proto3" json:"listen,omitempty"`
|
||||||
// Services that supported by this server. All services must implement Service
|
// Services that supported by this server. All services must implement Service
|
||||||
// interface.
|
// interface.
|
||||||
Service []*serial.TypedMessage `protobuf:"bytes,2,rep,name=service,proto3" json:"service,omitempty"`
|
Service []*serial.TypedMessage `protobuf:"bytes,2,rep,name=service,proto3" json:"service,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Config) Reset() {
|
func (x *Config) Reset() {
|
||||||
@@ -89,9 +89,9 @@ func (x *Config) GetService() []*serial.TypedMessage {
|
|||||||
|
|
||||||
// ReflectionConfig is the placeholder config for ReflectionService.
|
// ReflectionConfig is the placeholder config for ReflectionService.
|
||||||
type ReflectionConfig struct {
|
type ReflectionConfig struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ReflectionConfig) Reset() {
|
func (x *ReflectionConfig) Reset() {
|
||||||
@@ -126,37 +126,24 @@ func (*ReflectionConfig) Descriptor() ([]byte, []int) {
|
|||||||
|
|
||||||
var File_app_commander_config_proto protoreflect.FileDescriptor
|
var File_app_commander_config_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_app_commander_config_proto_rawDesc = []byte{
|
const file_app_commander_config_proto_rawDesc = "" +
|
||||||
0x0a, 0x1a, 0x61, 0x70, 0x70, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x65, 0x72, 0x2f,
|
"\n" +
|
||||||
0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x78, 0x72,
|
"\x1aapp/commander/config.proto\x12\x12xray.app.commander\x1a!common/serial/typed_message.proto\"n\n" +
|
||||||
0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x65, 0x72,
|
"\x06Config\x12\x10\n" +
|
||||||
0x1a, 0x21, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x2f,
|
"\x03tag\x18\x01 \x01(\tR\x03tag\x12\x16\n" +
|
||||||
0x74, 0x79, 0x70, 0x65, 0x64, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72,
|
"\x06listen\x18\x03 \x01(\tR\x06listen\x12:\n" +
|
||||||
0x6f, 0x74, 0x6f, 0x22, 0x6e, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x10, 0x0a,
|
"\aservice\x18\x02 \x03(\v2 .xray.common.serial.TypedMessageR\aservice\"\x12\n" +
|
||||||
0x03, 0x74, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x74, 0x61, 0x67, 0x12,
|
"\x10ReflectionConfigBX\n" +
|
||||||
0x16, 0x0a, 0x06, 0x6c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
|
"\x16com.xray.app.commanderP\x01Z'github.com/xtls/xray-core/app/commander\xaa\x02\x12Xray.App.Commanderb\x06proto3"
|
||||||
0x06, 0x6c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x12, 0x3a, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69,
|
|
||||||
0x63, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e,
|
|
||||||
0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x2e, 0x54, 0x79,
|
|
||||||
0x70, 0x65, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76,
|
|
||||||
0x69, 0x63, 0x65, 0x22, 0x12, 0x0a, 0x10, 0x52, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f,
|
|
||||||
0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x42, 0x58, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x78,
|
|
||||||
0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x65,
|
|
||||||
0x72, 0x50, 0x01, 0x5a, 0x27, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
|
|
||||||
0x78, 0x74, 0x6c, 0x73, 0x2f, 0x78, 0x72, 0x61, 0x79, 0x2d, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x61,
|
|
||||||
0x70, 0x70, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x65, 0x72, 0xaa, 0x02, 0x12, 0x58,
|
|
||||||
0x72, 0x61, 0x79, 0x2e, 0x41, 0x70, 0x70, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x65,
|
|
||||||
0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
file_app_commander_config_proto_rawDescOnce sync.Once
|
file_app_commander_config_proto_rawDescOnce sync.Once
|
||||||
file_app_commander_config_proto_rawDescData = file_app_commander_config_proto_rawDesc
|
file_app_commander_config_proto_rawDescData []byte
|
||||||
)
|
)
|
||||||
|
|
||||||
func file_app_commander_config_proto_rawDescGZIP() []byte {
|
func file_app_commander_config_proto_rawDescGZIP() []byte {
|
||||||
file_app_commander_config_proto_rawDescOnce.Do(func() {
|
file_app_commander_config_proto_rawDescOnce.Do(func() {
|
||||||
file_app_commander_config_proto_rawDescData = protoimpl.X.CompressGZIP(file_app_commander_config_proto_rawDescData)
|
file_app_commander_config_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_app_commander_config_proto_rawDesc), len(file_app_commander_config_proto_rawDesc)))
|
||||||
})
|
})
|
||||||
return file_app_commander_config_proto_rawDescData
|
return file_app_commander_config_proto_rawDescData
|
||||||
}
|
}
|
||||||
@@ -185,7 +172,7 @@ func file_app_commander_config_proto_init() {
|
|||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_app_commander_config_proto_rawDesc,
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_app_commander_config_proto_rawDesc), len(file_app_commander_config_proto_rawDesc)),
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 2,
|
NumMessages: 2,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
@@ -196,7 +183,6 @@ func file_app_commander_config_proto_init() {
|
|||||||
MessageInfos: file_app_commander_config_proto_msgTypes,
|
MessageInfos: file_app_commander_config_proto_msgTypes,
|
||||||
}.Build()
|
}.Build()
|
||||||
File_app_commander_config_proto = out.File
|
File_app_commander_config_proto = out.File
|
||||||
file_app_commander_config_proto_rawDesc = nil
|
|
||||||
file_app_commander_config_proto_goTypes = nil
|
file_app_commander_config_proto_goTypes = nil
|
||||||
file_app_commander_config_proto_depIdxs = nil
|
file_app_commander_config_proto_depIdxs = nil
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-30
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.35.1
|
// protoc-gen-go v1.36.11
|
||||||
// protoc v5.28.2
|
// protoc v6.33.5
|
||||||
// source: app/dispatcher/config.proto
|
// source: app/dispatcher/config.proto
|
||||||
|
|
||||||
package dispatcher
|
package dispatcher
|
||||||
@@ -11,6 +11,7 @@ import (
|
|||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
sync "sync"
|
sync "sync"
|
||||||
|
unsafe "unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -21,9 +22,9 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type SessionConfig struct {
|
type SessionConfig struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *SessionConfig) Reset() {
|
func (x *SessionConfig) Reset() {
|
||||||
@@ -57,11 +58,10 @@ func (*SessionConfig) Descriptor() ([]byte, []int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Settings *SessionConfig `protobuf:"bytes,1,opt,name=settings,proto3" json:"settings,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
Settings *SessionConfig `protobuf:"bytes,1,opt,name=settings,proto3" json:"settings,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Config) Reset() {
|
func (x *Config) Reset() {
|
||||||
@@ -103,33 +103,22 @@ func (x *Config) GetSettings() *SessionConfig {
|
|||||||
|
|
||||||
var File_app_dispatcher_config_proto protoreflect.FileDescriptor
|
var File_app_dispatcher_config_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_app_dispatcher_config_proto_rawDesc = []byte{
|
const file_app_dispatcher_config_proto_rawDesc = "" +
|
||||||
0x0a, 0x1b, 0x61, 0x70, 0x70, 0x2f, 0x64, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72,
|
"\n" +
|
||||||
0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x13, 0x78,
|
"\x1bapp/dispatcher/config.proto\x12\x13xray.app.dispatcher\"\x15\n" +
|
||||||
0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x64, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68,
|
"\rSessionConfigJ\x04\b\x01\x10\x02\"H\n" +
|
||||||
0x65, 0x72, 0x22, 0x15, 0x0a, 0x0d, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e,
|
"\x06Config\x12>\n" +
|
||||||
0x66, 0x69, 0x67, 0x4a, 0x04, 0x08, 0x01, 0x10, 0x02, 0x22, 0x48, 0x0a, 0x06, 0x43, 0x6f, 0x6e,
|
"\bsettings\x18\x01 \x01(\v2\".xray.app.dispatcher.SessionConfigR\bsettingsB[\n" +
|
||||||
0x66, 0x69, 0x67, 0x12, 0x3e, 0x0a, 0x08, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18,
|
"\x17com.xray.app.dispatcherP\x01Z(github.com/xtls/xray-core/app/dispatcher\xaa\x02\x13Xray.App.Dispatcherb\x06proto3"
|
||||||
0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70,
|
|
||||||
0x2e, 0x64, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x73, 0x73,
|
|
||||||
0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x08, 0x73, 0x65, 0x74, 0x74, 0x69,
|
|
||||||
0x6e, 0x67, 0x73, 0x42, 0x5b, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e,
|
|
||||||
0x61, 0x70, 0x70, 0x2e, 0x64, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x50, 0x01,
|
|
||||||
0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x74, 0x6c,
|
|
||||||
0x73, 0x2f, 0x78, 0x72, 0x61, 0x79, 0x2d, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x61, 0x70, 0x70, 0x2f,
|
|
||||||
0x64, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0xaa, 0x02, 0x13, 0x58, 0x72, 0x61,
|
|
||||||
0x79, 0x2e, 0x41, 0x70, 0x70, 0x2e, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72,
|
|
||||||
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
file_app_dispatcher_config_proto_rawDescOnce sync.Once
|
file_app_dispatcher_config_proto_rawDescOnce sync.Once
|
||||||
file_app_dispatcher_config_proto_rawDescData = file_app_dispatcher_config_proto_rawDesc
|
file_app_dispatcher_config_proto_rawDescData []byte
|
||||||
)
|
)
|
||||||
|
|
||||||
func file_app_dispatcher_config_proto_rawDescGZIP() []byte {
|
func file_app_dispatcher_config_proto_rawDescGZIP() []byte {
|
||||||
file_app_dispatcher_config_proto_rawDescOnce.Do(func() {
|
file_app_dispatcher_config_proto_rawDescOnce.Do(func() {
|
||||||
file_app_dispatcher_config_proto_rawDescData = protoimpl.X.CompressGZIP(file_app_dispatcher_config_proto_rawDescData)
|
file_app_dispatcher_config_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_app_dispatcher_config_proto_rawDesc), len(file_app_dispatcher_config_proto_rawDesc)))
|
||||||
})
|
})
|
||||||
return file_app_dispatcher_config_proto_rawDescData
|
return file_app_dispatcher_config_proto_rawDescData
|
||||||
}
|
}
|
||||||
@@ -157,7 +146,7 @@ func file_app_dispatcher_config_proto_init() {
|
|||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_app_dispatcher_config_proto_rawDesc,
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_app_dispatcher_config_proto_rawDesc), len(file_app_dispatcher_config_proto_rawDesc)),
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 2,
|
NumMessages: 2,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
@@ -168,7 +157,6 @@ func file_app_dispatcher_config_proto_init() {
|
|||||||
MessageInfos: file_app_dispatcher_config_proto_msgTypes,
|
MessageInfos: file_app_dispatcher_config_proto_msgTypes,
|
||||||
}.Build()
|
}.Build()
|
||||||
File_app_dispatcher_config_proto = out.File
|
File_app_dispatcher_config_proto = out.File
|
||||||
file_app_dispatcher_config_proto_rawDesc = nil
|
|
||||||
file_app_dispatcher_config_proto_goTypes = nil
|
file_app_dispatcher_config_proto_goTypes = nil
|
||||||
file_app_dispatcher_config_proto_depIdxs = nil
|
file_app_dispatcher_config_proto_depIdxs = nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -183,12 +183,9 @@ func (d *DefaultDispatcher) getLink(ctx context.Context) (*transport.Link, *tran
|
|||||||
if p.Stats.UserOnline {
|
if p.Stats.UserOnline {
|
||||||
name := "user>>>" + user.Email + ">>>online"
|
name := "user>>>" + user.Email + ">>>online"
|
||||||
if om, _ := stats.GetOrRegisterOnlineMap(d.stats, name); om != nil {
|
if om, _ := stats.GetOrRegisterOnlineMap(d.stats, name); om != nil {
|
||||||
sessionInbounds := session.InboundFromContext(ctx)
|
userIP := sessionInbound.Source.Address.String()
|
||||||
userIP := sessionInbounds.Source.Address.String()
|
|
||||||
om.AddIP(userIP)
|
om.AddIP(userIP)
|
||||||
// log Online user with ips
|
context.AfterFunc(ctx, func() { om.RemoveIP(userIP) })
|
||||||
// errors.LogDebug(ctx, "user>>>" + user.Email + ">>>online", om.Count(), om.List())
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -225,11 +222,9 @@ func WrapLink(ctx context.Context, policyManager policy.Manager, statsManager st
|
|||||||
if p.Stats.UserOnline {
|
if p.Stats.UserOnline {
|
||||||
name := "user>>>" + user.Email + ">>>online"
|
name := "user>>>" + user.Email + ">>>online"
|
||||||
if om, _ := stats.GetOrRegisterOnlineMap(statsManager, name); om != nil {
|
if om, _ := stats.GetOrRegisterOnlineMap(statsManager, name); om != nil {
|
||||||
sessionInbounds := session.InboundFromContext(ctx)
|
userIP := sessionInbound.Source.Address.String()
|
||||||
userIP := sessionInbounds.Source.Address.String()
|
|
||||||
om.AddIP(userIP)
|
om.AddIP(userIP)
|
||||||
// log Online user with ips
|
context.AfterFunc(ctx, func() { om.RemoveIP(userIP) })
|
||||||
// errors.LogDebug(ctx, "user>>>" + user.Email + ">>>online", om.Count(), om.List())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+97
-157
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.35.1
|
// protoc-gen-go v1.36.11
|
||||||
// protoc v5.28.2
|
// protoc v6.33.5
|
||||||
// source: app/dns/config.proto
|
// source: app/dns/config.proto
|
||||||
|
|
||||||
package dns
|
package dns
|
||||||
@@ -13,6 +13,7 @@ import (
|
|||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
sync "sync"
|
sync "sync"
|
||||||
|
unsafe "unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -127,10 +128,7 @@ func (QueryStrategy) EnumDescriptor() ([]byte, []int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type NameServer struct {
|
type NameServer struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
Address *net.Endpoint `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
|
Address *net.Endpoint `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
|
||||||
ClientIp []byte `protobuf:"bytes,5,opt,name=client_ip,json=clientIp,proto3" json:"client_ip,omitempty"`
|
ClientIp []byte `protobuf:"bytes,5,opt,name=client_ip,json=clientIp,proto3" json:"client_ip,omitempty"`
|
||||||
SkipFallback bool `protobuf:"varint,6,opt,name=skipFallback,proto3" json:"skipFallback,omitempty"`
|
SkipFallback bool `protobuf:"varint,6,opt,name=skipFallback,proto3" json:"skipFallback,omitempty"`
|
||||||
@@ -148,6 +146,8 @@ type NameServer struct {
|
|||||||
UnexpectedGeoip []*router.GeoIP `protobuf:"bytes,13,rep,name=unexpected_geoip,json=unexpectedGeoip,proto3" json:"unexpected_geoip,omitempty"`
|
UnexpectedGeoip []*router.GeoIP `protobuf:"bytes,13,rep,name=unexpected_geoip,json=unexpectedGeoip,proto3" json:"unexpected_geoip,omitempty"`
|
||||||
ActUnprior bool `protobuf:"varint,14,opt,name=actUnprior,proto3" json:"actUnprior,omitempty"`
|
ActUnprior bool `protobuf:"varint,14,opt,name=actUnprior,proto3" json:"actUnprior,omitempty"`
|
||||||
PolicyID uint32 `protobuf:"varint,17,opt,name=policyID,proto3" json:"policyID,omitempty"`
|
PolicyID uint32 `protobuf:"varint,17,opt,name=policyID,proto3" json:"policyID,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *NameServer) Reset() {
|
func (x *NameServer) Reset() {
|
||||||
@@ -300,10 +300,7 @@ func (x *NameServer) GetPolicyID() uint32 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
// NameServer list used by this DNS client.
|
// NameServer list used by this DNS client.
|
||||||
// A special value 'localhost' as a domain address can be set to use DNS on local system.
|
// A special value 'localhost' as a domain address can be set to use DNS on local system.
|
||||||
NameServer []*NameServer `protobuf:"bytes,5,rep,name=name_server,json=nameServer,proto3" json:"name_server,omitempty"`
|
NameServer []*NameServer `protobuf:"bytes,5,rep,name=name_server,json=nameServer,proto3" json:"name_server,omitempty"`
|
||||||
@@ -321,6 +318,8 @@ type Config struct {
|
|||||||
DisableFallback bool `protobuf:"varint,10,opt,name=disableFallback,proto3" json:"disableFallback,omitempty"`
|
DisableFallback bool `protobuf:"varint,10,opt,name=disableFallback,proto3" json:"disableFallback,omitempty"`
|
||||||
DisableFallbackIfMatch bool `protobuf:"varint,11,opt,name=disableFallbackIfMatch,proto3" json:"disableFallbackIfMatch,omitempty"`
|
DisableFallbackIfMatch bool `protobuf:"varint,11,opt,name=disableFallbackIfMatch,proto3" json:"disableFallbackIfMatch,omitempty"`
|
||||||
EnableParallelQuery bool `protobuf:"varint,14,opt,name=enableParallelQuery,proto3" json:"enableParallelQuery,omitempty"`
|
EnableParallelQuery bool `protobuf:"varint,14,opt,name=enableParallelQuery,proto3" json:"enableParallelQuery,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Config) Reset() {
|
func (x *Config) Reset() {
|
||||||
@@ -431,12 +430,11 @@ func (x *Config) GetEnableParallelQuery() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type NameServer_PriorityDomain struct {
|
type NameServer_PriorityDomain struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Type DomainMatchingType `protobuf:"varint,1,opt,name=type,proto3,enum=xray.app.dns.DomainMatchingType" json:"type,omitempty"`
|
||||||
|
Domain string `protobuf:"bytes,2,opt,name=domain,proto3" json:"domain,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
Type DomainMatchingType `protobuf:"varint,1,opt,name=type,proto3,enum=xray.app.dns.DomainMatchingType" json:"type,omitempty"`
|
|
||||||
Domain string `protobuf:"bytes,2,opt,name=domain,proto3" json:"domain,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *NameServer_PriorityDomain) Reset() {
|
func (x *NameServer_PriorityDomain) Reset() {
|
||||||
@@ -484,12 +482,11 @@ func (x *NameServer_PriorityDomain) GetDomain() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type NameServer_OriginalRule struct {
|
type NameServer_OriginalRule struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Rule string `protobuf:"bytes,1,opt,name=rule,proto3" json:"rule,omitempty"`
|
||||||
|
Size uint32 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
Rule string `protobuf:"bytes,1,opt,name=rule,proto3" json:"rule,omitempty"`
|
|
||||||
Size uint32 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *NameServer_OriginalRule) Reset() {
|
func (x *NameServer_OriginalRule) Reset() {
|
||||||
@@ -537,16 +534,15 @@ func (x *NameServer_OriginalRule) GetSize() uint32 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Config_HostMapping struct {
|
type Config_HostMapping struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Type DomainMatchingType `protobuf:"varint,1,opt,name=type,proto3,enum=xray.app.dns.DomainMatchingType" json:"type,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
Domain string `protobuf:"bytes,2,opt,name=domain,proto3" json:"domain,omitempty"`
|
||||||
|
Ip [][]byte `protobuf:"bytes,3,rep,name=ip,proto3" json:"ip,omitempty"`
|
||||||
Type DomainMatchingType `protobuf:"varint,1,opt,name=type,proto3,enum=xray.app.dns.DomainMatchingType" json:"type,omitempty"`
|
|
||||||
Domain string `protobuf:"bytes,2,opt,name=domain,proto3" json:"domain,omitempty"`
|
|
||||||
Ip [][]byte `protobuf:"bytes,3,rep,name=ip,proto3" json:"ip,omitempty"`
|
|
||||||
// ProxiedDomain indicates the mapped domain has the same IP address on this
|
// ProxiedDomain indicates the mapped domain has the same IP address on this
|
||||||
// domain. Xray will use this domain for IP queries.
|
// domain. Xray will use this domain for IP queries.
|
||||||
ProxiedDomain string `protobuf:"bytes,4,opt,name=proxied_domain,json=proxiedDomain,proto3" json:"proxied_domain,omitempty"`
|
ProxiedDomain string `protobuf:"bytes,4,opt,name=proxied_domain,json=proxiedDomain,proto3" json:"proxied_domain,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Config_HostMapping) Reset() {
|
func (x *Config_HostMapping) Reset() {
|
||||||
@@ -609,141 +605,86 @@ func (x *Config_HostMapping) GetProxiedDomain() string {
|
|||||||
|
|
||||||
var File_app_dns_config_proto protoreflect.FileDescriptor
|
var File_app_dns_config_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_app_dns_config_proto_rawDesc = []byte{
|
const file_app_dns_config_proto_rawDesc = "" +
|
||||||
0x0a, 0x14, 0x61, 0x70, 0x70, 0x2f, 0x64, 0x6e, 0x73, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67,
|
"\n" +
|
||||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70,
|
"\x14app/dns/config.proto\x12\fxray.app.dns\x1a\x1ccommon/net/destination.proto\x1a\x17app/router/config.proto\"\xdf\a\n" +
|
||||||
0x2e, 0x64, 0x6e, 0x73, 0x1a, 0x1c, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x6e, 0x65, 0x74,
|
"\n" +
|
||||||
0x2f, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f,
|
"NameServer\x123\n" +
|
||||||
0x74, 0x6f, 0x1a, 0x17, 0x61, 0x70, 0x70, 0x2f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2f, 0x63,
|
"\aaddress\x18\x01 \x01(\v2\x19.xray.common.net.EndpointR\aaddress\x12\x1b\n" +
|
||||||
0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xdf, 0x07, 0x0a, 0x0a,
|
"\tclient_ip\x18\x05 \x01(\fR\bclientIp\x12\"\n" +
|
||||||
0x4e, 0x61, 0x6d, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x33, 0x0a, 0x07, 0x61, 0x64,
|
"\fskipFallback\x18\x06 \x01(\bR\fskipFallback\x12V\n" +
|
||||||
0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x78, 0x72,
|
"\x12prioritized_domain\x18\x02 \x03(\v2'.xray.app.dns.NameServer.PriorityDomainR\x11prioritizedDomain\x12=\n" +
|
||||||
0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x2e, 0x45, 0x6e,
|
"\x0eexpected_geoip\x18\x03 \x03(\v2\x16.xray.app.router.GeoIPR\rexpectedGeoip\x12L\n" +
|
||||||
0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12,
|
"\x0eoriginal_rules\x18\x04 \x03(\v2%.xray.app.dns.NameServer.OriginalRuleR\roriginalRules\x12B\n" +
|
||||||
0x1b, 0x0a, 0x09, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x70, 0x18, 0x05, 0x20, 0x01,
|
"\x0equery_strategy\x18\a \x01(\x0e2\x1b.xray.app.dns.QueryStrategyR\rqueryStrategy\x12\x1a\n" +
|
||||||
0x28, 0x0c, 0x52, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x70, 0x12, 0x22, 0x0a, 0x0c,
|
"\bactPrior\x18\b \x01(\bR\bactPrior\x12\x10\n" +
|
||||||
0x73, 0x6b, 0x69, 0x70, 0x46, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x18, 0x06, 0x20, 0x01,
|
"\x03tag\x18\t \x01(\tR\x03tag\x12\x1c\n" +
|
||||||
0x28, 0x08, 0x52, 0x0c, 0x73, 0x6b, 0x69, 0x70, 0x46, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b,
|
"\ttimeoutMs\x18\n" +
|
||||||
0x12, 0x56, 0x0a, 0x12, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x69, 0x7a, 0x65, 0x64, 0x5f,
|
" \x01(\x04R\ttimeoutMs\x12'\n" +
|
||||||
0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x78,
|
"\fdisableCache\x18\v \x01(\bH\x00R\fdisableCache\x88\x01\x01\x12#\n" +
|
||||||
0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x64, 0x6e, 0x73, 0x2e, 0x4e, 0x61, 0x6d, 0x65,
|
"\n" +
|
||||||
0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x44,
|
"serveStale\x18\x0f \x01(\bH\x01R\n" +
|
||||||
0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x52, 0x11, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x69, 0x7a,
|
"serveStale\x88\x01\x01\x12-\n" +
|
||||||
0x65, 0x64, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x12, 0x3d, 0x0a, 0x0e, 0x65, 0x78, 0x70, 0x65,
|
"\x0fserveExpiredTTL\x18\x10 \x01(\rH\x02R\x0fserveExpiredTTL\x88\x01\x01\x12\x1e\n" +
|
||||||
0x63, 0x74, 0x65, 0x64, 0x5f, 0x67, 0x65, 0x6f, 0x69, 0x70, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b,
|
"\n" +
|
||||||
0x32, 0x16, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74,
|
"finalQuery\x18\f \x01(\bR\n" +
|
||||||
0x65, 0x72, 0x2e, 0x47, 0x65, 0x6f, 0x49, 0x50, 0x52, 0x0d, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74,
|
"finalQuery\x12A\n" +
|
||||||
0x65, 0x64, 0x47, 0x65, 0x6f, 0x69, 0x70, 0x12, 0x4c, 0x0a, 0x0e, 0x6f, 0x72, 0x69, 0x67, 0x69,
|
"\x10unexpected_geoip\x18\r \x03(\v2\x16.xray.app.router.GeoIPR\x0funexpectedGeoip\x12\x1e\n" +
|
||||||
0x6e, 0x61, 0x6c, 0x5f, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32,
|
"\n" +
|
||||||
0x25, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x64, 0x6e, 0x73, 0x2e, 0x4e,
|
"actUnprior\x18\x0e \x01(\bR\n" +
|
||||||
0x61, 0x6d, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e,
|
"actUnprior\x12\x1a\n" +
|
||||||
0x61, 0x6c, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x0d, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c,
|
"\bpolicyID\x18\x11 \x01(\rR\bpolicyID\x1a^\n" +
|
||||||
0x52, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x42, 0x0a, 0x0e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x73,
|
"\x0ePriorityDomain\x124\n" +
|
||||||
0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e,
|
"\x04type\x18\x01 \x01(\x0e2 .xray.app.dns.DomainMatchingTypeR\x04type\x12\x16\n" +
|
||||||
0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x64, 0x6e, 0x73, 0x2e, 0x51, 0x75, 0x65,
|
"\x06domain\x18\x02 \x01(\tR\x06domain\x1a6\n" +
|
||||||
0x72, 0x79, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x52, 0x0d, 0x71, 0x75, 0x65, 0x72,
|
"\fOriginalRule\x12\x12\n" +
|
||||||
0x79, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x63, 0x74,
|
"\x04rule\x18\x01 \x01(\tR\x04rule\x12\x12\n" +
|
||||||
0x50, 0x72, 0x69, 0x6f, 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x61, 0x63, 0x74,
|
"\x04size\x18\x02 \x01(\rR\x04sizeB\x0f\n" +
|
||||||
0x50, 0x72, 0x69, 0x6f, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18, 0x09, 0x20, 0x01,
|
"\r_disableCacheB\r\n" +
|
||||||
0x28, 0x09, 0x52, 0x03, 0x74, 0x61, 0x67, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x6f,
|
"\v_serveStaleB\x12\n" +
|
||||||
0x75, 0x74, 0x4d, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65,
|
"\x10_serveExpiredTTL\"\x98\x05\n" +
|
||||||
0x6f, 0x75, 0x74, 0x4d, 0x73, 0x12, 0x27, 0x0a, 0x0c, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65,
|
"\x06Config\x129\n" +
|
||||||
0x43, 0x61, 0x63, 0x68, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x0c, 0x64,
|
"\vname_server\x18\x05 \x03(\v2\x18.xray.app.dns.NameServerR\n" +
|
||||||
0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x61, 0x63, 0x68, 0x65, 0x88, 0x01, 0x01, 0x12, 0x23,
|
"nameServer\x12\x1b\n" +
|
||||||
0x0a, 0x0a, 0x73, 0x65, 0x72, 0x76, 0x65, 0x53, 0x74, 0x61, 0x6c, 0x65, 0x18, 0x0f, 0x20, 0x01,
|
"\tclient_ip\x18\x03 \x01(\fR\bclientIp\x12C\n" +
|
||||||
0x28, 0x08, 0x48, 0x01, 0x52, 0x0a, 0x73, 0x65, 0x72, 0x76, 0x65, 0x53, 0x74, 0x61, 0x6c, 0x65,
|
"\fstatic_hosts\x18\x04 \x03(\v2 .xray.app.dns.Config.HostMappingR\vstaticHosts\x12\x10\n" +
|
||||||
0x88, 0x01, 0x01, 0x12, 0x2d, 0x0a, 0x0f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x45, 0x78, 0x70, 0x69,
|
"\x03tag\x18\x06 \x01(\tR\x03tag\x12\"\n" +
|
||||||
0x72, 0x65, 0x64, 0x54, 0x54, 0x4c, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x0f,
|
"\fdisableCache\x18\b \x01(\bR\fdisableCache\x12\x1e\n" +
|
||||||
0x73, 0x65, 0x72, 0x76, 0x65, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x64, 0x54, 0x54, 0x4c, 0x88,
|
"\n" +
|
||||||
0x01, 0x01, 0x12, 0x1e, 0x0a, 0x0a, 0x66, 0x69, 0x6e, 0x61, 0x6c, 0x51, 0x75, 0x65, 0x72, 0x79,
|
"serveStale\x18\f \x01(\bR\n" +
|
||||||
0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x66, 0x69, 0x6e, 0x61, 0x6c, 0x51, 0x75, 0x65,
|
"serveStale\x12(\n" +
|
||||||
0x72, 0x79, 0x12, 0x41, 0x0a, 0x10, 0x75, 0x6e, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64,
|
"\x0fserveExpiredTTL\x18\r \x01(\rR\x0fserveExpiredTTL\x12B\n" +
|
||||||
0x5f, 0x67, 0x65, 0x6f, 0x69, 0x70, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x78,
|
"\x0equery_strategy\x18\t \x01(\x0e2\x1b.xray.app.dns.QueryStrategyR\rqueryStrategy\x12(\n" +
|
||||||
0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x47,
|
"\x0fdisableFallback\x18\n" +
|
||||||
0x65, 0x6f, 0x49, 0x50, 0x52, 0x0f, 0x75, 0x6e, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64,
|
" \x01(\bR\x0fdisableFallback\x126\n" +
|
||||||
0x47, 0x65, 0x6f, 0x69, 0x70, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x63, 0x74, 0x55, 0x6e, 0x70, 0x72,
|
"\x16disableFallbackIfMatch\x18\v \x01(\bR\x16disableFallbackIfMatch\x120\n" +
|
||||||
0x69, 0x6f, 0x72, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x61, 0x63, 0x74, 0x55, 0x6e,
|
"\x13enableParallelQuery\x18\x0e \x01(\bR\x13enableParallelQuery\x1a\x92\x01\n" +
|
||||||
0x70, 0x72, 0x69, 0x6f, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x49,
|
"\vHostMapping\x124\n" +
|
||||||
0x44, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x49,
|
"\x04type\x18\x01 \x01(\x0e2 .xray.app.dns.DomainMatchingTypeR\x04type\x12\x16\n" +
|
||||||
0x44, 0x1a, 0x5e, 0x0a, 0x0e, 0x50, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x44, 0x6f, 0x6d,
|
"\x06domain\x18\x02 \x01(\tR\x06domain\x12\x0e\n" +
|
||||||
0x61, 0x69, 0x6e, 0x12, 0x34, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
|
"\x02ip\x18\x03 \x03(\fR\x02ip\x12%\n" +
|
||||||
0x0e, 0x32, 0x20, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x64, 0x6e, 0x73,
|
"\x0eproxied_domain\x18\x04 \x01(\tR\rproxiedDomainJ\x04\b\a\x10\b*E\n" +
|
||||||
0x2e, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x69, 0x6e, 0x67, 0x54,
|
"\x12DomainMatchingType\x12\b\n" +
|
||||||
0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x6f, 0x6d,
|
"\x04Full\x10\x00\x12\r\n" +
|
||||||
0x61, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69,
|
"\tSubdomain\x10\x01\x12\v\n" +
|
||||||
0x6e, 0x1a, 0x36, 0x0a, 0x0c, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x52, 0x75, 0x6c,
|
"\aKeyword\x10\x02\x12\t\n" +
|
||||||
0x65, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x75, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
"\x05Regex\x10\x03*B\n" +
|
||||||
0x04, 0x72, 0x75, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20,
|
"\rQueryStrategy\x12\n" +
|
||||||
0x01, 0x28, 0x0d, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x42, 0x0f, 0x0a, 0x0d, 0x5f, 0x64, 0x69,
|
"\n" +
|
||||||
0x73, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x61, 0x63, 0x68, 0x65, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x73,
|
"\x06USE_IP\x10\x00\x12\v\n" +
|
||||||
0x65, 0x72, 0x76, 0x65, 0x53, 0x74, 0x61, 0x6c, 0x65, 0x42, 0x12, 0x0a, 0x10, 0x5f, 0x73, 0x65,
|
"\aUSE_IP4\x10\x01\x12\v\n" +
|
||||||
0x72, 0x76, 0x65, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x64, 0x54, 0x54, 0x4c, 0x22, 0x98, 0x05,
|
"\aUSE_IP6\x10\x02\x12\v\n" +
|
||||||
0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x39, 0x0a, 0x0b, 0x6e, 0x61, 0x6d, 0x65,
|
"\aUSE_SYS\x10\x03BF\n" +
|
||||||
0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e,
|
"\x10com.xray.app.dnsP\x01Z!github.com/xtls/xray-core/app/dns\xaa\x02\fXray.App.Dnsb\x06proto3"
|
||||||
0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x64, 0x6e, 0x73, 0x2e, 0x4e, 0x61, 0x6d,
|
|
||||||
0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x0a, 0x6e, 0x61, 0x6d, 0x65, 0x53, 0x65, 0x72,
|
|
||||||
0x76, 0x65, 0x72, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x70,
|
|
||||||
0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x70,
|
|
||||||
0x12, 0x43, 0x0a, 0x0c, 0x73, 0x74, 0x61, 0x74, 0x69, 0x63, 0x5f, 0x68, 0x6f, 0x73, 0x74, 0x73,
|
|
||||||
0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70,
|
|
||||||
0x70, 0x2e, 0x64, 0x6e, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x48, 0x6f, 0x73,
|
|
||||||
0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x52, 0x0b, 0x73, 0x74, 0x61, 0x74, 0x69, 0x63,
|
|
||||||
0x48, 0x6f, 0x73, 0x74, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18, 0x06, 0x20, 0x01,
|
|
||||||
0x28, 0x09, 0x52, 0x03, 0x74, 0x61, 0x67, 0x12, 0x22, 0x0a, 0x0c, 0x64, 0x69, 0x73, 0x61, 0x62,
|
|
||||||
0x6c, 0x65, 0x43, 0x61, 0x63, 0x68, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x64,
|
|
||||||
0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x61, 0x63, 0x68, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x73,
|
|
||||||
0x65, 0x72, 0x76, 0x65, 0x53, 0x74, 0x61, 0x6c, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52,
|
|
||||||
0x0a, 0x73, 0x65, 0x72, 0x76, 0x65, 0x53, 0x74, 0x61, 0x6c, 0x65, 0x12, 0x28, 0x0a, 0x0f, 0x73,
|
|
||||||
0x65, 0x72, 0x76, 0x65, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x64, 0x54, 0x54, 0x4c, 0x18, 0x0d,
|
|
||||||
0x20, 0x01, 0x28, 0x0d, 0x52, 0x0f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x45, 0x78, 0x70, 0x69, 0x72,
|
|
||||||
0x65, 0x64, 0x54, 0x54, 0x4c, 0x12, 0x42, 0x0a, 0x0e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x73,
|
|
||||||
0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e,
|
|
||||||
0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x64, 0x6e, 0x73, 0x2e, 0x51, 0x75, 0x65,
|
|
||||||
0x72, 0x79, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x52, 0x0d, 0x71, 0x75, 0x65, 0x72,
|
|
||||||
0x79, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x12, 0x28, 0x0a, 0x0f, 0x64, 0x69, 0x73,
|
|
||||||
0x61, 0x62, 0x6c, 0x65, 0x46, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x18, 0x0a, 0x20, 0x01,
|
|
||||||
0x28, 0x08, 0x52, 0x0f, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x46, 0x61, 0x6c, 0x6c, 0x62,
|
|
||||||
0x61, 0x63, 0x6b, 0x12, 0x36, 0x0a, 0x16, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x46, 0x61,
|
|
||||||
0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x49, 0x66, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x0b, 0x20,
|
|
||||||
0x01, 0x28, 0x08, 0x52, 0x16, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x46, 0x61, 0x6c, 0x6c,
|
|
||||||
0x62, 0x61, 0x63, 0x6b, 0x49, 0x66, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x30, 0x0a, 0x13, 0x65,
|
|
||||||
0x6e, 0x61, 0x62, 0x6c, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6c, 0x6c, 0x65, 0x6c, 0x51, 0x75, 0x65,
|
|
||||||
0x72, 0x79, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x13, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65,
|
|
||||||
0x50, 0x61, 0x72, 0x61, 0x6c, 0x6c, 0x65, 0x6c, 0x51, 0x75, 0x65, 0x72, 0x79, 0x1a, 0x92, 0x01,
|
|
||||||
0x0a, 0x0b, 0x48, 0x6f, 0x73, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x12, 0x34, 0x0a,
|
|
||||||
0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x78, 0x72,
|
|
||||||
0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x64, 0x6e, 0x73, 0x2e, 0x44, 0x6f, 0x6d, 0x61, 0x69,
|
|
||||||
0x6e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x69, 0x6e, 0x67, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74,
|
|
||||||
0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x18, 0x02, 0x20,
|
|
||||||
0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69,
|
|
||||||
0x70, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x02, 0x69, 0x70, 0x12, 0x25, 0x0a, 0x0e, 0x70,
|
|
||||||
0x72, 0x6f, 0x78, 0x69, 0x65, 0x64, 0x5f, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x18, 0x04, 0x20,
|
|
||||||
0x01, 0x28, 0x09, 0x52, 0x0d, 0x70, 0x72, 0x6f, 0x78, 0x69, 0x65, 0x64, 0x44, 0x6f, 0x6d, 0x61,
|
|
||||||
0x69, 0x6e, 0x4a, 0x04, 0x08, 0x07, 0x10, 0x08, 0x2a, 0x45, 0x0a, 0x12, 0x44, 0x6f, 0x6d, 0x61,
|
|
||||||
0x69, 0x6e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x69, 0x6e, 0x67, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08,
|
|
||||||
0x0a, 0x04, 0x46, 0x75, 0x6c, 0x6c, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x75, 0x62, 0x64,
|
|
||||||
0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x4b, 0x65, 0x79, 0x77, 0x6f,
|
|
||||||
0x72, 0x64, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x65, 0x67, 0x65, 0x78, 0x10, 0x03, 0x2a,
|
|
||||||
0x42, 0x0a, 0x0d, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79,
|
|
||||||
0x12, 0x0a, 0x0a, 0x06, 0x55, 0x53, 0x45, 0x5f, 0x49, 0x50, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07,
|
|
||||||
0x55, 0x53, 0x45, 0x5f, 0x49, 0x50, 0x34, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x53, 0x45,
|
|
||||||
0x5f, 0x49, 0x50, 0x36, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x53, 0x45, 0x5f, 0x53, 0x59,
|
|
||||||
0x53, 0x10, 0x03, 0x42, 0x46, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e,
|
|
||||||
0x61, 0x70, 0x70, 0x2e, 0x64, 0x6e, 0x73, 0x50, 0x01, 0x5a, 0x21, 0x67, 0x69, 0x74, 0x68, 0x75,
|
|
||||||
0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x74, 0x6c, 0x73, 0x2f, 0x78, 0x72, 0x61, 0x79, 0x2d,
|
|
||||||
0x63, 0x6f, 0x72, 0x65, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x64, 0x6e, 0x73, 0xaa, 0x02, 0x0c, 0x58,
|
|
||||||
0x72, 0x61, 0x79, 0x2e, 0x41, 0x70, 0x70, 0x2e, 0x44, 0x6e, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
|
||||||
0x74, 0x6f, 0x33,
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
file_app_dns_config_proto_rawDescOnce sync.Once
|
file_app_dns_config_proto_rawDescOnce sync.Once
|
||||||
file_app_dns_config_proto_rawDescData = file_app_dns_config_proto_rawDesc
|
file_app_dns_config_proto_rawDescData []byte
|
||||||
)
|
)
|
||||||
|
|
||||||
func file_app_dns_config_proto_rawDescGZIP() []byte {
|
func file_app_dns_config_proto_rawDescGZIP() []byte {
|
||||||
file_app_dns_config_proto_rawDescOnce.Do(func() {
|
file_app_dns_config_proto_rawDescOnce.Do(func() {
|
||||||
file_app_dns_config_proto_rawDescData = protoimpl.X.CompressGZIP(file_app_dns_config_proto_rawDescData)
|
file_app_dns_config_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_app_dns_config_proto_rawDesc), len(file_app_dns_config_proto_rawDesc)))
|
||||||
})
|
})
|
||||||
return file_app_dns_config_proto_rawDescData
|
return file_app_dns_config_proto_rawDescData
|
||||||
}
|
}
|
||||||
@@ -790,7 +731,7 @@ func file_app_dns_config_proto_init() {
|
|||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_app_dns_config_proto_rawDesc,
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_app_dns_config_proto_rawDesc), len(file_app_dns_config_proto_rawDesc)),
|
||||||
NumEnums: 2,
|
NumEnums: 2,
|
||||||
NumMessages: 5,
|
NumMessages: 5,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
@@ -802,7 +743,6 @@ func file_app_dns_config_proto_init() {
|
|||||||
MessageInfos: file_app_dns_config_proto_msgTypes,
|
MessageInfos: file_app_dns_config_proto_msgTypes,
|
||||||
}.Build()
|
}.Build()
|
||||||
File_app_dns_config_proto = out.File
|
File_app_dns_config_proto = out.File
|
||||||
file_app_dns_config_proto_rawDesc = nil
|
|
||||||
file_app_dns_config_proto_goTypes = nil
|
file_app_dns_config_proto_goTypes = nil
|
||||||
file_app_dns_config_proto_depIdxs = nil
|
file_app_dns_config_proto_depIdxs = nil
|
||||||
}
|
}
|
||||||
|
|||||||
+27
-98
@@ -12,15 +12,14 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
router "github.com/xtls/xray-core/app/router"
|
"github.com/xtls/xray-core/app/router"
|
||||||
"github.com/xtls/xray-core/common"
|
"github.com/xtls/xray-core/common"
|
||||||
"github.com/xtls/xray-core/common/errors"
|
"github.com/xtls/xray-core/common/errors"
|
||||||
"github.com/xtls/xray-core/common/net"
|
"github.com/xtls/xray-core/common/net"
|
||||||
"github.com/xtls/xray-core/common/platform/filesystem"
|
"github.com/xtls/xray-core/common/platform"
|
||||||
"github.com/xtls/xray-core/common/session"
|
"github.com/xtls/xray-core/common/session"
|
||||||
"github.com/xtls/xray-core/common/strmatcher"
|
"github.com/xtls/xray-core/common/strmatcher"
|
||||||
"github.com/xtls/xray-core/features/dns"
|
"github.com/xtls/xray-core/features/dns"
|
||||||
"google.golang.org/protobuf/proto"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// DNS is a DNS rely server.
|
// DNS is a DNS rely server.
|
||||||
@@ -86,9 +85,31 @@ func New(ctx context.Context, config *Config) (*DNS, error) {
|
|||||||
return nil, errors.New("unexpected query strategy ", config.QueryStrategy)
|
return nil, errors.New("unexpected query strategy ", config.QueryStrategy)
|
||||||
}
|
}
|
||||||
|
|
||||||
hosts, err := NewStaticHosts(config.StaticHosts)
|
var hosts *StaticHosts
|
||||||
if err != nil {
|
mphLoaded := false
|
||||||
return nil, errors.New("failed to create hosts").Base(err)
|
domainMatcherPath := platform.NewEnvFlag(platform.MphCachePath).GetValue(func() string { return "" })
|
||||||
|
if domainMatcherPath != "" {
|
||||||
|
if f, err := os.Open(domainMatcherPath); err == nil {
|
||||||
|
defer f.Close()
|
||||||
|
if m, err := router.LoadGeoSiteMatcher(f, "HOSTS"); err == nil {
|
||||||
|
f.Seek(0, 0)
|
||||||
|
if hostIPs, err := router.LoadGeoSiteHosts(f); err == nil {
|
||||||
|
if sh, err := NewStaticHostsFromCache(m, hostIPs); err == nil {
|
||||||
|
hosts = sh
|
||||||
|
mphLoaded = true
|
||||||
|
errors.LogDebug(ctx, "MphDomainMatcher loaded from cache for DNS hosts, size: ", sh.matchers.Size())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if !mphLoaded {
|
||||||
|
sh, err := NewStaticHosts(config.StaticHosts)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.New("failed to create hosts").Base(err)
|
||||||
|
}
|
||||||
|
hosts = sh
|
||||||
}
|
}
|
||||||
|
|
||||||
var clients []*Client
|
var clients []*Client
|
||||||
@@ -100,25 +121,6 @@ func New(ctx context.Context, config *Config) (*DNS, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, ns := range config.NameServer {
|
for _, ns := range config.NameServer {
|
||||||
if runtime.GOOS != "windows" && runtime.GOOS != "wasm" {
|
|
||||||
err := parseDomains(ns)
|
|
||||||
if err != nil {
|
|
||||||
return nil, errors.New("failed to parse dns domain rules: ").Base(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
expectedGeoip, err := router.GetGeoIPList(ns.ExpectedGeoip)
|
|
||||||
if err != nil {
|
|
||||||
return nil, errors.New("failed to parse dns expectIPs rules: ").Base(err)
|
|
||||||
}
|
|
||||||
ns.ExpectedGeoip = expectedGeoip
|
|
||||||
|
|
||||||
unexpectedGeoip, err := router.GetGeoIPList(ns.UnexpectedGeoip)
|
|
||||||
if err != nil {
|
|
||||||
return nil, errors.New("failed to parse dns unexpectedGeoip rules: ").Base(err)
|
|
||||||
}
|
|
||||||
ns.UnexpectedGeoip = unexpectedGeoip
|
|
||||||
|
|
||||||
}
|
|
||||||
domainRuleCount += len(ns.PrioritizedDomain)
|
domainRuleCount += len(ns.PrioritizedDomain)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -602,76 +604,3 @@ func detectGUIPlatform() bool {
|
|||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseDomains(ns *NameServer) error {
|
|
||||||
pureDomains := []*router.Domain{}
|
|
||||||
|
|
||||||
// convert to pure domain
|
|
||||||
for _, pd := range ns.PrioritizedDomain {
|
|
||||||
pureDomains = append(pureDomains, &router.Domain{
|
|
||||||
Type: router.Domain_Type(pd.Type),
|
|
||||||
Value: pd.Domain,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
domainList := []*router.Domain{}
|
|
||||||
for _, domain := range pureDomains {
|
|
||||||
val := strings.Split(domain.Value, "_")
|
|
||||||
if len(val) >= 2 {
|
|
||||||
|
|
||||||
fileName := val[0]
|
|
||||||
code := val[1]
|
|
||||||
|
|
||||||
bs, err := filesystem.ReadAsset(fileName)
|
|
||||||
if err != nil {
|
|
||||||
return errors.New("failed to load file: ", fileName).Base(err)
|
|
||||||
}
|
|
||||||
bs = filesystem.Find(bs, []byte(code))
|
|
||||||
var geosite router.GeoSite
|
|
||||||
|
|
||||||
if err := proto.Unmarshal(bs, &geosite); err != nil {
|
|
||||||
return errors.New("failed Unmarshal :").Base(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// parse attr
|
|
||||||
if len(val) == 3 {
|
|
||||||
siteWithAttr := strings.Split(val[2], ",")
|
|
||||||
attrs := router.ParseAttrs(siteWithAttr)
|
|
||||||
if !attrs.IsEmpty() {
|
|
||||||
filteredDomains := make([]*router.Domain, 0, len(pureDomains))
|
|
||||||
for _, domain := range geosite.Domain {
|
|
||||||
if attrs.Match(domain) {
|
|
||||||
filteredDomains = append(filteredDomains, domain)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
geosite.Domain = filteredDomains
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
domainList = append(domainList, geosite.Domain...)
|
|
||||||
|
|
||||||
// update ns.OriginalRules Size
|
|
||||||
ruleTag := strings.Join(val, ":")
|
|
||||||
for i, oRule := range ns.OriginalRules {
|
|
||||||
if oRule.Rule == strings.ToLower(ruleTag) {
|
|
||||||
ns.OriginalRules[i].Size = uint32(len(geosite.Domain))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
domainList = append(domainList, domain)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// convert back to NameServer_PriorityDomain
|
|
||||||
ns.PrioritizedDomain = []*NameServer_PriorityDomain{}
|
|
||||||
for _, pd := range domainList {
|
|
||||||
ns.PrioritizedDomain = append(ns.PrioritizedDomain, &NameServer_PriorityDomain{
|
|
||||||
Type: ToDomainMatchingType(pd.Type),
|
|
||||||
Domain: pd.Value,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|||||||
+4
-4
@@ -541,7 +541,7 @@ func TestIPMatch(t *testing.T) {
|
|||||||
},
|
},
|
||||||
ExpectedGeoip: []*router.GeoIP{
|
ExpectedGeoip: []*router.GeoIP{
|
||||||
{
|
{
|
||||||
// local
|
CountryCode: "local",
|
||||||
Cidr: []*router.CIDR{
|
Cidr: []*router.CIDR{
|
||||||
{
|
{
|
||||||
// inner ip, will not match
|
// inner ip, will not match
|
||||||
@@ -565,7 +565,7 @@ func TestIPMatch(t *testing.T) {
|
|||||||
},
|
},
|
||||||
ExpectedGeoip: []*router.GeoIP{
|
ExpectedGeoip: []*router.GeoIP{
|
||||||
{
|
{
|
||||||
// test
|
CountryCode: "test",
|
||||||
Cidr: []*router.CIDR{
|
Cidr: []*router.CIDR{
|
||||||
{
|
{
|
||||||
Ip: []byte{8, 8, 8, 8},
|
Ip: []byte{8, 8, 8, 8},
|
||||||
@@ -574,7 +574,7 @@ func TestIPMatch(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// test
|
CountryCode: "test",
|
||||||
Cidr: []*router.CIDR{
|
Cidr: []*router.CIDR{
|
||||||
{
|
{
|
||||||
Ip: []byte{8, 8, 8, 4},
|
Ip: []byte{8, 8, 8, 4},
|
||||||
@@ -669,7 +669,7 @@ func TestLocalDomain(t *testing.T) {
|
|||||||
},
|
},
|
||||||
ExpectedGeoip: []*router.GeoIP{
|
ExpectedGeoip: []*router.GeoIP{
|
||||||
{ // Will match localhost, localhost-a and localhost-b,
|
{ // Will match localhost, localhost-a and localhost-b,
|
||||||
// local
|
CountryCode: "local",
|
||||||
Cidr: []*router.CIDR{
|
Cidr: []*router.CIDR{
|
||||||
{Ip: []byte{127, 0, 0, 2}, Prefix: 32},
|
{Ip: []byte{127, 0, 0, 2}, Prefix: 32},
|
||||||
{Ip: []byte{127, 0, 0, 3}, Prefix: 32},
|
{Ip: []byte{127, 0, 0, 3}, Prefix: 32},
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.35.1
|
// protoc-gen-go v1.36.11
|
||||||
// protoc v5.28.2
|
// protoc v6.33.5
|
||||||
// source: app/dns/fakedns/fakedns.proto
|
// source: app/dns/fakedns/fakedns.proto
|
||||||
|
|
||||||
package fakedns
|
package fakedns
|
||||||
@@ -11,6 +11,7 @@ import (
|
|||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
sync "sync"
|
sync "sync"
|
||||||
|
unsafe "unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -21,12 +22,11 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type FakeDnsPool struct {
|
type FakeDnsPool struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
IpPool string `protobuf:"bytes,1,opt,name=ip_pool,json=ipPool,proto3" json:"ip_pool,omitempty"` //CIDR of IP pool used as fake DNS IP
|
||||||
|
LruSize int64 `protobuf:"varint,2,opt,name=lruSize,proto3" json:"lruSize,omitempty"` //Size of Pool for remembering relationship between domain name and IP address
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
IpPool string `protobuf:"bytes,1,opt,name=ip_pool,json=ipPool,proto3" json:"ip_pool,omitempty"` //CIDR of IP pool used as fake DNS IP
|
|
||||||
LruSize int64 `protobuf:"varint,2,opt,name=lruSize,proto3" json:"lruSize,omitempty"` //Size of Pool for remembering relationship between domain name and IP address
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *FakeDnsPool) Reset() {
|
func (x *FakeDnsPool) Reset() {
|
||||||
@@ -74,11 +74,10 @@ func (x *FakeDnsPool) GetLruSize() int64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type FakeDnsPoolMulti struct {
|
type FakeDnsPoolMulti struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Pools []*FakeDnsPool `protobuf:"bytes,1,rep,name=pools,proto3" json:"pools,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
Pools []*FakeDnsPool `protobuf:"bytes,1,rep,name=pools,proto3" json:"pools,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *FakeDnsPoolMulti) Reset() {
|
func (x *FakeDnsPoolMulti) Reset() {
|
||||||
@@ -120,36 +119,24 @@ func (x *FakeDnsPoolMulti) GetPools() []*FakeDnsPool {
|
|||||||
|
|
||||||
var File_app_dns_fakedns_fakedns_proto protoreflect.FileDescriptor
|
var File_app_dns_fakedns_fakedns_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_app_dns_fakedns_fakedns_proto_rawDesc = []byte{
|
const file_app_dns_fakedns_fakedns_proto_rawDesc = "" +
|
||||||
0x0a, 0x1d, 0x61, 0x70, 0x70, 0x2f, 0x64, 0x6e, 0x73, 0x2f, 0x66, 0x61, 0x6b, 0x65, 0x64, 0x6e,
|
"\n" +
|
||||||
0x73, 0x2f, 0x66, 0x61, 0x6b, 0x65, 0x64, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
|
"\x1dapp/dns/fakedns/fakedns.proto\x12\x14xray.app.dns.fakedns\"@\n" +
|
||||||
0x14, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x64, 0x6e, 0x73, 0x2e, 0x66, 0x61,
|
"\vFakeDnsPool\x12\x17\n" +
|
||||||
0x6b, 0x65, 0x64, 0x6e, 0x73, 0x22, 0x40, 0x0a, 0x0b, 0x46, 0x61, 0x6b, 0x65, 0x44, 0x6e, 0x73,
|
"\aip_pool\x18\x01 \x01(\tR\x06ipPool\x12\x18\n" +
|
||||||
0x50, 0x6f, 0x6f, 0x6c, 0x12, 0x17, 0x0a, 0x07, 0x69, 0x70, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x18,
|
"\alruSize\x18\x02 \x01(\x03R\alruSize\"K\n" +
|
||||||
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x69, 0x70, 0x50, 0x6f, 0x6f, 0x6c, 0x12, 0x18, 0x0a,
|
"\x10FakeDnsPoolMulti\x127\n" +
|
||||||
0x07, 0x6c, 0x72, 0x75, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07,
|
"\x05pools\x18\x01 \x03(\v2!.xray.app.dns.fakedns.FakeDnsPoolR\x05poolsB^\n" +
|
||||||
0x6c, 0x72, 0x75, 0x53, 0x69, 0x7a, 0x65, 0x22, 0x4b, 0x0a, 0x10, 0x46, 0x61, 0x6b, 0x65, 0x44,
|
"\x18com.xray.app.dns.fakednsP\x01Z)github.com/xtls/xray-core/app/dns/fakedns\xaa\x02\x14Xray.App.Dns.Fakednsb\x06proto3"
|
||||||
0x6e, 0x73, 0x50, 0x6f, 0x6f, 0x6c, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x12, 0x37, 0x0a, 0x05, 0x70,
|
|
||||||
0x6f, 0x6f, 0x6c, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x78, 0x72, 0x61,
|
|
||||||
0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x64, 0x6e, 0x73, 0x2e, 0x66, 0x61, 0x6b, 0x65, 0x64, 0x6e,
|
|
||||||
0x73, 0x2e, 0x46, 0x61, 0x6b, 0x65, 0x44, 0x6e, 0x73, 0x50, 0x6f, 0x6f, 0x6c, 0x52, 0x05, 0x70,
|
|
||||||
0x6f, 0x6f, 0x6c, 0x73, 0x42, 0x5e, 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79,
|
|
||||||
0x2e, 0x61, 0x70, 0x70, 0x2e, 0x64, 0x6e, 0x73, 0x2e, 0x66, 0x61, 0x6b, 0x65, 0x64, 0x6e, 0x73,
|
|
||||||
0x50, 0x01, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78,
|
|
||||||
0x74, 0x6c, 0x73, 0x2f, 0x78, 0x72, 0x61, 0x79, 0x2d, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x61, 0x70,
|
|
||||||
0x70, 0x2f, 0x64, 0x6e, 0x73, 0x2f, 0x66, 0x61, 0x6b, 0x65, 0x64, 0x6e, 0x73, 0xaa, 0x02, 0x14,
|
|
||||||
0x58, 0x72, 0x61, 0x79, 0x2e, 0x41, 0x70, 0x70, 0x2e, 0x44, 0x6e, 0x73, 0x2e, 0x46, 0x61, 0x6b,
|
|
||||||
0x65, 0x64, 0x6e, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
file_app_dns_fakedns_fakedns_proto_rawDescOnce sync.Once
|
file_app_dns_fakedns_fakedns_proto_rawDescOnce sync.Once
|
||||||
file_app_dns_fakedns_fakedns_proto_rawDescData = file_app_dns_fakedns_fakedns_proto_rawDesc
|
file_app_dns_fakedns_fakedns_proto_rawDescData []byte
|
||||||
)
|
)
|
||||||
|
|
||||||
func file_app_dns_fakedns_fakedns_proto_rawDescGZIP() []byte {
|
func file_app_dns_fakedns_fakedns_proto_rawDescGZIP() []byte {
|
||||||
file_app_dns_fakedns_fakedns_proto_rawDescOnce.Do(func() {
|
file_app_dns_fakedns_fakedns_proto_rawDescOnce.Do(func() {
|
||||||
file_app_dns_fakedns_fakedns_proto_rawDescData = protoimpl.X.CompressGZIP(file_app_dns_fakedns_fakedns_proto_rawDescData)
|
file_app_dns_fakedns_fakedns_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_app_dns_fakedns_fakedns_proto_rawDesc), len(file_app_dns_fakedns_fakedns_proto_rawDesc)))
|
||||||
})
|
})
|
||||||
return file_app_dns_fakedns_fakedns_proto_rawDescData
|
return file_app_dns_fakedns_fakedns_proto_rawDescData
|
||||||
}
|
}
|
||||||
@@ -177,7 +164,7 @@ func file_app_dns_fakedns_fakedns_proto_init() {
|
|||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_app_dns_fakedns_fakedns_proto_rawDesc,
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_app_dns_fakedns_fakedns_proto_rawDesc), len(file_app_dns_fakedns_fakedns_proto_rawDesc)),
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 2,
|
NumMessages: 2,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
@@ -188,7 +175,6 @@ func file_app_dns_fakedns_fakedns_proto_init() {
|
|||||||
MessageInfos: file_app_dns_fakedns_fakedns_proto_msgTypes,
|
MessageInfos: file_app_dns_fakedns_fakedns_proto_msgTypes,
|
||||||
}.Build()
|
}.Build()
|
||||||
File_app_dns_fakedns_fakedns_proto = out.File
|
File_app_dns_fakedns_fakedns_proto = out.File
|
||||||
file_app_dns_fakedns_fakedns_proto_rawDesc = nil
|
|
||||||
file_app_dns_fakedns_fakedns_proto_goTypes = nil
|
file_app_dns_fakedns_fakedns_proto_goTypes = nil
|
||||||
file_app_dns_fakedns_fakedns_proto_depIdxs = nil
|
file_app_dns_fakedns_fakedns_proto_depIdxs = nil
|
||||||
}
|
}
|
||||||
|
|||||||
+52
-2
@@ -2,6 +2,7 @@ package dns
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/xtls/xray-core/common/errors"
|
"github.com/xtls/xray-core/common/errors"
|
||||||
@@ -13,7 +14,7 @@ import (
|
|||||||
// StaticHosts represents static domain-ip mapping in DNS server.
|
// StaticHosts represents static domain-ip mapping in DNS server.
|
||||||
type StaticHosts struct {
|
type StaticHosts struct {
|
||||||
ips [][]net.Address
|
ips [][]net.Address
|
||||||
matchers *strmatcher.MatcherGroup
|
matchers strmatcher.IndexMatcher
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewStaticHosts creates a new StaticHosts instance.
|
// NewStaticHosts creates a new StaticHosts instance.
|
||||||
@@ -24,7 +25,9 @@ func NewStaticHosts(hosts []*Config_HostMapping) (*StaticHosts, error) {
|
|||||||
matchers: g,
|
matchers: g,
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, mapping := range hosts {
|
defer runtime.GC()
|
||||||
|
for i, mapping := range hosts {
|
||||||
|
hosts[i] = nil
|
||||||
matcher, err := toStrMatcher(mapping.Type, mapping.Domain)
|
matcher, err := toStrMatcher(mapping.Type, mapping.Domain)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errors.LogErrorInner(context.Background(), err, "failed to create domain matcher, ignore domain rule [type: ", mapping.Type, ", domain: ", mapping.Domain, "]")
|
errors.LogErrorInner(context.Background(), err, "failed to create domain matcher, ignore domain rule [type: ", mapping.Type, ", domain: ", mapping.Domain, "]")
|
||||||
@@ -121,3 +124,50 @@ func (h *StaticHosts) lookup(domain string, option dns.IPOption, maxDepth int) (
|
|||||||
func (h *StaticHosts) Lookup(domain string, option dns.IPOption) ([]net.Address, error) {
|
func (h *StaticHosts) Lookup(domain string, option dns.IPOption) ([]net.Address, error) {
|
||||||
return h.lookup(domain, option, 5)
|
return h.lookup(domain, option, 5)
|
||||||
}
|
}
|
||||||
|
func NewStaticHostsFromCache(matcher strmatcher.IndexMatcher, hostIPs map[string][]string) (*StaticHosts, error) {
|
||||||
|
sh := &StaticHosts{
|
||||||
|
ips: make([][]net.Address, matcher.Size()+1),
|
||||||
|
matchers: matcher,
|
||||||
|
}
|
||||||
|
|
||||||
|
order := hostIPs["_ORDER"]
|
||||||
|
var offset uint32
|
||||||
|
|
||||||
|
img, ok := matcher.(*strmatcher.IndexMatcherGroup)
|
||||||
|
if !ok {
|
||||||
|
// Single matcher (e.g. only manual or only one geosite)
|
||||||
|
if len(order) > 0 {
|
||||||
|
pattern := order[0]
|
||||||
|
ips := parseIPs(hostIPs[pattern])
|
||||||
|
for i := uint32(1); i <= matcher.Size(); i++ {
|
||||||
|
sh.ips[i] = ips
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sh, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
for i, m := range img.Matchers {
|
||||||
|
if i < len(order) {
|
||||||
|
pattern := order[i]
|
||||||
|
ips := parseIPs(hostIPs[pattern])
|
||||||
|
for j := uint32(1); j <= m.Size(); j++ {
|
||||||
|
sh.ips[offset+j] = ips
|
||||||
|
}
|
||||||
|
offset += m.Size()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sh, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func parseIPs(raw []string) []net.Address {
|
||||||
|
addrs := make([]net.Address, 0, len(raw))
|
||||||
|
for _, s := range raw {
|
||||||
|
if len(s) > 1 && s[0] == '#' {
|
||||||
|
rcode, _ := strconv.Atoi(s[1:])
|
||||||
|
addrs = append(addrs, dns.RCodeError(rcode))
|
||||||
|
} else {
|
||||||
|
addrs = append(addrs, net.ParseAddress(s))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return addrs
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
package dns_test
|
package dns_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/google/go-cmp/cmp"
|
"github.com/google/go-cmp/cmp"
|
||||||
. "github.com/xtls/xray-core/app/dns"
|
. "github.com/xtls/xray-core/app/dns"
|
||||||
|
"github.com/xtls/xray-core/app/router"
|
||||||
"github.com/xtls/xray-core/common"
|
"github.com/xtls/xray-core/common"
|
||||||
"github.com/xtls/xray-core/common/net"
|
"github.com/xtls/xray-core/common/net"
|
||||||
"github.com/xtls/xray-core/features/dns"
|
"github.com/xtls/xray-core/features/dns"
|
||||||
@@ -130,3 +132,57 @@ func TestStaticHosts(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
func TestStaticHostsFromCache(t *testing.T) {
|
||||||
|
sites := []*router.GeoSite{
|
||||||
|
{
|
||||||
|
CountryCode: "cloudflare-dns.com",
|
||||||
|
Domain: []*router.Domain{
|
||||||
|
{Type: router.Domain_Full, Value: "example.com"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
CountryCode: "geosite:cn",
|
||||||
|
Domain: []*router.Domain{
|
||||||
|
{Type: router.Domain_Domain, Value: "baidu.cn"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
deps := map[string][]string{
|
||||||
|
"HOSTS": {"cloudflare-dns.com", "geosite:cn"},
|
||||||
|
}
|
||||||
|
hostIPs := map[string][]string{
|
||||||
|
"cloudflare-dns.com": {"1.1.1.1"},
|
||||||
|
"geosite:cn": {"2.2.2.2"},
|
||||||
|
"_ORDER": {"cloudflare-dns.com", "geosite:cn"},
|
||||||
|
}
|
||||||
|
|
||||||
|
var buf bytes.Buffer
|
||||||
|
err := router.SerializeGeoSiteList(sites, deps, hostIPs, &buf)
|
||||||
|
common.Must(err)
|
||||||
|
|
||||||
|
// Load matcher
|
||||||
|
m, err := router.LoadGeoSiteMatcher(bytes.NewReader(buf.Bytes()), "HOSTS")
|
||||||
|
common.Must(err)
|
||||||
|
|
||||||
|
// Load hostIPs
|
||||||
|
f := bytes.NewReader(buf.Bytes())
|
||||||
|
hips, err := router.LoadGeoSiteHosts(f)
|
||||||
|
common.Must(err)
|
||||||
|
|
||||||
|
hosts, err := NewStaticHostsFromCache(m, hips)
|
||||||
|
common.Must(err)
|
||||||
|
|
||||||
|
{
|
||||||
|
ips, _ := hosts.Lookup("example.com", dns.IPOption{IPv4Enable: true})
|
||||||
|
if len(ips) != 1 || ips[0].String() != "1.1.1.1" {
|
||||||
|
t.Error("failed to lookup example.com from cache")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
ips, _ := hosts.Lookup("baidu.cn", dns.IPOption{IPv4Enable: true})
|
||||||
|
if len(ips) != 1 || ips[0].String() != "2.2.2.2" {
|
||||||
|
t.Error("failed to lookup baidu.cn from cache deps")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
+61
-33
@@ -3,12 +3,15 @@ package dns
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/xtls/xray-core/app/router"
|
"github.com/xtls/xray-core/app/router"
|
||||||
"github.com/xtls/xray-core/common/errors"
|
"github.com/xtls/xray-core/common/errors"
|
||||||
"github.com/xtls/xray-core/common/net"
|
"github.com/xtls/xray-core/common/net"
|
||||||
|
"github.com/xtls/xray-core/common/platform"
|
||||||
|
"github.com/xtls/xray-core/common/platform/filesystem"
|
||||||
"github.com/xtls/xray-core/common/session"
|
"github.com/xtls/xray-core/common/session"
|
||||||
"github.com/xtls/xray-core/common/strmatcher"
|
"github.com/xtls/xray-core/common/strmatcher"
|
||||||
"github.com/xtls/xray-core/core"
|
"github.com/xtls/xray-core/core"
|
||||||
@@ -16,6 +19,18 @@ import (
|
|||||||
"github.com/xtls/xray-core/features/routing"
|
"github.com/xtls/xray-core/features/routing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type mphMatcherWrapper struct {
|
||||||
|
m strmatcher.IndexMatcher
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *mphMatcherWrapper) Match(s string) bool {
|
||||||
|
return w.m.Match(s) != nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *mphMatcherWrapper) String() string {
|
||||||
|
return "mph-matcher"
|
||||||
|
}
|
||||||
|
|
||||||
// Server is the interface for Name Server.
|
// Server is the interface for Name Server.
|
||||||
type Server interface {
|
type Server interface {
|
||||||
// Name of the Client.
|
// Name of the Client.
|
||||||
@@ -131,29 +146,53 @@ func NewClient(
|
|||||||
var rules []string
|
var rules []string
|
||||||
ruleCurr := 0
|
ruleCurr := 0
|
||||||
ruleIter := 0
|
ruleIter := 0
|
||||||
for _, domain := range ns.PrioritizedDomain {
|
|
||||||
domainRule, err := toStrMatcher(domain.Type, domain.Domain)
|
// Check if domain matcher cache is provided via environment
|
||||||
if err != nil {
|
domainMatcherPath := platform.NewEnvFlag(platform.MphCachePath).GetValue(func() string { return "" })
|
||||||
errors.LogErrorInner(ctx, err, "failed to create domain matcher, ignore domain rule [type: ", domain.Type, ", domain: ", domain.Domain, "]")
|
var mphLoaded bool
|
||||||
domainRule, _ = toStrMatcher(DomainMatchingType_Full, "hack.fix.index.for.illegal.domain.rule")
|
|
||||||
}
|
if domainMatcherPath != "" && ns.Tag != "" {
|
||||||
originalRuleIdx := ruleCurr
|
f, err := filesystem.NewFileReader(domainMatcherPath)
|
||||||
if ruleCurr < len(ns.OriginalRules) {
|
if err == nil {
|
||||||
rule := ns.OriginalRules[ruleCurr]
|
defer f.Close()
|
||||||
if ruleCurr >= len(rules) {
|
g, err := router.LoadGeoSiteMatcher(f, ns.Tag)
|
||||||
rules = append(rules, rule.Rule)
|
if err == nil {
|
||||||
|
errors.LogDebug(ctx, "MphDomainMatcher loaded from cache for ", ns.Tag, " dns tag)")
|
||||||
|
updateDomainRule(&mphMatcherWrapper{m: g}, 0, *matcherInfos)
|
||||||
|
rules = append(rules, "[MPH Cache]")
|
||||||
|
mphLoaded = true
|
||||||
}
|
}
|
||||||
ruleIter++
|
}
|
||||||
if ruleIter >= int(rule.Size) {
|
}
|
||||||
ruleIter = 0
|
|
||||||
|
if !mphLoaded {
|
||||||
|
for i, domain := range ns.PrioritizedDomain {
|
||||||
|
ns.PrioritizedDomain[i] = nil
|
||||||
|
domainRule, err := toStrMatcher(domain.Type, domain.Domain)
|
||||||
|
if err != nil {
|
||||||
|
errors.LogErrorInner(ctx, err, "failed to create domain matcher, ignore domain rule [type: ", domain.Type, ", domain: ", domain.Domain, "]")
|
||||||
|
domainRule, _ = toStrMatcher(DomainMatchingType_Full, "hack.fix.index.for.illegal.domain.rule")
|
||||||
|
}
|
||||||
|
originalRuleIdx := ruleCurr
|
||||||
|
if ruleCurr < len(ns.OriginalRules) {
|
||||||
|
rule := ns.OriginalRules[ruleCurr]
|
||||||
|
if ruleCurr >= len(rules) {
|
||||||
|
rules = append(rules, rule.Rule)
|
||||||
|
}
|
||||||
|
ruleIter++
|
||||||
|
if ruleIter >= int(rule.Size) {
|
||||||
|
ruleIter = 0
|
||||||
|
ruleCurr++
|
||||||
|
}
|
||||||
|
} else { // No original rule, generate one according to current domain matcher (majorly for compatibility with tests)
|
||||||
|
rules = append(rules, domainRule.String())
|
||||||
ruleCurr++
|
ruleCurr++
|
||||||
}
|
}
|
||||||
} else { // No original rule, generate one according to current domain matcher (majorly for compatibility with tests)
|
updateDomainRule(domainRule, originalRuleIdx, *matcherInfos)
|
||||||
rules = append(rules, domainRule.String())
|
|
||||||
ruleCurr++
|
|
||||||
}
|
}
|
||||||
updateDomainRule(domainRule, originalRuleIdx, *matcherInfos)
|
|
||||||
}
|
}
|
||||||
|
ns.PrioritizedDomain = nil
|
||||||
|
runtime.GC()
|
||||||
|
|
||||||
// Establish expected IPs
|
// Establish expected IPs
|
||||||
var expectedMatcher router.GeoIPMatcher
|
var expectedMatcher router.GeoIPMatcher
|
||||||
@@ -162,6 +201,8 @@ func NewClient(
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.New("failed to create expected ip matcher").Base(err).AtWarning()
|
return errors.New("failed to create expected ip matcher").Base(err).AtWarning()
|
||||||
}
|
}
|
||||||
|
ns.ExpectedGeoip = nil
|
||||||
|
runtime.GC()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Establish unexpected IPs
|
// Establish unexpected IPs
|
||||||
@@ -171,6 +212,8 @@ func NewClient(
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.New("failed to create unexpected ip matcher").Base(err).AtWarning()
|
return errors.New("failed to create unexpected ip matcher").Base(err).AtWarning()
|
||||||
}
|
}
|
||||||
|
ns.UnexpectedGeoip = nil
|
||||||
|
runtime.GC()
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(clientIP) > 0 {
|
if len(clientIP) > 0 {
|
||||||
@@ -297,18 +340,3 @@ func ResolveIpOptionOverride(queryStrategy QueryStrategy, ipOption dns.IPOption)
|
|||||||
return ipOption
|
return ipOption
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func ToDomainMatchingType(t router.Domain_Type) DomainMatchingType {
|
|
||||||
switch t {
|
|
||||||
case router.Domain_Domain:
|
|
||||||
return DomainMatchingType_Subdomain
|
|
||||||
case router.Domain_Full:
|
|
||||||
return DomainMatchingType_Full
|
|
||||||
case router.Domain_Plain:
|
|
||||||
return DomainMatchingType_Keyword
|
|
||||||
case router.Domain_Regex:
|
|
||||||
return DomainMatchingType_Regex
|
|
||||||
default:
|
|
||||||
panic("unknown domain type")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
utls "github.com/refraction-networking/utls"
|
utls "github.com/refraction-networking/utls"
|
||||||
@@ -20,6 +19,7 @@ import (
|
|||||||
"github.com/xtls/xray-core/common/net/cnc"
|
"github.com/xtls/xray-core/common/net/cnc"
|
||||||
"github.com/xtls/xray-core/common/protocol/dns"
|
"github.com/xtls/xray-core/common/protocol/dns"
|
||||||
"github.com/xtls/xray-core/common/session"
|
"github.com/xtls/xray-core/common/session"
|
||||||
|
"github.com/xtls/xray-core/common/utils"
|
||||||
dns_feature "github.com/xtls/xray-core/features/dns"
|
dns_feature "github.com/xtls/xray-core/features/dns"
|
||||||
"github.com/xtls/xray-core/features/routing"
|
"github.com/xtls/xray-core/features/routing"
|
||||||
"github.com/xtls/xray-core/transport/internet"
|
"github.com/xtls/xray-core/transport/internet"
|
||||||
@@ -214,8 +214,8 @@ func (s *DoHNameServer) dohHTTPSContext(ctx context.Context, b []byte) ([]byte,
|
|||||||
|
|
||||||
req.Header.Add("Accept", "application/dns-message")
|
req.Header.Add("Accept", "application/dns-message")
|
||||||
req.Header.Add("Content-Type", "application/dns-message")
|
req.Header.Add("Content-Type", "application/dns-message")
|
||||||
|
utils.TryDefaultHeadersWith(req.Header, "fetch")
|
||||||
req.Header.Set("X-Padding", strings.Repeat("X", int(crypto.RandBetween(100, 1000))))
|
req.Header.Set("X-Padding", utils.H2Base62Pad(crypto.RandBetween(100, 1000)))
|
||||||
|
|
||||||
hc := s.httpClient
|
hc := s.httpClient
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/quic-go/quic-go"
|
"github.com/apernet/quic-go"
|
||||||
"github.com/xtls/xray-core/common/buf"
|
"github.com/xtls/xray-core/common/buf"
|
||||||
"github.com/xtls/xray-core/common/errors"
|
"github.com/xtls/xray-core/common/errors"
|
||||||
"github.com/xtls/xray-core/common/log"
|
"github.com/xtls/xray-core/common/log"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.35.1
|
// protoc-gen-go v1.36.11
|
||||||
// protoc v5.28.2
|
// protoc v6.33.5
|
||||||
// source: app/log/command/config.proto
|
// source: app/log/command/config.proto
|
||||||
|
|
||||||
package command
|
package command
|
||||||
@@ -11,6 +11,7 @@ import (
|
|||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
sync "sync"
|
sync "sync"
|
||||||
|
unsafe "unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -21,9 +22,9 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Config) Reset() {
|
func (x *Config) Reset() {
|
||||||
@@ -57,9 +58,9 @@ func (*Config) Descriptor() ([]byte, []int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type RestartLoggerRequest struct {
|
type RestartLoggerRequest struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *RestartLoggerRequest) Reset() {
|
func (x *RestartLoggerRequest) Reset() {
|
||||||
@@ -93,9 +94,9 @@ func (*RestartLoggerRequest) Descriptor() ([]byte, []int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type RestartLoggerResponse struct {
|
type RestartLoggerResponse struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *RestartLoggerResponse) Reset() {
|
func (x *RestartLoggerResponse) Reset() {
|
||||||
@@ -130,39 +131,24 @@ func (*RestartLoggerResponse) Descriptor() ([]byte, []int) {
|
|||||||
|
|
||||||
var File_app_log_command_config_proto protoreflect.FileDescriptor
|
var File_app_log_command_config_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_app_log_command_config_proto_rawDesc = []byte{
|
const file_app_log_command_config_proto_rawDesc = "" +
|
||||||
0x0a, 0x1c, 0x61, 0x70, 0x70, 0x2f, 0x6c, 0x6f, 0x67, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e,
|
"\n" +
|
||||||
0x64, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14,
|
"\x1capp/log/command/config.proto\x12\x14xray.app.log.command\"\b\n" +
|
||||||
0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x6c, 0x6f, 0x67, 0x2e, 0x63, 0x6f, 0x6d,
|
"\x06Config\"\x16\n" +
|
||||||
0x6d, 0x61, 0x6e, 0x64, 0x22, 0x08, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x22, 0x16,
|
"\x14RestartLoggerRequest\"\x17\n" +
|
||||||
0x0a, 0x14, 0x52, 0x65, 0x73, 0x74, 0x61, 0x72, 0x74, 0x4c, 0x6f, 0x67, 0x67, 0x65, 0x72, 0x52,
|
"\x15RestartLoggerResponse2{\n" +
|
||||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x17, 0x0a, 0x15, 0x52, 0x65, 0x73, 0x74, 0x61, 0x72,
|
"\rLoggerService\x12j\n" +
|
||||||
0x74, 0x4c, 0x6f, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32,
|
"\rRestartLogger\x12*.xray.app.log.command.RestartLoggerRequest\x1a+.xray.app.log.command.RestartLoggerResponse\"\x00B^\n" +
|
||||||
0x7b, 0x0a, 0x0d, 0x4c, 0x6f, 0x67, 0x67, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
"\x18com.xray.app.log.commandP\x01Z)github.com/xtls/xray-core/app/log/command\xaa\x02\x14Xray.App.Log.Commandb\x06proto3"
|
||||||
0x12, 0x6a, 0x0a, 0x0d, 0x52, 0x65, 0x73, 0x74, 0x61, 0x72, 0x74, 0x4c, 0x6f, 0x67, 0x67, 0x65,
|
|
||||||
0x72, 0x12, 0x2a, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x6c, 0x6f, 0x67,
|
|
||||||
0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x52, 0x65, 0x73, 0x74, 0x61, 0x72, 0x74,
|
|
||||||
0x4c, 0x6f, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e,
|
|
||||||
0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x6c, 0x6f, 0x67, 0x2e, 0x63, 0x6f, 0x6d,
|
|
||||||
0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x52, 0x65, 0x73, 0x74, 0x61, 0x72, 0x74, 0x4c, 0x6f, 0x67, 0x67,
|
|
||||||
0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x5e, 0x0a, 0x18,
|
|
||||||
0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x6c, 0x6f, 0x67,
|
|
||||||
0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x50, 0x01, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68,
|
|
||||||
0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x74, 0x6c, 0x73, 0x2f, 0x78, 0x72, 0x61, 0x79,
|
|
||||||
0x2d, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x6c, 0x6f, 0x67, 0x2f, 0x63, 0x6f,
|
|
||||||
0x6d, 0x6d, 0x61, 0x6e, 0x64, 0xaa, 0x02, 0x14, 0x58, 0x72, 0x61, 0x79, 0x2e, 0x41, 0x70, 0x70,
|
|
||||||
0x2e, 0x4c, 0x6f, 0x67, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x62, 0x06, 0x70, 0x72,
|
|
||||||
0x6f, 0x74, 0x6f, 0x33,
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
file_app_log_command_config_proto_rawDescOnce sync.Once
|
file_app_log_command_config_proto_rawDescOnce sync.Once
|
||||||
file_app_log_command_config_proto_rawDescData = file_app_log_command_config_proto_rawDesc
|
file_app_log_command_config_proto_rawDescData []byte
|
||||||
)
|
)
|
||||||
|
|
||||||
func file_app_log_command_config_proto_rawDescGZIP() []byte {
|
func file_app_log_command_config_proto_rawDescGZIP() []byte {
|
||||||
file_app_log_command_config_proto_rawDescOnce.Do(func() {
|
file_app_log_command_config_proto_rawDescOnce.Do(func() {
|
||||||
file_app_log_command_config_proto_rawDescData = protoimpl.X.CompressGZIP(file_app_log_command_config_proto_rawDescData)
|
file_app_log_command_config_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_app_log_command_config_proto_rawDesc), len(file_app_log_command_config_proto_rawDesc)))
|
||||||
})
|
})
|
||||||
return file_app_log_command_config_proto_rawDescData
|
return file_app_log_command_config_proto_rawDescData
|
||||||
}
|
}
|
||||||
@@ -192,7 +178,7 @@ func file_app_log_command_config_proto_init() {
|
|||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_app_log_command_config_proto_rawDesc,
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_app_log_command_config_proto_rawDesc), len(file_app_log_command_config_proto_rawDesc)),
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 3,
|
NumMessages: 3,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
@@ -203,7 +189,6 @@ func file_app_log_command_config_proto_init() {
|
|||||||
MessageInfos: file_app_log_command_config_proto_msgTypes,
|
MessageInfos: file_app_log_command_config_proto_msgTypes,
|
||||||
}.Build()
|
}.Build()
|
||||||
File_app_log_command_config_proto = out.File
|
File_app_log_command_config_proto = out.File
|
||||||
file_app_log_command_config_proto_rawDesc = nil
|
|
||||||
file_app_log_command_config_proto_goTypes = nil
|
file_app_log_command_config_proto_goTypes = nil
|
||||||
file_app_log_command_config_proto_depIdxs = nil
|
file_app_log_command_config_proto_depIdxs = nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// 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.6.0
|
||||||
// - protoc v5.28.2
|
// - protoc v6.33.5
|
||||||
// source: app/log/command/config.proto
|
// source: app/log/command/config.proto
|
||||||
|
|
||||||
package command
|
package command
|
||||||
@@ -63,7 +63,7 @@ type LoggerServiceServer interface {
|
|||||||
type UnimplementedLoggerServiceServer struct{}
|
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.Error(codes.Unimplemented, "method RestartLogger not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedLoggerServiceServer) mustEmbedUnimplementedLoggerServiceServer() {}
|
func (UnimplementedLoggerServiceServer) mustEmbedUnimplementedLoggerServiceServer() {}
|
||||||
func (UnimplementedLoggerServiceServer) testEmbeddedByValue() {}
|
func (UnimplementedLoggerServiceServer) testEmbeddedByValue() {}
|
||||||
@@ -76,7 +76,7 @@ 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
|
// If the following call panics, it indicates UnimplementedLoggerServiceServer was
|
||||||
// embedded by pointer and is nil. This will cause panics if an
|
// embedded by pointer and is nil. This will cause panics if an
|
||||||
// unimplemented method is ever invoked, so we test this at initialization
|
// unimplemented method is ever invoked, so we test this at initialization
|
||||||
// time to prevent it from happening at runtime later due to I/O.
|
// time to prevent it from happening at runtime later due to I/O.
|
||||||
|
|||||||
+32
-53
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.35.1
|
// protoc-gen-go v1.36.11
|
||||||
// protoc v5.28.2
|
// protoc v6.33.5
|
||||||
// source: app/log/config.proto
|
// source: app/log/config.proto
|
||||||
|
|
||||||
package log
|
package log
|
||||||
@@ -12,6 +12,7 @@ import (
|
|||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
sync "sync"
|
sync "sync"
|
||||||
|
unsafe "unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -74,17 +75,16 @@ func (LogType) EnumDescriptor() ([]byte, []int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
ErrorLogType LogType `protobuf:"varint,1,opt,name=error_log_type,json=errorLogType,proto3,enum=xray.app.log.LogType" json:"error_log_type,omitempty"`
|
||||||
|
ErrorLogLevel log.Severity `protobuf:"varint,2,opt,name=error_log_level,json=errorLogLevel,proto3,enum=xray.common.log.Severity" json:"error_log_level,omitempty"`
|
||||||
|
ErrorLogPath string `protobuf:"bytes,3,opt,name=error_log_path,json=errorLogPath,proto3" json:"error_log_path,omitempty"`
|
||||||
|
AccessLogType LogType `protobuf:"varint,4,opt,name=access_log_type,json=accessLogType,proto3,enum=xray.app.log.LogType" json:"access_log_type,omitempty"`
|
||||||
|
AccessLogPath string `protobuf:"bytes,5,opt,name=access_log_path,json=accessLogPath,proto3" json:"access_log_path,omitempty"`
|
||||||
|
EnableDnsLog bool `protobuf:"varint,6,opt,name=enable_dns_log,json=enableDnsLog,proto3" json:"enable_dns_log,omitempty"`
|
||||||
|
MaskAddress string `protobuf:"bytes,7,opt,name=mask_address,json=maskAddress,proto3" json:"mask_address,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
ErrorLogType LogType `protobuf:"varint,1,opt,name=error_log_type,json=errorLogType,proto3,enum=xray.app.log.LogType" json:"error_log_type,omitempty"`
|
|
||||||
ErrorLogLevel log.Severity `protobuf:"varint,2,opt,name=error_log_level,json=errorLogLevel,proto3,enum=xray.common.log.Severity" json:"error_log_level,omitempty"`
|
|
||||||
ErrorLogPath string `protobuf:"bytes,3,opt,name=error_log_path,json=errorLogPath,proto3" json:"error_log_path,omitempty"`
|
|
||||||
AccessLogType LogType `protobuf:"varint,4,opt,name=access_log_type,json=accessLogType,proto3,enum=xray.app.log.LogType" json:"access_log_type,omitempty"`
|
|
||||||
AccessLogPath string `protobuf:"bytes,5,opt,name=access_log_path,json=accessLogPath,proto3" json:"access_log_path,omitempty"`
|
|
||||||
EnableDnsLog bool `protobuf:"varint,6,opt,name=enable_dns_log,json=enableDnsLog,proto3" json:"enable_dns_log,omitempty"`
|
|
||||||
MaskAddress string `protobuf:"bytes,7,opt,name=mask_address,json=maskAddress,proto3" json:"mask_address,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Config) Reset() {
|
func (x *Config) Reset() {
|
||||||
@@ -168,52 +168,32 @@ func (x *Config) GetMaskAddress() string {
|
|||||||
|
|
||||||
var File_app_log_config_proto protoreflect.FileDescriptor
|
var File_app_log_config_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_app_log_config_proto_rawDesc = []byte{
|
const file_app_log_config_proto_rawDesc = "" +
|
||||||
0x0a, 0x14, 0x61, 0x70, 0x70, 0x2f, 0x6c, 0x6f, 0x67, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67,
|
"\n" +
|
||||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70,
|
"\x14app/log/config.proto\x12\fxray.app.log\x1a\x14common/log/log.proto\"\xde\x02\n" +
|
||||||
0x2e, 0x6c, 0x6f, 0x67, 0x1a, 0x14, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x6c, 0x6f, 0x67,
|
"\x06Config\x12;\n" +
|
||||||
0x2f, 0x6c, 0x6f, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xde, 0x02, 0x0a, 0x06, 0x43,
|
"\x0eerror_log_type\x18\x01 \x01(\x0e2\x15.xray.app.log.LogTypeR\ferrorLogType\x12A\n" +
|
||||||
0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x3b, 0x0a, 0x0e, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6c,
|
"\x0ferror_log_level\x18\x02 \x01(\x0e2\x19.xray.common.log.SeverityR\rerrorLogLevel\x12$\n" +
|
||||||
0x6f, 0x67, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e,
|
"\x0eerror_log_path\x18\x03 \x01(\tR\ferrorLogPath\x12=\n" +
|
||||||
0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x6c, 0x6f, 0x67, 0x2e, 0x4c, 0x6f, 0x67,
|
"\x0faccess_log_type\x18\x04 \x01(\x0e2\x15.xray.app.log.LogTypeR\raccessLogType\x12&\n" +
|
||||||
0x54, 0x79, 0x70, 0x65, 0x52, 0x0c, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4c, 0x6f, 0x67, 0x54, 0x79,
|
"\x0faccess_log_path\x18\x05 \x01(\tR\raccessLogPath\x12$\n" +
|
||||||
0x70, 0x65, 0x12, 0x41, 0x0a, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6c, 0x6f, 0x67, 0x5f,
|
"\x0eenable_dns_log\x18\x06 \x01(\bR\fenableDnsLog\x12!\n" +
|
||||||
0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x78, 0x72,
|
"\fmask_address\x18\a \x01(\tR\vmaskAddress*5\n" +
|
||||||
0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6c, 0x6f, 0x67, 0x2e, 0x53, 0x65,
|
"\aLogType\x12\b\n" +
|
||||||
0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x52, 0x0d, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4c, 0x6f, 0x67,
|
"\x04None\x10\x00\x12\v\n" +
|
||||||
0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x24, 0x0a, 0x0e, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6c,
|
"\aConsole\x10\x01\x12\b\n" +
|
||||||
0x6f, 0x67, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x65,
|
"\x04File\x10\x02\x12\t\n" +
|
||||||
0x72, 0x72, 0x6f, 0x72, 0x4c, 0x6f, 0x67, 0x50, 0x61, 0x74, 0x68, 0x12, 0x3d, 0x0a, 0x0f, 0x61,
|
"\x05Event\x10\x03BF\n" +
|
||||||
0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x6c, 0x6f, 0x67, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04,
|
"\x10com.xray.app.logP\x01Z!github.com/xtls/xray-core/app/log\xaa\x02\fXray.App.Logb\x06proto3"
|
||||||
0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e,
|
|
||||||
0x6c, 0x6f, 0x67, 0x2e, 0x4c, 0x6f, 0x67, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0d, 0x61, 0x63, 0x63,
|
|
||||||
0x65, 0x73, 0x73, 0x4c, 0x6f, 0x67, 0x54, 0x79, 0x70, 0x65, 0x12, 0x26, 0x0a, 0x0f, 0x61, 0x63,
|
|
||||||
0x63, 0x65, 0x73, 0x73, 0x5f, 0x6c, 0x6f, 0x67, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x05, 0x20,
|
|
||||||
0x01, 0x28, 0x09, 0x52, 0x0d, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4c, 0x6f, 0x67, 0x50, 0x61,
|
|
||||||
0x74, 0x68, 0x12, 0x24, 0x0a, 0x0e, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x64, 0x6e, 0x73,
|
|
||||||
0x5f, 0x6c, 0x6f, 0x67, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x65, 0x6e, 0x61, 0x62,
|
|
||||||
0x6c, 0x65, 0x44, 0x6e, 0x73, 0x4c, 0x6f, 0x67, 0x12, 0x21, 0x0a, 0x0c, 0x6d, 0x61, 0x73, 0x6b,
|
|
||||||
0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b,
|
|
||||||
0x6d, 0x61, 0x73, 0x6b, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2a, 0x35, 0x0a, 0x07, 0x4c,
|
|
||||||
0x6f, 0x67, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x6f, 0x6e, 0x65, 0x10, 0x00,
|
|
||||||
0x12, 0x0b, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x73, 0x6f, 0x6c, 0x65, 0x10, 0x01, 0x12, 0x08, 0x0a,
|
|
||||||
0x04, 0x46, 0x69, 0x6c, 0x65, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x76, 0x65, 0x6e, 0x74,
|
|
||||||
0x10, 0x03, 0x42, 0x46, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61,
|
|
||||||
0x70, 0x70, 0x2e, 0x6c, 0x6f, 0x67, 0x50, 0x01, 0x5a, 0x21, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62,
|
|
||||||
0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x74, 0x6c, 0x73, 0x2f, 0x78, 0x72, 0x61, 0x79, 0x2d, 0x63,
|
|
||||||
0x6f, 0x72, 0x65, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x6c, 0x6f, 0x67, 0xaa, 0x02, 0x0c, 0x58, 0x72,
|
|
||||||
0x61, 0x79, 0x2e, 0x41, 0x70, 0x70, 0x2e, 0x4c, 0x6f, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
|
|
||||||
0x6f, 0x33,
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
file_app_log_config_proto_rawDescOnce sync.Once
|
file_app_log_config_proto_rawDescOnce sync.Once
|
||||||
file_app_log_config_proto_rawDescData = file_app_log_config_proto_rawDesc
|
file_app_log_config_proto_rawDescData []byte
|
||||||
)
|
)
|
||||||
|
|
||||||
func file_app_log_config_proto_rawDescGZIP() []byte {
|
func file_app_log_config_proto_rawDescGZIP() []byte {
|
||||||
file_app_log_config_proto_rawDescOnce.Do(func() {
|
file_app_log_config_proto_rawDescOnce.Do(func() {
|
||||||
file_app_log_config_proto_rawDescData = protoimpl.X.CompressGZIP(file_app_log_config_proto_rawDescData)
|
file_app_log_config_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_app_log_config_proto_rawDesc), len(file_app_log_config_proto_rawDesc)))
|
||||||
})
|
})
|
||||||
return file_app_log_config_proto_rawDescData
|
return file_app_log_config_proto_rawDescData
|
||||||
}
|
}
|
||||||
@@ -245,7 +225,7 @@ func file_app_log_config_proto_init() {
|
|||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_app_log_config_proto_rawDesc,
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_app_log_config_proto_rawDesc), len(file_app_log_config_proto_rawDesc)),
|
||||||
NumEnums: 1,
|
NumEnums: 1,
|
||||||
NumMessages: 1,
|
NumMessages: 1,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
@@ -257,7 +237,6 @@ func file_app_log_config_proto_init() {
|
|||||||
MessageInfos: file_app_log_config_proto_msgTypes,
|
MessageInfos: file_app_log_config_proto_msgTypes,
|
||||||
}.Build()
|
}.Build()
|
||||||
File_app_log_config_proto = out.File
|
File_app_log_config_proto = out.File
|
||||||
file_app_log_config_proto_rawDesc = nil
|
|
||||||
file_app_log_config_proto_goTypes = nil
|
file_app_log_config_proto_goTypes = nil
|
||||||
file_app_log_config_proto_depIdxs = nil
|
file_app_log_config_proto_depIdxs = nil
|
||||||
}
|
}
|
||||||
|
|||||||
+83
-33
@@ -2,8 +2,9 @@ package log
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"net"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
@@ -20,14 +21,23 @@ type Instance struct {
|
|||||||
errorLogger log.Handler
|
errorLogger log.Handler
|
||||||
active bool
|
active bool
|
||||||
dns bool
|
dns bool
|
||||||
|
mask4 int
|
||||||
|
mask6 int
|
||||||
}
|
}
|
||||||
|
|
||||||
// New creates a new log.Instance based on the given config.
|
// New creates a new log.Instance based on the given config.
|
||||||
func New(ctx context.Context, config *Config) (*Instance, error) {
|
func New(ctx context.Context, config *Config) (*Instance, error) {
|
||||||
|
m4, m6, err := ParseMaskAddress(config.MaskAddress)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
g := &Instance{
|
g := &Instance{
|
||||||
config: config,
|
config: config,
|
||||||
active: false,
|
active: false,
|
||||||
dns: config.EnableDnsLog,
|
dns: config.EnableDnsLog,
|
||||||
|
mask4: m4,
|
||||||
|
mask6: m6,
|
||||||
}
|
}
|
||||||
log.RegisterHandler(g)
|
log.RegisterHandler(g)
|
||||||
|
|
||||||
@@ -104,7 +114,11 @@ func (g *Instance) Handle(msg log.Message) {
|
|||||||
|
|
||||||
var Msg log.Message
|
var Msg log.Message
|
||||||
if g.config.MaskAddress != "" {
|
if g.config.MaskAddress != "" {
|
||||||
Msg = &MaskedMsgWrapper{Message: msg, config: g.config}
|
Msg = &MaskedMsgWrapper{
|
||||||
|
Message: msg,
|
||||||
|
Mask4: g.mask4,
|
||||||
|
Mask6: g.mask6,
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Msg = msg
|
Msg = msg
|
||||||
}
|
}
|
||||||
@@ -149,51 +163,87 @@ func (g *Instance) Close() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ParseMaskAddress(c string) (int, int, error) {
|
||||||
|
var m4, m6 int
|
||||||
|
switch c {
|
||||||
|
case "half":
|
||||||
|
m4, m6 = 16, 32
|
||||||
|
case "quarter":
|
||||||
|
m4, m6 = 8, 16
|
||||||
|
case "full":
|
||||||
|
m4, m6 = 0, 0
|
||||||
|
case "":
|
||||||
|
// do nothing
|
||||||
|
default:
|
||||||
|
if parts := strings.Split(c, "+"); len(parts) > 0 {
|
||||||
|
if len(parts) >= 1 && parts[0] != "" {
|
||||||
|
i, err := strconv.Atoi(strings.TrimPrefix(parts[0], "/"))
|
||||||
|
if err != nil {
|
||||||
|
return 32, 128, err
|
||||||
|
}
|
||||||
|
m4 = i
|
||||||
|
}
|
||||||
|
if len(parts) >= 2 && parts[1] != "" {
|
||||||
|
i, err := strconv.Atoi(strings.TrimPrefix(parts[1], "/"))
|
||||||
|
if err != nil {
|
||||||
|
return 32, 128, err
|
||||||
|
}
|
||||||
|
m6 = i
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if m4%8 != 0 || m4 > 32 || m4 < 0 {
|
||||||
|
return 32, 128, errors.New("Log Mask: ipv4 mask must be divisible by 8 and between 0-32")
|
||||||
|
}
|
||||||
|
|
||||||
|
return m4, m6, nil
|
||||||
|
}
|
||||||
|
|
||||||
// MaskedMsgWrapper is to wrap the string() method to mask IP addresses in the log.
|
// MaskedMsgWrapper is to wrap the string() method to mask IP addresses in the log.
|
||||||
type MaskedMsgWrapper struct {
|
type MaskedMsgWrapper struct {
|
||||||
log.Message
|
log.Message
|
||||||
config *Config
|
Mask4 int
|
||||||
|
Mask6 int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
ipv4Regex = regexp.MustCompile(`(\d{1,3}\.){3}\d{1,3}`)
|
||||||
|
ipv6Regex = regexp.MustCompile(`(?:[\da-fA-F]{0,4}:[\da-fA-F]{0,4}){2,7}`)
|
||||||
|
)
|
||||||
|
|
||||||
func (m *MaskedMsgWrapper) String() string {
|
func (m *MaskedMsgWrapper) String() string {
|
||||||
str := m.Message.String()
|
str := m.Message.String()
|
||||||
|
|
||||||
ipv4Regex := regexp.MustCompile(`(\d{1,3}\.){3}\d{1,3}`)
|
|
||||||
ipv6Regex := regexp.MustCompile(`((?:[\da-fA-F]{0,4}:[\da-fA-F]{0,4}){2,7})(?:[\/\\%](\d{1,3}))?`)
|
|
||||||
|
|
||||||
// Process ipv4
|
// Process ipv4
|
||||||
maskedMsg := ipv4Regex.ReplaceAllStringFunc(str, func(ip string) string {
|
maskedMsg := ipv4Regex.ReplaceAllStringFunc(str, func(s string) string {
|
||||||
parts := strings.Split(ip, ".")
|
if m.Mask4 == 32 {
|
||||||
switch m.config.MaskAddress {
|
return s
|
||||||
case "half":
|
|
||||||
return fmt.Sprintf("%s.%s.*.*", parts[0], parts[1])
|
|
||||||
case "quarter":
|
|
||||||
return fmt.Sprintf("%s.*.*.*", parts[0])
|
|
||||||
case "full":
|
|
||||||
return "[Masked IPv4]"
|
|
||||||
default:
|
|
||||||
return ip
|
|
||||||
}
|
}
|
||||||
|
if m.Mask4 == 0 {
|
||||||
|
return "[Masked IPv4]"
|
||||||
|
}
|
||||||
|
|
||||||
|
parts := strings.Split(s, ".")
|
||||||
|
for i := m.Mask4 / 8; i < 4; i++ {
|
||||||
|
parts[i] = "*"
|
||||||
|
}
|
||||||
|
return strings.Join(parts, ".")
|
||||||
})
|
})
|
||||||
|
|
||||||
// process ipv6
|
// process ipv6
|
||||||
maskedMsg = ipv6Regex.ReplaceAllStringFunc(maskedMsg, func(ip string) string {
|
maskedMsg = ipv6Regex.ReplaceAllStringFunc(maskedMsg, func(s string) string {
|
||||||
parts := strings.Split(ip, ":")
|
if m.Mask6 == 128 {
|
||||||
switch m.config.MaskAddress {
|
return s
|
||||||
case "half":
|
|
||||||
if len(parts) >= 2 {
|
|
||||||
return fmt.Sprintf("%s:%s::/32", parts[0], parts[1])
|
|
||||||
}
|
|
||||||
case "quarter":
|
|
||||||
if len(parts) >= 1 {
|
|
||||||
return fmt.Sprintf("%s::/16", parts[0])
|
|
||||||
}
|
|
||||||
case "full":
|
|
||||||
return "Masked IPv6" // Do not use [Masked IPv6] like ipv4, or you will get "[[Masked IPv6]]" (v6 address already has [])
|
|
||||||
default:
|
|
||||||
return ip
|
|
||||||
}
|
}
|
||||||
return ip
|
if m.Mask6 == 0 {
|
||||||
|
return "Masked IPv6"
|
||||||
|
}
|
||||||
|
ip := net.ParseIP(s)
|
||||||
|
if ip == nil {
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
return ip.Mask(net.CIDRMask(m.Mask6, 128)).String() + "/" + strconv.Itoa(m.Mask6)
|
||||||
})
|
})
|
||||||
|
|
||||||
return maskedMsg
|
return maskedMsg
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package log_test
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"net"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/golang/mock/gomock"
|
"github.com/golang/mock/gomock"
|
||||||
@@ -50,3 +51,39 @@ func TestCustomLogHandler(t *testing.T) {
|
|||||||
|
|
||||||
common.Must(logger.Close())
|
common.Must(logger.Close())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestMaskAddress(t *testing.T) {
|
||||||
|
m4, m6, err := log.ParseMaskAddress("half")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
maskedAddr := log.MaskedMsgWrapper{
|
||||||
|
Mask4: m4,
|
||||||
|
Mask6: m6,
|
||||||
|
}
|
||||||
|
maskedAddr.Message = net.ParseIP("11.45.1.4")
|
||||||
|
if maskedAddr.String() != "11.45.*.*" {
|
||||||
|
t.Fatal("expected '11.45.*.*', but actually ", maskedAddr.String())
|
||||||
|
}
|
||||||
|
maskedAddr.Message = net.ParseIP("11:45:14:19:19:81:0::")
|
||||||
|
if maskedAddr.String() != "11:45::/32" {
|
||||||
|
t.Fatal("expected '11:45::/32', but actually", maskedAddr.String())
|
||||||
|
}
|
||||||
|
|
||||||
|
m4, m6, err = log.ParseMaskAddress("/16+/64")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
maskedAddr = log.MaskedMsgWrapper{
|
||||||
|
Mask4: m4,
|
||||||
|
Mask6: m6,
|
||||||
|
}
|
||||||
|
maskedAddr.Message = net.ParseIP("11.45.1.4")
|
||||||
|
if maskedAddr.String() != "11.45.*.*" {
|
||||||
|
t.Fatal("expected '11.45.*.*', but actually ", maskedAddr.String())
|
||||||
|
}
|
||||||
|
maskedAddr.Message = net.ParseIP("11:45:14:19:19:81:0::")
|
||||||
|
if maskedAddr.String() != "11:45:14:19::/64" {
|
||||||
|
t.Fatal("expected '11:45:14:19::/64', but actually", maskedAddr.String())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
+18
-26
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.35.1
|
// protoc-gen-go v1.36.11
|
||||||
// protoc v5.28.2
|
// protoc v6.33.5
|
||||||
// source: app/metrics/config.proto
|
// source: app/metrics/config.proto
|
||||||
|
|
||||||
package metrics
|
package metrics
|
||||||
@@ -11,6 +11,7 @@ import (
|
|||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
sync "sync"
|
sync "sync"
|
||||||
|
unsafe "unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -22,13 +23,12 @@ const (
|
|||||||
|
|
||||||
// Config is the settings for metrics.
|
// Config is the settings for metrics.
|
||||||
type Config struct {
|
type Config struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
// Tag of the outbound handler that handles metrics http connections.
|
// Tag of the outbound handler that handles metrics http connections.
|
||||||
Tag string `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"`
|
Tag string `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"`
|
||||||
Listen string `protobuf:"bytes,2,opt,name=listen,proto3" json:"listen,omitempty"`
|
Listen string `protobuf:"bytes,2,opt,name=listen,proto3" json:"listen,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Config) Reset() {
|
func (x *Config) Reset() {
|
||||||
@@ -77,29 +77,22 @@ func (x *Config) GetListen() string {
|
|||||||
|
|
||||||
var File_app_metrics_config_proto protoreflect.FileDescriptor
|
var File_app_metrics_config_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_app_metrics_config_proto_rawDesc = []byte{
|
const file_app_metrics_config_proto_rawDesc = "" +
|
||||||
0x0a, 0x18, 0x61, 0x70, 0x70, 0x2f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x2f, 0x63, 0x6f,
|
"\n" +
|
||||||
0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x78, 0x72, 0x61, 0x79,
|
"\x18app/metrics/config.proto\x12\x10xray.app.metrics\"2\n" +
|
||||||
0x2e, 0x61, 0x70, 0x70, 0x2e, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x22, 0x32, 0x0a, 0x06,
|
"\x06Config\x12\x10\n" +
|
||||||
0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18, 0x01, 0x20,
|
"\x03tag\x18\x01 \x01(\tR\x03tag\x12\x16\n" +
|
||||||
0x01, 0x28, 0x09, 0x52, 0x03, 0x74, 0x61, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x69, 0x73, 0x74,
|
"\x06listen\x18\x02 \x01(\tR\x06listenBR\n" +
|
||||||
0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6c, 0x69, 0x73, 0x74, 0x65, 0x6e,
|
"\x14com.xray.app.metricsP\x01Z%github.com/xtls/xray-core/app/metrics\xaa\x02\x10Xray.App.Metricsb\x06proto3"
|
||||||
0x42, 0x52, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70,
|
|
||||||
0x2e, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x50, 0x01, 0x5a, 0x25, 0x67, 0x69, 0x74, 0x68,
|
|
||||||
0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x74, 0x6c, 0x73, 0x2f, 0x78, 0x72, 0x61, 0x79,
|
|
||||||
0x2d, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63,
|
|
||||||
0x73, 0xaa, 0x02, 0x10, 0x58, 0x72, 0x61, 0x79, 0x2e, 0x41, 0x70, 0x70, 0x2e, 0x4d, 0x65, 0x74,
|
|
||||||
0x72, 0x69, 0x63, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
file_app_metrics_config_proto_rawDescOnce sync.Once
|
file_app_metrics_config_proto_rawDescOnce sync.Once
|
||||||
file_app_metrics_config_proto_rawDescData = file_app_metrics_config_proto_rawDesc
|
file_app_metrics_config_proto_rawDescData []byte
|
||||||
)
|
)
|
||||||
|
|
||||||
func file_app_metrics_config_proto_rawDescGZIP() []byte {
|
func file_app_metrics_config_proto_rawDescGZIP() []byte {
|
||||||
file_app_metrics_config_proto_rawDescOnce.Do(func() {
|
file_app_metrics_config_proto_rawDescOnce.Do(func() {
|
||||||
file_app_metrics_config_proto_rawDescData = protoimpl.X.CompressGZIP(file_app_metrics_config_proto_rawDescData)
|
file_app_metrics_config_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_app_metrics_config_proto_rawDesc), len(file_app_metrics_config_proto_rawDesc)))
|
||||||
})
|
})
|
||||||
return file_app_metrics_config_proto_rawDescData
|
return file_app_metrics_config_proto_rawDescData
|
||||||
}
|
}
|
||||||
@@ -125,7 +118,7 @@ func file_app_metrics_config_proto_init() {
|
|||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_app_metrics_config_proto_rawDesc,
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_app_metrics_config_proto_rawDesc), len(file_app_metrics_config_proto_rawDesc)),
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 1,
|
NumMessages: 1,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
@@ -136,7 +129,6 @@ func file_app_metrics_config_proto_init() {
|
|||||||
MessageInfos: file_app_metrics_config_proto_msgTypes,
|
MessageInfos: file_app_metrics_config_proto_msgTypes,
|
||||||
}.Build()
|
}.Build()
|
||||||
File_app_metrics_config_proto = out.File
|
File_app_metrics_config_proto = out.File
|
||||||
file_app_metrics_config_proto_rawDesc = nil
|
|
||||||
file_app_metrics_config_proto_goTypes = nil
|
file_app_metrics_config_proto_goTypes = nil
|
||||||
file_app_metrics_config_proto_depIdxs = nil
|
file_app_metrics_config_proto_depIdxs = nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,10 @@ func (o *Observer) GetObservation(ctx context.Context) (proto.Message, error) {
|
|||||||
return &observatory.ObservationResult{Status: o.createResult()}, nil
|
return &observatory.ObservationResult{Status: o.createResult()}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (o *Observer) Check(tag []string) {
|
||||||
|
o.hp.Check(tag)
|
||||||
|
}
|
||||||
|
|
||||||
func (o *Observer) createResult() []*observatory.OutboundStatus {
|
func (o *Observer) createResult() []*observatory.OutboundStatus {
|
||||||
var result []*observatory.OutboundStatus
|
var result []*observatory.OutboundStatus
|
||||||
o.hp.access.Lock()
|
o.hp.access.Lock()
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.35.1
|
// protoc-gen-go v1.36.11
|
||||||
// protoc v5.28.2
|
// protoc v6.33.5
|
||||||
// source: app/observatory/burst/config.proto
|
// source: app/observatory/burst/config.proto
|
||||||
|
|
||||||
package burst
|
package burst
|
||||||
@@ -11,6 +11,7 @@ import (
|
|||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
sync "sync"
|
sync "sync"
|
||||||
|
unsafe "unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -21,13 +22,12 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
// @Document The selectors for outbound under observation
|
// @Document The selectors for outbound under observation
|
||||||
SubjectSelector []string `protobuf:"bytes,2,rep,name=subject_selector,json=subjectSelector,proto3" json:"subject_selector,omitempty"`
|
SubjectSelector []string `protobuf:"bytes,2,rep,name=subject_selector,json=subjectSelector,proto3" json:"subject_selector,omitempty"`
|
||||||
PingConfig *HealthPingConfig `protobuf:"bytes,3,opt,name=ping_config,json=pingConfig,proto3" json:"ping_config,omitempty"`
|
PingConfig *HealthPingConfig `protobuf:"bytes,3,opt,name=ping_config,json=pingConfig,proto3" json:"ping_config,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Config) Reset() {
|
func (x *Config) Reset() {
|
||||||
@@ -75,10 +75,7 @@ func (x *Config) GetPingConfig() *HealthPingConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type HealthPingConfig struct {
|
type HealthPingConfig struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
// destination url, need 204 for success return
|
// destination url, need 204 for success return
|
||||||
// default https://connectivitycheck.gstatic.com/generate_204
|
// default https://connectivitycheck.gstatic.com/generate_204
|
||||||
Destination string `protobuf:"bytes,1,opt,name=destination,proto3" json:"destination,omitempty"`
|
Destination string `protobuf:"bytes,1,opt,name=destination,proto3" json:"destination,omitempty"`
|
||||||
@@ -91,7 +88,9 @@ type HealthPingConfig struct {
|
|||||||
// ping timeout, int64 values of time.Duration
|
// ping timeout, int64 values of time.Duration
|
||||||
Timeout int64 `protobuf:"varint,5,opt,name=timeout,proto3" json:"timeout,omitempty"`
|
Timeout int64 `protobuf:"varint,5,opt,name=timeout,proto3" json:"timeout,omitempty"`
|
||||||
// http method to make request
|
// http method to make request
|
||||||
HttpMethod string `protobuf:"bytes,6,opt,name=httpMethod,proto3" json:"httpMethod,omitempty"`
|
HttpMethod string `protobuf:"bytes,6,opt,name=httpMethod,proto3" json:"httpMethod,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *HealthPingConfig) Reset() {
|
func (x *HealthPingConfig) Reset() {
|
||||||
@@ -168,51 +167,32 @@ func (x *HealthPingConfig) GetHttpMethod() string {
|
|||||||
|
|
||||||
var File_app_observatory_burst_config_proto protoreflect.FileDescriptor
|
var File_app_observatory_burst_config_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_app_observatory_burst_config_proto_rawDesc = []byte{
|
const file_app_observatory_burst_config_proto_rawDesc = "" +
|
||||||
0x0a, 0x22, 0x61, 0x70, 0x70, 0x2f, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x6f, 0x72,
|
"\n" +
|
||||||
0x79, 0x2f, 0x62, 0x75, 0x72, 0x73, 0x74, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70,
|
"\"app/observatory/burst/config.proto\x12\x1fxray.core.app.observatory.burst\"\x87\x01\n" +
|
||||||
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1f, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e,
|
"\x06Config\x12)\n" +
|
||||||
0x61, 0x70, 0x70, 0x2e, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x6f, 0x72, 0x79, 0x2e,
|
"\x10subject_selector\x18\x02 \x03(\tR\x0fsubjectSelector\x12R\n" +
|
||||||
0x62, 0x75, 0x72, 0x73, 0x74, 0x22, 0x87, 0x01, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67,
|
"\vping_config\x18\x03 \x01(\v21.xray.core.app.observatory.burst.HealthPingConfigR\n" +
|
||||||
0x12, 0x29, 0x0a, 0x10, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x73, 0x65, 0x6c, 0x65,
|
"pingConfig\"\xd4\x01\n" +
|
||||||
0x63, 0x74, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x73, 0x75, 0x62, 0x6a,
|
"\x10HealthPingConfig\x12 \n" +
|
||||||
0x65, 0x63, 0x74, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x12, 0x52, 0x0a, 0x0b, 0x70,
|
"\vdestination\x18\x01 \x01(\tR\vdestination\x12\"\n" +
|
||||||
0x69, 0x6e, 0x67, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b,
|
"\fconnectivity\x18\x02 \x01(\tR\fconnectivity\x12\x1a\n" +
|
||||||
0x32, 0x31, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x61, 0x70, 0x70,
|
"\binterval\x18\x03 \x01(\x03R\binterval\x12$\n" +
|
||||||
0x2e, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x62, 0x75, 0x72,
|
"\rsamplingCount\x18\x04 \x01(\x05R\rsamplingCount\x12\x18\n" +
|
||||||
0x73, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x50, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6e,
|
"\atimeout\x18\x05 \x01(\x03R\atimeout\x12\x1e\n" +
|
||||||
0x66, 0x69, 0x67, 0x52, 0x0a, 0x70, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x22,
|
"\n" +
|
||||||
0xd4, 0x01, 0x0a, 0x10, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x50, 0x69, 0x6e, 0x67, 0x43, 0x6f,
|
"httpMethod\x18\x06 \x01(\tR\n" +
|
||||||
0x6e, 0x66, 0x69, 0x67, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74,
|
"httpMethodBp\n" +
|
||||||
0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x74, 0x69,
|
"\x1ecom.xray.app.observatory.burstP\x01Z/github.com/xtls/xray-core/app/observatory/burst\xaa\x02\x1aXray.App.Observatory.Burstb\x06proto3"
|
||||||
0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63,
|
|
||||||
0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f,
|
|
||||||
0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e,
|
|
||||||
0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x69, 0x6e,
|
|
||||||
0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x12, 0x24, 0x0a, 0x0d, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x69,
|
|
||||||
0x6e, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x73,
|
|
||||||
0x61, 0x6d, 0x70, 0x6c, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07,
|
|
||||||
0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x74,
|
|
||||||
0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x68, 0x74, 0x74, 0x70, 0x4d, 0x65,
|
|
||||||
0x74, 0x68, 0x6f, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x68, 0x74, 0x74, 0x70,
|
|
||||||
0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x42, 0x70, 0x0a, 0x1e, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72,
|
|
||||||
0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x6f,
|
|
||||||
0x72, 0x79, 0x2e, 0x62, 0x75, 0x72, 0x73, 0x74, 0x50, 0x01, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68,
|
|
||||||
0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x74, 0x6c, 0x73, 0x2f, 0x78, 0x72, 0x61, 0x79,
|
|
||||||
0x2d, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76,
|
|
||||||
0x61, 0x74, 0x6f, 0x72, 0x79, 0x2f, 0x62, 0x75, 0x72, 0x73, 0x74, 0xaa, 0x02, 0x1a, 0x58, 0x72,
|
|
||||||
0x61, 0x79, 0x2e, 0x41, 0x70, 0x70, 0x2e, 0x4f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x6f,
|
|
||||||
0x72, 0x79, 0x2e, 0x42, 0x75, 0x72, 0x73, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
file_app_observatory_burst_config_proto_rawDescOnce sync.Once
|
file_app_observatory_burst_config_proto_rawDescOnce sync.Once
|
||||||
file_app_observatory_burst_config_proto_rawDescData = file_app_observatory_burst_config_proto_rawDesc
|
file_app_observatory_burst_config_proto_rawDescData []byte
|
||||||
)
|
)
|
||||||
|
|
||||||
func file_app_observatory_burst_config_proto_rawDescGZIP() []byte {
|
func file_app_observatory_burst_config_proto_rawDescGZIP() []byte {
|
||||||
file_app_observatory_burst_config_proto_rawDescOnce.Do(func() {
|
file_app_observatory_burst_config_proto_rawDescOnce.Do(func() {
|
||||||
file_app_observatory_burst_config_proto_rawDescData = protoimpl.X.CompressGZIP(file_app_observatory_burst_config_proto_rawDescData)
|
file_app_observatory_burst_config_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_app_observatory_burst_config_proto_rawDesc), len(file_app_observatory_burst_config_proto_rawDesc)))
|
||||||
})
|
})
|
||||||
return file_app_observatory_burst_config_proto_rawDescData
|
return file_app_observatory_burst_config_proto_rawDescData
|
||||||
}
|
}
|
||||||
@@ -240,7 +220,7 @@ func file_app_observatory_burst_config_proto_init() {
|
|||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_app_observatory_burst_config_proto_rawDesc,
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_app_observatory_burst_config_proto_rawDesc), len(file_app_observatory_burst_config_proto_rawDesc)),
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 2,
|
NumMessages: 2,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
@@ -251,7 +231,6 @@ func file_app_observatory_burst_config_proto_init() {
|
|||||||
MessageInfos: file_app_observatory_burst_config_proto_msgTypes,
|
MessageInfos: file_app_observatory_burst_config_proto_msgTypes,
|
||||||
}.Build()
|
}.Build()
|
||||||
File_app_observatory_burst_config_proto = out.File
|
File_app_observatory_burst_config_proto = out.File
|
||||||
file_app_observatory_burst_config_proto_rawDesc = nil
|
|
||||||
file_app_observatory_burst_config_proto_goTypes = nil
|
file_app_observatory_burst_config_proto_goTypes = nil
|
||||||
file_app_observatory_burst_config_proto_depIdxs = nil
|
file_app_observatory_burst_config_proto_depIdxs = nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/xtls/xray-core/common/net"
|
"github.com/xtls/xray-core/common/net"
|
||||||
|
"github.com/xtls/xray-core/common/utils"
|
||||||
"github.com/xtls/xray-core/features/routing"
|
"github.com/xtls/xray-core/features/routing"
|
||||||
"github.com/xtls/xray-core/transport/internet/tagged"
|
"github.com/xtls/xray-core/transport/internet/tagged"
|
||||||
)
|
)
|
||||||
@@ -61,6 +62,7 @@ func (s *pingClient) MeasureDelay(httpMethod string) (time.Duration, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return rttFailed, err
|
return rttFailed, err
|
||||||
}
|
}
|
||||||
|
utils.TryDefaultHeadersWith(req.Header, "nav")
|
||||||
|
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
resp, err := s.httpClient.Do(req)
|
resp, err := s.httpClient.Do(req)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.35.1
|
// protoc-gen-go v1.36.11
|
||||||
// protoc v5.28.2
|
// protoc v6.33.5
|
||||||
// source: app/observatory/command/command.proto
|
// source: app/observatory/command/command.proto
|
||||||
|
|
||||||
package command
|
package command
|
||||||
@@ -12,6 +12,7 @@ import (
|
|||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
sync "sync"
|
sync "sync"
|
||||||
|
unsafe "unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -22,9 +23,9 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type GetOutboundStatusRequest struct {
|
type GetOutboundStatusRequest struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GetOutboundStatusRequest) Reset() {
|
func (x *GetOutboundStatusRequest) Reset() {
|
||||||
@@ -58,11 +59,10 @@ func (*GetOutboundStatusRequest) Descriptor() ([]byte, []int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type GetOutboundStatusResponse struct {
|
type GetOutboundStatusResponse struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Status *observatory.ObservationResult `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
Status *observatory.ObservationResult `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GetOutboundStatusResponse) Reset() {
|
func (x *GetOutboundStatusResponse) Reset() {
|
||||||
@@ -103,9 +103,9 @@ func (x *GetOutboundStatusResponse) GetStatus() *observatory.ObservationResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Config) Reset() {
|
func (x *Config) Reset() {
|
||||||
@@ -140,52 +140,25 @@ func (*Config) Descriptor() ([]byte, []int) {
|
|||||||
|
|
||||||
var File_app_observatory_command_command_proto protoreflect.FileDescriptor
|
var File_app_observatory_command_command_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_app_observatory_command_command_proto_rawDesc = []byte{
|
const file_app_observatory_command_command_proto_rawDesc = "" +
|
||||||
0x0a, 0x25, 0x61, 0x70, 0x70, 0x2f, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x6f, 0x72,
|
"\n" +
|
||||||
0x79, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e,
|
"%app/observatory/command/command.proto\x12!xray.core.app.observatory.command\x1a\x1capp/observatory/config.proto\"\x1a\n" +
|
||||||
0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x21, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f,
|
"\x18GetOutboundStatusRequest\"a\n" +
|
||||||
0x72, 0x65, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x6f,
|
"\x19GetOutboundStatusResponse\x12D\n" +
|
||||||
0x72, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x1a, 0x1c, 0x61, 0x70, 0x70, 0x2f,
|
"\x06status\x18\x01 \x01(\v2,.xray.core.app.observatory.ObservationResultR\x06status\"\b\n" +
|
||||||
0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x6f, 0x72, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66,
|
"\x06Config2\xa7\x01\n" +
|
||||||
0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x1a, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x4f,
|
"\x12ObservatoryService\x12\x90\x01\n" +
|
||||||
0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71,
|
"\x11GetOutboundStatus\x12;.xray.core.app.observatory.command.GetOutboundStatusRequest\x1a<.xray.core.app.observatory.command.GetOutboundStatusResponse\"\x00B\x80\x01\n" +
|
||||||
0x75, 0x65, 0x73, 0x74, 0x22, 0x61, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x4f, 0x75, 0x74, 0x62, 0x6f,
|
"%com.xray.core.app.observatory.commandP\x01Z1github.com/xtls/xray-core/app/observatory/command\xaa\x02!Xray.Core.App.Observatory.Commandb\x06proto3"
|
||||||
0x75, 0x6e, 0x64, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
|
||||||
0x65, 0x12, 0x44, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28,
|
|
||||||
0x0b, 0x32, 0x2c, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x61, 0x70,
|
|
||||||
0x70, 0x2e, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x4f, 0x62,
|
|
||||||
0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52,
|
|
||||||
0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x08, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, 0x69,
|
|
||||||
0x67, 0x32, 0xa7, 0x01, 0x0a, 0x12, 0x4f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x6f, 0x72,
|
|
||||||
0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x90, 0x01, 0x0a, 0x11, 0x47, 0x65, 0x74,
|
|
||||||
0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x3b,
|
|
||||||
0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x6f,
|
|
||||||
0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61,
|
|
||||||
0x6e, 0x64, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x53, 0x74,
|
|
||||||
0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3c, 0x2e, 0x78, 0x72,
|
|
||||||
0x61, 0x79, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x6f, 0x62, 0x73, 0x65,
|
|
||||||
0x72, 0x76, 0x61, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e,
|
|
||||||
0x47, 0x65, 0x74, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x53, 0x74, 0x61, 0x74, 0x75,
|
|
||||||
0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x80, 0x01, 0x0a, 0x25,
|
|
||||||
0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x61, 0x70,
|
|
||||||
0x70, 0x2e, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x63, 0x6f,
|
|
||||||
0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x50, 0x01, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e,
|
|
||||||
0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x74, 0x6c, 0x73, 0x2f, 0x78, 0x72, 0x61, 0x79, 0x2d, 0x63, 0x6f,
|
|
||||||
0x72, 0x65, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x6f,
|
|
||||||
0x72, 0x79, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0xaa, 0x02, 0x21, 0x58, 0x72, 0x61,
|
|
||||||
0x79, 0x2e, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x41, 0x70, 0x70, 0x2e, 0x4f, 0x62, 0x73, 0x65, 0x72,
|
|
||||||
0x76, 0x61, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x62, 0x06,
|
|
||||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
file_app_observatory_command_command_proto_rawDescOnce sync.Once
|
file_app_observatory_command_command_proto_rawDescOnce sync.Once
|
||||||
file_app_observatory_command_command_proto_rawDescData = file_app_observatory_command_command_proto_rawDesc
|
file_app_observatory_command_command_proto_rawDescData []byte
|
||||||
)
|
)
|
||||||
|
|
||||||
func file_app_observatory_command_command_proto_rawDescGZIP() []byte {
|
func file_app_observatory_command_command_proto_rawDescGZIP() []byte {
|
||||||
file_app_observatory_command_command_proto_rawDescOnce.Do(func() {
|
file_app_observatory_command_command_proto_rawDescOnce.Do(func() {
|
||||||
file_app_observatory_command_command_proto_rawDescData = protoimpl.X.CompressGZIP(file_app_observatory_command_command_proto_rawDescData)
|
file_app_observatory_command_command_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_app_observatory_command_command_proto_rawDesc), len(file_app_observatory_command_command_proto_rawDesc)))
|
||||||
})
|
})
|
||||||
return file_app_observatory_command_command_proto_rawDescData
|
return file_app_observatory_command_command_proto_rawDescData
|
||||||
}
|
}
|
||||||
@@ -217,7 +190,7 @@ func file_app_observatory_command_command_proto_init() {
|
|||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_app_observatory_command_command_proto_rawDesc,
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_app_observatory_command_command_proto_rawDesc), len(file_app_observatory_command_command_proto_rawDesc)),
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 3,
|
NumMessages: 3,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
@@ -228,7 +201,6 @@ func file_app_observatory_command_command_proto_init() {
|
|||||||
MessageInfos: file_app_observatory_command_command_proto_msgTypes,
|
MessageInfos: file_app_observatory_command_command_proto_msgTypes,
|
||||||
}.Build()
|
}.Build()
|
||||||
File_app_observatory_command_command_proto = out.File
|
File_app_observatory_command_command_proto = out.File
|
||||||
file_app_observatory_command_command_proto_rawDesc = nil
|
|
||||||
file_app_observatory_command_command_proto_goTypes = nil
|
file_app_observatory_command_command_proto_goTypes = nil
|
||||||
file_app_observatory_command_command_proto_depIdxs = nil
|
file_app_observatory_command_command_proto_depIdxs = nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// 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.6.0
|
||||||
// - protoc v5.28.2
|
// - protoc v6.33.5
|
||||||
// source: app/observatory/command/command.proto
|
// source: app/observatory/command/command.proto
|
||||||
|
|
||||||
package command
|
package command
|
||||||
@@ -63,7 +63,7 @@ type ObservatoryServiceServer interface {
|
|||||||
type UnimplementedObservatoryServiceServer struct{}
|
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.Error(codes.Unimplemented, "method GetOutboundStatus not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedObservatoryServiceServer) mustEmbedUnimplementedObservatoryServiceServer() {}
|
func (UnimplementedObservatoryServiceServer) mustEmbedUnimplementedObservatoryServiceServer() {}
|
||||||
func (UnimplementedObservatoryServiceServer) testEmbeddedByValue() {}
|
func (UnimplementedObservatoryServiceServer) testEmbeddedByValue() {}
|
||||||
@@ -76,7 +76,7 @@ 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
|
// If the following call panics, it indicates UnimplementedObservatoryServiceServer was
|
||||||
// embedded by pointer and is nil. This will cause panics if an
|
// embedded by pointer and is nil. This will cause panics if an
|
||||||
// unimplemented method is ever invoked, so we test this at initialization
|
// unimplemented method is ever invoked, so we test this at initialization
|
||||||
// time to prevent it from happening at runtime later due to I/O.
|
// time to prevent it from happening at runtime later due to I/O.
|
||||||
|
|||||||
+64
-104
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.35.1
|
// protoc-gen-go v1.36.11
|
||||||
// protoc v5.28.2
|
// protoc v6.33.5
|
||||||
// source: app/observatory/config.proto
|
// source: app/observatory/config.proto
|
||||||
|
|
||||||
package observatory
|
package observatory
|
||||||
@@ -11,6 +11,7 @@ import (
|
|||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
sync "sync"
|
sync "sync"
|
||||||
|
unsafe "unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -21,11 +22,10 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type ObservationResult struct {
|
type ObservationResult struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Status []*OutboundStatus `protobuf:"bytes,1,rep,name=status,proto3" json:"status,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
Status []*OutboundStatus `protobuf:"bytes,1,rep,name=status,proto3" json:"status,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ObservationResult) Reset() {
|
func (x *ObservationResult) Reset() {
|
||||||
@@ -66,16 +66,15 @@ func (x *ObservationResult) GetStatus() []*OutboundStatus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type HealthPingMeasurementResult struct {
|
type HealthPingMeasurementResult struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
All int64 `protobuf:"varint,1,opt,name=all,proto3" json:"all,omitempty"`
|
||||||
|
Fail int64 `protobuf:"varint,2,opt,name=fail,proto3" json:"fail,omitempty"`
|
||||||
|
Deviation int64 `protobuf:"varint,3,opt,name=deviation,proto3" json:"deviation,omitempty"`
|
||||||
|
Average int64 `protobuf:"varint,4,opt,name=average,proto3" json:"average,omitempty"`
|
||||||
|
Max int64 `protobuf:"varint,5,opt,name=max,proto3" json:"max,omitempty"`
|
||||||
|
Min int64 `protobuf:"varint,6,opt,name=min,proto3" json:"min,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
All int64 `protobuf:"varint,1,opt,name=all,proto3" json:"all,omitempty"`
|
|
||||||
Fail int64 `protobuf:"varint,2,opt,name=fail,proto3" json:"fail,omitempty"`
|
|
||||||
Deviation int64 `protobuf:"varint,3,opt,name=deviation,proto3" json:"deviation,omitempty"`
|
|
||||||
Average int64 `protobuf:"varint,4,opt,name=average,proto3" json:"average,omitempty"`
|
|
||||||
Max int64 `protobuf:"varint,5,opt,name=max,proto3" json:"max,omitempty"`
|
|
||||||
Min int64 `protobuf:"varint,6,opt,name=min,proto3" json:"min,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *HealthPingMeasurementResult) Reset() {
|
func (x *HealthPingMeasurementResult) Reset() {
|
||||||
@@ -151,10 +150,7 @@ func (x *HealthPingMeasurementResult) GetMin() int64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type OutboundStatus struct {
|
type OutboundStatus struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
// @Document Whether this outbound is usable
|
// @Document Whether this outbound is usable
|
||||||
// @Restriction ReadOnlyForUser
|
// @Restriction ReadOnlyForUser
|
||||||
Alive bool `protobuf:"varint,1,opt,name=alive,proto3" json:"alive,omitempty"`
|
Alive bool `protobuf:"varint,1,opt,name=alive,proto3" json:"alive,omitempty"`
|
||||||
@@ -173,8 +169,10 @@ type OutboundStatus struct {
|
|||||||
LastSeenTime int64 `protobuf:"varint,5,opt,name=last_seen_time,json=lastSeenTime,proto3" json:"last_seen_time,omitempty"`
|
LastSeenTime int64 `protobuf:"varint,5,opt,name=last_seen_time,json=lastSeenTime,proto3" json:"last_seen_time,omitempty"`
|
||||||
// @Document The time this outbound is tried
|
// @Document The time this outbound is tried
|
||||||
// @Type id.outboundTag
|
// @Type id.outboundTag
|
||||||
LastTryTime int64 `protobuf:"varint,6,opt,name=last_try_time,json=lastTryTime,proto3" json:"last_try_time,omitempty"`
|
LastTryTime int64 `protobuf:"varint,6,opt,name=last_try_time,json=lastTryTime,proto3" json:"last_try_time,omitempty"`
|
||||||
HealthPing *HealthPingMeasurementResult `protobuf:"bytes,7,opt,name=health_ping,json=healthPing,proto3" json:"health_ping,omitempty"`
|
HealthPing *HealthPingMeasurementResult `protobuf:"bytes,7,opt,name=health_ping,json=healthPing,proto3" json:"health_ping,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *OutboundStatus) Reset() {
|
func (x *OutboundStatus) Reset() {
|
||||||
@@ -257,10 +255,7 @@ func (x *OutboundStatus) GetHealthPing() *HealthPingMeasurementResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ProbeResult struct {
|
type ProbeResult struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
// @Document Whether this outbound is usable
|
// @Document Whether this outbound is usable
|
||||||
// @Restriction ReadOnlyForUser
|
// @Restriction ReadOnlyForUser
|
||||||
Alive bool `protobuf:"varint,1,opt,name=alive,proto3" json:"alive,omitempty"`
|
Alive bool `protobuf:"varint,1,opt,name=alive,proto3" json:"alive,omitempty"`
|
||||||
@@ -271,6 +266,8 @@ type ProbeResult struct {
|
|||||||
// @Document The error caused this outbound failed to relay probe request
|
// @Document The error caused this outbound failed to relay probe request
|
||||||
// @Restriction NotMachineReadable
|
// @Restriction NotMachineReadable
|
||||||
LastErrorReason string `protobuf:"bytes,3,opt,name=last_error_reason,json=lastErrorReason,proto3" json:"last_error_reason,omitempty"`
|
LastErrorReason string `protobuf:"bytes,3,opt,name=last_error_reason,json=lastErrorReason,proto3" json:"last_error_reason,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ProbeResult) Reset() {
|
func (x *ProbeResult) Reset() {
|
||||||
@@ -325,13 +322,12 @@ func (x *ProbeResult) GetLastErrorReason() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Intensity struct {
|
type Intensity struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
// @Document The time interval for a probe request in ms.
|
// @Document The time interval for a probe request in ms.
|
||||||
// @Type time.ms
|
// @Type time.ms
|
||||||
ProbeInterval uint32 `protobuf:"varint,1,opt,name=probe_interval,json=probeInterval,proto3" json:"probe_interval,omitempty"`
|
ProbeInterval uint32 `protobuf:"varint,1,opt,name=probe_interval,json=probeInterval,proto3" json:"probe_interval,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Intensity) Reset() {
|
func (x *Intensity) Reset() {
|
||||||
@@ -372,15 +368,14 @@ func (x *Intensity) GetProbeInterval() uint32 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
// @Document The selectors for outbound under observation
|
// @Document The selectors for outbound under observation
|
||||||
SubjectSelector []string `protobuf:"bytes,2,rep,name=subject_selector,json=subjectSelector,proto3" json:"subject_selector,omitempty"`
|
SubjectSelector []string `protobuf:"bytes,2,rep,name=subject_selector,json=subjectSelector,proto3" json:"subject_selector,omitempty"`
|
||||||
ProbeUrl string `protobuf:"bytes,3,opt,name=probe_url,json=probeUrl,proto3" json:"probe_url,omitempty"`
|
ProbeUrl string `protobuf:"bytes,3,opt,name=probe_url,json=probeUrl,proto3" json:"probe_url,omitempty"`
|
||||||
ProbeInterval int64 `protobuf:"varint,4,opt,name=probe_interval,json=probeInterval,proto3" json:"probe_interval,omitempty"`
|
ProbeInterval int64 `protobuf:"varint,4,opt,name=probe_interval,json=probeInterval,proto3" json:"probe_interval,omitempty"`
|
||||||
EnableConcurrency bool `protobuf:"varint,5,opt,name=enable_concurrency,json=enableConcurrency,proto3" json:"enable_concurrency,omitempty"`
|
EnableConcurrency bool `protobuf:"varint,5,opt,name=enable_concurrency,json=enableConcurrency,proto3" json:"enable_concurrency,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Config) Reset() {
|
func (x *Config) Reset() {
|
||||||
@@ -443,82 +438,48 @@ func (x *Config) GetEnableConcurrency() bool {
|
|||||||
|
|
||||||
var File_app_observatory_config_proto protoreflect.FileDescriptor
|
var File_app_observatory_config_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_app_observatory_config_proto_rawDesc = []byte{
|
const file_app_observatory_config_proto_rawDesc = "" +
|
||||||
0x0a, 0x1c, 0x61, 0x70, 0x70, 0x2f, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x6f, 0x72,
|
"\n" +
|
||||||
0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x19,
|
"\x1capp/observatory/config.proto\x12\x19xray.core.app.observatory\"V\n" +
|
||||||
0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x6f, 0x62,
|
"\x11ObservationResult\x12A\n" +
|
||||||
0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x6f, 0x72, 0x79, 0x22, 0x56, 0x0a, 0x11, 0x4f, 0x62, 0x73,
|
"\x06status\x18\x01 \x03(\v2).xray.core.app.observatory.OutboundStatusR\x06status\"\x9f\x01\n" +
|
||||||
0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x41,
|
"\x1bHealthPingMeasurementResult\x12\x10\n" +
|
||||||
0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29,
|
"\x03all\x18\x01 \x01(\x03R\x03all\x12\x12\n" +
|
||||||
0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x6f,
|
"\x04fail\x18\x02 \x01(\x03R\x04fail\x12\x1c\n" +
|
||||||
0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x4f, 0x75, 0x74, 0x62, 0x6f,
|
"\tdeviation\x18\x03 \x01(\x03R\tdeviation\x12\x18\n" +
|
||||||
0x75, 0x6e, 0x64, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75,
|
"\aaverage\x18\x04 \x01(\x03R\aaverage\x12\x10\n" +
|
||||||
0x73, 0x22, 0x9f, 0x01, 0x0a, 0x1b, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x50, 0x69, 0x6e, 0x67,
|
"\x03max\x18\x05 \x01(\x03R\x03max\x12\x10\n" +
|
||||||
0x4d, 0x65, 0x61, 0x73, 0x75, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x75, 0x6c,
|
"\x03min\x18\x06 \x01(\x03R\x03min\"\xae\x02\n" +
|
||||||
0x74, 0x12, 0x10, 0x0a, 0x03, 0x61, 0x6c, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03,
|
"\x0eOutboundStatus\x12\x14\n" +
|
||||||
0x61, 0x6c, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x61, 0x69, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28,
|
"\x05alive\x18\x01 \x01(\bR\x05alive\x12\x14\n" +
|
||||||
0x03, 0x52, 0x04, 0x66, 0x61, 0x69, 0x6c, 0x12, 0x1c, 0x0a, 0x09, 0x64, 0x65, 0x76, 0x69, 0x61,
|
"\x05delay\x18\x02 \x01(\x03R\x05delay\x12*\n" +
|
||||||
0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x64, 0x65, 0x76, 0x69,
|
"\x11last_error_reason\x18\x03 \x01(\tR\x0flastErrorReason\x12!\n" +
|
||||||
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x76, 0x65, 0x72, 0x61, 0x67, 0x65,
|
"\foutbound_tag\x18\x04 \x01(\tR\voutboundTag\x12$\n" +
|
||||||
0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x61, 0x76, 0x65, 0x72, 0x61, 0x67, 0x65, 0x12,
|
"\x0elast_seen_time\x18\x05 \x01(\x03R\flastSeenTime\x12\"\n" +
|
||||||
0x10, 0x0a, 0x03, 0x6d, 0x61, 0x78, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6d, 0x61,
|
"\rlast_try_time\x18\x06 \x01(\x03R\vlastTryTime\x12W\n" +
|
||||||
0x78, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x69, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03,
|
"\vhealth_ping\x18\a \x01(\v26.xray.core.app.observatory.HealthPingMeasurementResultR\n" +
|
||||||
0x6d, 0x69, 0x6e, 0x22, 0xae, 0x02, 0x0a, 0x0e, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64,
|
"healthPing\"e\n" +
|
||||||
0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x18,
|
"\vProbeResult\x12\x14\n" +
|
||||||
0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x12, 0x14, 0x0a, 0x05,
|
"\x05alive\x18\x01 \x01(\bR\x05alive\x12\x14\n" +
|
||||||
0x64, 0x65, 0x6c, 0x61, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x64, 0x65, 0x6c,
|
"\x05delay\x18\x02 \x01(\x03R\x05delay\x12*\n" +
|
||||||
0x61, 0x79, 0x12, 0x2a, 0x0a, 0x11, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72,
|
"\x11last_error_reason\x18\x03 \x01(\tR\x0flastErrorReason\"2\n" +
|
||||||
0x5f, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x6c,
|
"\tIntensity\x12%\n" +
|
||||||
0x61, 0x73, 0x74, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x21,
|
"\x0eprobe_interval\x18\x01 \x01(\rR\rprobeInterval\"\xa6\x01\n" +
|
||||||
0x0a, 0x0c, 0x6f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x5f, 0x74, 0x61, 0x67, 0x18, 0x04,
|
"\x06Config\x12)\n" +
|
||||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x54, 0x61,
|
"\x10subject_selector\x18\x02 \x03(\tR\x0fsubjectSelector\x12\x1b\n" +
|
||||||
0x67, 0x12, 0x24, 0x0a, 0x0e, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x73, 0x65, 0x65, 0x6e, 0x5f, 0x74,
|
"\tprobe_url\x18\x03 \x01(\tR\bprobeUrl\x12%\n" +
|
||||||
0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x6c, 0x61, 0x73, 0x74, 0x53,
|
"\x0eprobe_interval\x18\x04 \x01(\x03R\rprobeInterval\x12-\n" +
|
||||||
0x65, 0x65, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x22, 0x0a, 0x0d, 0x6c, 0x61, 0x73, 0x74, 0x5f,
|
"\x12enable_concurrency\x18\x05 \x01(\bR\x11enableConcurrencyB^\n" +
|
||||||
0x74, 0x72, 0x79, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b,
|
"\x18com.xray.app.observatoryP\x01Z)github.com/xtls/xray-core/app/observatory\xaa\x02\x14Xray.App.Observatoryb\x06proto3"
|
||||||
0x6c, 0x61, 0x73, 0x74, 0x54, 0x72, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x57, 0x0a, 0x0b, 0x68,
|
|
||||||
0x65, 0x61, 0x6c, 0x74, 0x68, 0x5f, 0x70, 0x69, 0x6e, 0x67, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b,
|
|
||||||
0x32, 0x36, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x61, 0x70, 0x70,
|
|
||||||
0x2e, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x48, 0x65, 0x61,
|
|
||||||
0x6c, 0x74, 0x68, 0x50, 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x61, 0x73, 0x75, 0x72, 0x65, 0x6d, 0x65,
|
|
||||||
0x6e, 0x74, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x0a, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68,
|
|
||||||
0x50, 0x69, 0x6e, 0x67, 0x22, 0x65, 0x0a, 0x0b, 0x50, 0x72, 0x6f, 0x62, 0x65, 0x52, 0x65, 0x73,
|
|
||||||
0x75, 0x6c, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x18, 0x01, 0x20, 0x01,
|
|
||||||
0x28, 0x08, 0x52, 0x05, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x65, 0x6c,
|
|
||||||
0x61, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x64, 0x65, 0x6c, 0x61, 0x79, 0x12,
|
|
||||||
0x2a, 0x0a, 0x11, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x72, 0x65,
|
|
||||||
0x61, 0x73, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x6c, 0x61, 0x73, 0x74,
|
|
||||||
0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x22, 0x32, 0x0a, 0x09, 0x49,
|
|
||||||
0x6e, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x74, 0x79, 0x12, 0x25, 0x0a, 0x0e, 0x70, 0x72, 0x6f, 0x62,
|
|
||||||
0x65, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d,
|
|
||||||
0x52, 0x0d, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x22,
|
|
||||||
0xa6, 0x01, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x29, 0x0a, 0x10, 0x73, 0x75,
|
|
||||||
0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x18, 0x02,
|
|
||||||
0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x6c,
|
|
||||||
0x65, 0x63, 0x74, 0x6f, 0x72, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x5f, 0x75,
|
|
||||||
0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x55,
|
|
||||||
0x72, 0x6c, 0x12, 0x25, 0x0a, 0x0e, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x5f, 0x69, 0x6e, 0x74, 0x65,
|
|
||||||
0x72, 0x76, 0x61, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x70, 0x72, 0x6f, 0x62,
|
|
||||||
0x65, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x12, 0x2d, 0x0a, 0x12, 0x65, 0x6e, 0x61,
|
|
||||||
0x62, 0x6c, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x18,
|
|
||||||
0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x6f, 0x6e,
|
|
||||||
0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x42, 0x5e, 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e,
|
|
||||||
0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61,
|
|
||||||
0x74, 0x6f, 0x72, 0x79, 0x50, 0x01, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63,
|
|
||||||
0x6f, 0x6d, 0x2f, 0x78, 0x74, 0x6c, 0x73, 0x2f, 0x78, 0x72, 0x61, 0x79, 0x2d, 0x63, 0x6f, 0x72,
|
|
||||||
0x65, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x6f, 0x72,
|
|
||||||
0x79, 0xaa, 0x02, 0x14, 0x58, 0x72, 0x61, 0x79, 0x2e, 0x41, 0x70, 0x70, 0x2e, 0x4f, 0x62, 0x73,
|
|
||||||
0x65, 0x72, 0x76, 0x61, 0x74, 0x6f, 0x72, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
file_app_observatory_config_proto_rawDescOnce sync.Once
|
file_app_observatory_config_proto_rawDescOnce sync.Once
|
||||||
file_app_observatory_config_proto_rawDescData = file_app_observatory_config_proto_rawDesc
|
file_app_observatory_config_proto_rawDescData []byte
|
||||||
)
|
)
|
||||||
|
|
||||||
func file_app_observatory_config_proto_rawDescGZIP() []byte {
|
func file_app_observatory_config_proto_rawDescGZIP() []byte {
|
||||||
file_app_observatory_config_proto_rawDescOnce.Do(func() {
|
file_app_observatory_config_proto_rawDescOnce.Do(func() {
|
||||||
file_app_observatory_config_proto_rawDescData = protoimpl.X.CompressGZIP(file_app_observatory_config_proto_rawDescData)
|
file_app_observatory_config_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_app_observatory_config_proto_rawDesc), len(file_app_observatory_config_proto_rawDesc)))
|
||||||
})
|
})
|
||||||
return file_app_observatory_config_proto_rawDescData
|
return file_app_observatory_config_proto_rawDescData
|
||||||
}
|
}
|
||||||
@@ -551,7 +512,7 @@ func file_app_observatory_config_proto_init() {
|
|||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_app_observatory_config_proto_rawDesc,
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_app_observatory_config_proto_rawDesc), len(file_app_observatory_config_proto_rawDesc)),
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 6,
|
NumMessages: 6,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
@@ -562,7 +523,6 @@ func file_app_observatory_config_proto_init() {
|
|||||||
MessageInfos: file_app_observatory_config_proto_msgTypes,
|
MessageInfos: file_app_observatory_config_proto_msgTypes,
|
||||||
}.Build()
|
}.Build()
|
||||||
File_app_observatory_config_proto = out.File
|
File_app_observatory_config_proto = out.File
|
||||||
file_app_observatory_config_proto_rawDesc = nil
|
|
||||||
file_app_observatory_config_proto_goTypes = nil
|
file_app_observatory_config_proto_goTypes = nil
|
||||||
file_app_observatory_config_proto_depIdxs = nil
|
file_app_observatory_config_proto_depIdxs = nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import (
|
|||||||
"github.com/xtls/xray-core/common/session"
|
"github.com/xtls/xray-core/common/session"
|
||||||
"github.com/xtls/xray-core/common/signal/done"
|
"github.com/xtls/xray-core/common/signal/done"
|
||||||
"github.com/xtls/xray-core/common/task"
|
"github.com/xtls/xray-core/common/task"
|
||||||
|
"github.com/xtls/xray-core/common/utils"
|
||||||
"github.com/xtls/xray-core/core"
|
"github.com/xtls/xray-core/core"
|
||||||
"github.com/xtls/xray-core/features/extension"
|
"github.com/xtls/xray-core/features/extension"
|
||||||
"github.com/xtls/xray-core/features/outbound"
|
"github.com/xtls/xray-core/features/outbound"
|
||||||
@@ -162,7 +163,9 @@ func (o *Observer) probe(outbound string) ProbeResult {
|
|||||||
if o.config.ProbeUrl != "" {
|
if o.config.ProbeUrl != "" {
|
||||||
probeURL = o.config.ProbeUrl
|
probeURL = o.config.ProbeUrl
|
||||||
}
|
}
|
||||||
response, err := httpClient.Get(probeURL)
|
req, _ := http.NewRequest(http.MethodGet, probeURL, nil)
|
||||||
|
utils.TryDefaultHeadersWith(req.Header, "nav")
|
||||||
|
response, err := httpClient.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.New("outbound failed to relay connection").Base(err)
|
return errors.New("outbound failed to relay connection").Base(err)
|
||||||
}
|
}
|
||||||
|
|||||||
+84
-130
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.35.1
|
// protoc-gen-go v1.36.11
|
||||||
// protoc v5.28.2
|
// protoc v6.33.5
|
||||||
// source: app/policy/config.proto
|
// source: app/policy/config.proto
|
||||||
|
|
||||||
package policy
|
package policy
|
||||||
@@ -11,6 +11,7 @@ import (
|
|||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
sync "sync"
|
sync "sync"
|
||||||
|
unsafe "unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -21,11 +22,10 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Second struct {
|
type Second struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Value uint32 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
Value uint32 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Second) Reset() {
|
func (x *Second) Reset() {
|
||||||
@@ -66,13 +66,12 @@ func (x *Second) GetValue() uint32 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Policy struct {
|
type Policy struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Timeout *Policy_Timeout `protobuf:"bytes,1,opt,name=timeout,proto3" json:"timeout,omitempty"`
|
||||||
|
Stats *Policy_Stats `protobuf:"bytes,2,opt,name=stats,proto3" json:"stats,omitempty"`
|
||||||
|
Buffer *Policy_Buffer `protobuf:"bytes,3,opt,name=buffer,proto3" json:"buffer,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
Timeout *Policy_Timeout `protobuf:"bytes,1,opt,name=timeout,proto3" json:"timeout,omitempty"`
|
|
||||||
Stats *Policy_Stats `protobuf:"bytes,2,opt,name=stats,proto3" json:"stats,omitempty"`
|
|
||||||
Buffer *Policy_Buffer `protobuf:"bytes,3,opt,name=buffer,proto3" json:"buffer,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Policy) Reset() {
|
func (x *Policy) Reset() {
|
||||||
@@ -127,11 +126,10 @@ func (x *Policy) GetBuffer() *Policy_Buffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type SystemPolicy struct {
|
type SystemPolicy struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Stats *SystemPolicy_Stats `protobuf:"bytes,1,opt,name=stats,proto3" json:"stats,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
Stats *SystemPolicy_Stats `protobuf:"bytes,1,opt,name=stats,proto3" json:"stats,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *SystemPolicy) Reset() {
|
func (x *SystemPolicy) Reset() {
|
||||||
@@ -172,12 +170,11 @@ func (x *SystemPolicy) GetStats() *SystemPolicy_Stats {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Level map[uint32]*Policy `protobuf:"bytes,1,rep,name=level,proto3" json:"level,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||||
|
System *SystemPolicy `protobuf:"bytes,2,opt,name=system,proto3" json:"system,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
Level map[uint32]*Policy `protobuf:"bytes,1,rep,name=level,proto3" json:"level,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
|
||||||
System *SystemPolicy `protobuf:"bytes,2,opt,name=system,proto3" json:"system,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Config) Reset() {
|
func (x *Config) Reset() {
|
||||||
@@ -226,14 +223,13 @@ func (x *Config) GetSystem() *SystemPolicy {
|
|||||||
|
|
||||||
// Timeout is a message for timeout settings in various stages, in seconds.
|
// Timeout is a message for timeout settings in various stages, in seconds.
|
||||||
type Policy_Timeout struct {
|
type Policy_Timeout struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Handshake *Second `protobuf:"bytes,1,opt,name=handshake,proto3" json:"handshake,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
ConnectionIdle *Second `protobuf:"bytes,2,opt,name=connection_idle,json=connectionIdle,proto3" json:"connection_idle,omitempty"`
|
||||||
|
UplinkOnly *Second `protobuf:"bytes,3,opt,name=uplink_only,json=uplinkOnly,proto3" json:"uplink_only,omitempty"`
|
||||||
Handshake *Second `protobuf:"bytes,1,opt,name=handshake,proto3" json:"handshake,omitempty"`
|
DownlinkOnly *Second `protobuf:"bytes,4,opt,name=downlink_only,json=downlinkOnly,proto3" json:"downlink_only,omitempty"`
|
||||||
ConnectionIdle *Second `protobuf:"bytes,2,opt,name=connection_idle,json=connectionIdle,proto3" json:"connection_idle,omitempty"`
|
unknownFields protoimpl.UnknownFields
|
||||||
UplinkOnly *Second `protobuf:"bytes,3,opt,name=uplink_only,json=uplinkOnly,proto3" json:"uplink_only,omitempty"`
|
sizeCache protoimpl.SizeCache
|
||||||
DownlinkOnly *Second `protobuf:"bytes,4,opt,name=downlink_only,json=downlinkOnly,proto3" json:"downlink_only,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Policy_Timeout) Reset() {
|
func (x *Policy_Timeout) Reset() {
|
||||||
@@ -295,13 +291,12 @@ func (x *Policy_Timeout) GetDownlinkOnly() *Second {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Policy_Stats struct {
|
type Policy_Stats struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
UserUplink bool `protobuf:"varint,1,opt,name=user_uplink,json=userUplink,proto3" json:"user_uplink,omitempty"`
|
||||||
|
UserDownlink bool `protobuf:"varint,2,opt,name=user_downlink,json=userDownlink,proto3" json:"user_downlink,omitempty"`
|
||||||
|
UserOnline bool `protobuf:"varint,3,opt,name=user_online,json=userOnline,proto3" json:"user_online,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
UserUplink bool `protobuf:"varint,1,opt,name=user_uplink,json=userUplink,proto3" json:"user_uplink,omitempty"`
|
|
||||||
UserDownlink bool `protobuf:"varint,2,opt,name=user_downlink,json=userDownlink,proto3" json:"user_downlink,omitempty"`
|
|
||||||
UserOnline bool `protobuf:"varint,3,opt,name=user_online,json=userOnline,proto3" json:"user_online,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Policy_Stats) Reset() {
|
func (x *Policy_Stats) Reset() {
|
||||||
@@ -356,12 +351,11 @@ func (x *Policy_Stats) GetUserOnline() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Policy_Buffer struct {
|
type Policy_Buffer struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
// Buffer size per connection, in bytes. -1 for unlimited buffer.
|
// Buffer size per connection, in bytes. -1 for unlimited buffer.
|
||||||
Connection int32 `protobuf:"varint,1,opt,name=connection,proto3" json:"connection,omitempty"`
|
Connection int32 `protobuf:"varint,1,opt,name=connection,proto3" json:"connection,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Policy_Buffer) Reset() {
|
func (x *Policy_Buffer) Reset() {
|
||||||
@@ -402,14 +396,13 @@ func (x *Policy_Buffer) GetConnection() int32 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type SystemPolicy_Stats struct {
|
type SystemPolicy_Stats struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
InboundUplink bool `protobuf:"varint,1,opt,name=inbound_uplink,json=inboundUplink,proto3" json:"inbound_uplink,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
InboundDownlink bool `protobuf:"varint,2,opt,name=inbound_downlink,json=inboundDownlink,proto3" json:"inbound_downlink,omitempty"`
|
||||||
|
OutboundUplink bool `protobuf:"varint,3,opt,name=outbound_uplink,json=outboundUplink,proto3" json:"outbound_uplink,omitempty"`
|
||||||
InboundUplink bool `protobuf:"varint,1,opt,name=inbound_uplink,json=inboundUplink,proto3" json:"inbound_uplink,omitempty"`
|
OutboundDownlink bool `protobuf:"varint,4,opt,name=outbound_downlink,json=outboundDownlink,proto3" json:"outbound_downlink,omitempty"`
|
||||||
InboundDownlink bool `protobuf:"varint,2,opt,name=inbound_downlink,json=inboundDownlink,proto3" json:"inbound_downlink,omitempty"`
|
unknownFields protoimpl.UnknownFields
|
||||||
OutboundUplink bool `protobuf:"varint,3,opt,name=outbound_uplink,json=outboundUplink,proto3" json:"outbound_uplink,omitempty"`
|
sizeCache protoimpl.SizeCache
|
||||||
OutboundDownlink bool `protobuf:"varint,4,opt,name=outbound_downlink,json=outboundDownlink,proto3" json:"outbound_downlink,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *SystemPolicy_Stats) Reset() {
|
func (x *SystemPolicy_Stats) Reset() {
|
||||||
@@ -472,93 +465,55 @@ func (x *SystemPolicy_Stats) GetOutboundDownlink() bool {
|
|||||||
|
|
||||||
var File_app_policy_config_proto protoreflect.FileDescriptor
|
var File_app_policy_config_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_app_policy_config_proto_rawDesc = []byte{
|
const file_app_policy_config_proto_rawDesc = "" +
|
||||||
0x0a, 0x17, 0x61, 0x70, 0x70, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2f, 0x63, 0x6f, 0x6e,
|
"\n" +
|
||||||
0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x78, 0x72, 0x61, 0x79, 0x2e,
|
"\x17app/policy/config.proto\x12\x0fxray.app.policy\"\x1e\n" +
|
||||||
0x61, 0x70, 0x70, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x22, 0x1e, 0x0a, 0x06, 0x53, 0x65,
|
"\x06Second\x12\x14\n" +
|
||||||
0x63, 0x6f, 0x6e, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20,
|
"\x05value\x18\x01 \x01(\rR\x05value\"\xc7\x04\n" +
|
||||||
0x01, 0x28, 0x0d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xc7, 0x04, 0x0a, 0x06, 0x50,
|
"\x06Policy\x129\n" +
|
||||||
0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x39, 0x0a, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74,
|
"\atimeout\x18\x01 \x01(\v2\x1f.xray.app.policy.Policy.TimeoutR\atimeout\x123\n" +
|
||||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70,
|
"\x05stats\x18\x02 \x01(\v2\x1d.xray.app.policy.Policy.StatsR\x05stats\x126\n" +
|
||||||
0x70, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e,
|
"\x06buffer\x18\x03 \x01(\v2\x1e.xray.app.policy.Policy.BufferR\x06buffer\x1a\xfa\x01\n" +
|
||||||
0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x52, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74,
|
"\aTimeout\x125\n" +
|
||||||
0x12, 0x33, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
"\thandshake\x18\x01 \x01(\v2\x17.xray.app.policy.SecondR\thandshake\x12@\n" +
|
||||||
0x1d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63,
|
"\x0fconnection_idle\x18\x02 \x01(\v2\x17.xray.app.policy.SecondR\x0econnectionIdle\x128\n" +
|
||||||
0x79, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x05,
|
"\vuplink_only\x18\x03 \x01(\v2\x17.xray.app.policy.SecondR\n" +
|
||||||
0x73, 0x74, 0x61, 0x74, 0x73, 0x12, 0x36, 0x0a, 0x06, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x18,
|
"uplinkOnly\x12<\n" +
|
||||||
0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70,
|
"\rdownlink_only\x18\x04 \x01(\v2\x17.xray.app.policy.SecondR\fdownlinkOnly\x1an\n" +
|
||||||
0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x42,
|
"\x05Stats\x12\x1f\n" +
|
||||||
0x75, 0x66, 0x66, 0x65, 0x72, 0x52, 0x06, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x1a, 0xfa, 0x01,
|
"\vuser_uplink\x18\x01 \x01(\bR\n" +
|
||||||
0x0a, 0x07, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x35, 0x0a, 0x09, 0x68, 0x61, 0x6e,
|
"userUplink\x12#\n" +
|
||||||
0x64, 0x73, 0x68, 0x61, 0x6b, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x78,
|
"\ruser_downlink\x18\x02 \x01(\bR\fuserDownlink\x12\x1f\n" +
|
||||||
0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x53,
|
"\vuser_online\x18\x03 \x01(\bR\n" +
|
||||||
0x65, 0x63, 0x6f, 0x6e, 0x64, 0x52, 0x09, 0x68, 0x61, 0x6e, 0x64, 0x73, 0x68, 0x61, 0x6b, 0x65,
|
"userOnline\x1a(\n" +
|
||||||
0x12, 0x40, 0x0a, 0x0f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69,
|
"\x06Buffer\x12\x1e\n" +
|
||||||
0x64, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x78, 0x72, 0x61, 0x79,
|
"\n" +
|
||||||
0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x53, 0x65, 0x63, 0x6f,
|
"connection\x18\x01 \x01(\x05R\n" +
|
||||||
0x6e, 0x64, 0x52, 0x0e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64,
|
"connection\"\xfb\x01\n" +
|
||||||
0x6c, 0x65, 0x12, 0x38, 0x0a, 0x0b, 0x75, 0x70, 0x6c, 0x69, 0x6e, 0x6b, 0x5f, 0x6f, 0x6e, 0x6c,
|
"\fSystemPolicy\x129\n" +
|
||||||
0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61,
|
"\x05stats\x18\x01 \x01(\v2#.xray.app.policy.SystemPolicy.StatsR\x05stats\x1a\xaf\x01\n" +
|
||||||
0x70, 0x70, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64,
|
"\x05Stats\x12%\n" +
|
||||||
0x52, 0x0a, 0x75, 0x70, 0x6c, 0x69, 0x6e, 0x6b, 0x4f, 0x6e, 0x6c, 0x79, 0x12, 0x3c, 0x0a, 0x0d,
|
"\x0einbound_uplink\x18\x01 \x01(\bR\rinboundUplink\x12)\n" +
|
||||||
0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x69, 0x6e, 0x6b, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x04, 0x20,
|
"\x10inbound_downlink\x18\x02 \x01(\bR\x0finboundDownlink\x12'\n" +
|
||||||
0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70,
|
"\x0foutbound_uplink\x18\x03 \x01(\bR\x0eoutboundUplink\x12+\n" +
|
||||||
0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x52, 0x0c, 0x64, 0x6f,
|
"\x11outbound_downlink\x18\x04 \x01(\bR\x10outboundDownlink\"\xcc\x01\n" +
|
||||||
0x77, 0x6e, 0x6c, 0x69, 0x6e, 0x6b, 0x4f, 0x6e, 0x6c, 0x79, 0x1a, 0x6e, 0x0a, 0x05, 0x53, 0x74,
|
"\x06Config\x128\n" +
|
||||||
0x61, 0x74, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x75, 0x70, 0x6c, 0x69,
|
"\x05level\x18\x01 \x03(\v2\".xray.app.policy.Config.LevelEntryR\x05level\x125\n" +
|
||||||
0x6e, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x75, 0x73, 0x65, 0x72, 0x55, 0x70,
|
"\x06system\x18\x02 \x01(\v2\x1d.xray.app.policy.SystemPolicyR\x06system\x1aQ\n" +
|
||||||
0x6c, 0x69, 0x6e, 0x6b, 0x12, 0x23, 0x0a, 0x0d, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x64, 0x6f, 0x77,
|
"\n" +
|
||||||
0x6e, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x75, 0x73, 0x65,
|
"LevelEntry\x12\x10\n" +
|
||||||
0x72, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x69, 0x6e, 0x6b, 0x12, 0x1f, 0x0a, 0x0b, 0x75, 0x73, 0x65,
|
"\x03key\x18\x01 \x01(\rR\x03key\x12-\n" +
|
||||||
0x72, 0x5f, 0x6f, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a,
|
"\x05value\x18\x02 \x01(\v2\x17.xray.app.policy.PolicyR\x05value:\x028\x01BO\n" +
|
||||||
0x75, 0x73, 0x65, 0x72, 0x4f, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x1a, 0x28, 0x0a, 0x06, 0x42, 0x75,
|
"\x13com.xray.app.policyP\x01Z$github.com/xtls/xray-core/app/policy\xaa\x02\x0fXray.App.Policyb\x06proto3"
|
||||||
0x66, 0x66, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69,
|
|
||||||
0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63,
|
|
||||||
0x74, 0x69, 0x6f, 0x6e, 0x22, 0xfb, 0x01, 0x0a, 0x0c, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x50,
|
|
||||||
0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x39, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x73, 0x18, 0x01,
|
|
||||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e,
|
|
||||||
0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x50, 0x6f, 0x6c,
|
|
||||||
0x69, 0x63, 0x79, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x73,
|
|
||||||
0x1a, 0xaf, 0x01, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x69, 0x6e,
|
|
||||||
0x62, 0x6f, 0x75, 0x6e, 0x64, 0x5f, 0x75, 0x70, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x01, 0x20, 0x01,
|
|
||||||
0x28, 0x08, 0x52, 0x0d, 0x69, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x55, 0x70, 0x6c, 0x69, 0x6e,
|
|
||||||
0x6b, 0x12, 0x29, 0x0a, 0x10, 0x69, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x5f, 0x64, 0x6f, 0x77,
|
|
||||||
0x6e, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x69, 0x6e, 0x62,
|
|
||||||
0x6f, 0x75, 0x6e, 0x64, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x69, 0x6e, 0x6b, 0x12, 0x27, 0x0a, 0x0f,
|
|
||||||
0x6f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x5f, 0x75, 0x70, 0x6c, 0x69, 0x6e, 0x6b, 0x18,
|
|
||||||
0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x6f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x55,
|
|
||||||
0x70, 0x6c, 0x69, 0x6e, 0x6b, 0x12, 0x2b, 0x0a, 0x11, 0x6f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e,
|
|
||||||
0x64, 0x5f, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08,
|
|
||||||
0x52, 0x10, 0x6f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x69,
|
|
||||||
0x6e, 0x6b, 0x22, 0xcc, 0x01, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x38, 0x0a,
|
|
||||||
0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x78,
|
|
||||||
0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x43,
|
|
||||||
0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x79,
|
|
||||||
0x52, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x35, 0x0a, 0x06, 0x73, 0x79, 0x73, 0x74, 0x65,
|
|
||||||
0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61,
|
|
||||||
0x70, 0x70, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d,
|
|
||||||
0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x06, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x1a, 0x51,
|
|
||||||
0x0a, 0x0a, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03,
|
|
||||||
0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2d,
|
|
||||||
0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e,
|
|
||||||
0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e,
|
|
||||||
0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38,
|
|
||||||
0x01, 0x42, 0x4f, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70,
|
|
||||||
0x70, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x50, 0x01, 0x5a, 0x24, 0x67, 0x69, 0x74, 0x68,
|
|
||||||
0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x74, 0x6c, 0x73, 0x2f, 0x78, 0x72, 0x61, 0x79,
|
|
||||||
0x2d, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79,
|
|
||||||
0xaa, 0x02, 0x0f, 0x58, 0x72, 0x61, 0x79, 0x2e, 0x41, 0x70, 0x70, 0x2e, 0x50, 0x6f, 0x6c, 0x69,
|
|
||||||
0x63, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
file_app_policy_config_proto_rawDescOnce sync.Once
|
file_app_policy_config_proto_rawDescOnce sync.Once
|
||||||
file_app_policy_config_proto_rawDescData = file_app_policy_config_proto_rawDesc
|
file_app_policy_config_proto_rawDescData []byte
|
||||||
)
|
)
|
||||||
|
|
||||||
func file_app_policy_config_proto_rawDescGZIP() []byte {
|
func file_app_policy_config_proto_rawDescGZIP() []byte {
|
||||||
file_app_policy_config_proto_rawDescOnce.Do(func() {
|
file_app_policy_config_proto_rawDescOnce.Do(func() {
|
||||||
file_app_policy_config_proto_rawDescData = protoimpl.X.CompressGZIP(file_app_policy_config_proto_rawDescData)
|
file_app_policy_config_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_app_policy_config_proto_rawDesc), len(file_app_policy_config_proto_rawDesc)))
|
||||||
})
|
})
|
||||||
return file_app_policy_config_proto_rawDescData
|
return file_app_policy_config_proto_rawDescData
|
||||||
}
|
}
|
||||||
@@ -603,7 +558,7 @@ func file_app_policy_config_proto_init() {
|
|||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_app_policy_config_proto_rawDesc,
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_app_policy_config_proto_rawDesc), len(file_app_policy_config_proto_rawDesc)),
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 9,
|
NumMessages: 9,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
@@ -614,7 +569,6 @@ func file_app_policy_config_proto_init() {
|
|||||||
MessageInfos: file_app_policy_config_proto_msgTypes,
|
MessageInfos: file_app_policy_config_proto_msgTypes,
|
||||||
}.Build()
|
}.Build()
|
||||||
File_app_policy_config_proto = out.File
|
File_app_policy_config_proto = out.File
|
||||||
file_app_policy_config_proto_rawDesc = nil
|
|
||||||
file_app_policy_config_proto_goTypes = nil
|
file_app_policy_config_proto_goTypes = nil
|
||||||
file_app_policy_config_proto_depIdxs = nil
|
file_app_policy_config_proto_depIdxs = nil
|
||||||
}
|
}
|
||||||
|
|||||||
+124
-249
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.35.1
|
// protoc-gen-go v1.36.11
|
||||||
// protoc v5.28.2
|
// protoc v6.33.5
|
||||||
// source: app/proxyman/command/command.proto
|
// source: app/proxyman/command/command.proto
|
||||||
|
|
||||||
package command
|
package command
|
||||||
@@ -14,6 +14,7 @@ import (
|
|||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
sync "sync"
|
sync "sync"
|
||||||
|
unsafe "unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -24,11 +25,10 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type AddUserOperation struct {
|
type AddUserOperation struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
User *protocol.User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
User *protocol.User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *AddUserOperation) Reset() {
|
func (x *AddUserOperation) Reset() {
|
||||||
@@ -69,11 +69,10 @@ func (x *AddUserOperation) GetUser() *protocol.User {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type RemoveUserOperation struct {
|
type RemoveUserOperation struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *RemoveUserOperation) Reset() {
|
func (x *RemoveUserOperation) Reset() {
|
||||||
@@ -114,11 +113,10 @@ func (x *RemoveUserOperation) GetEmail() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type AddInboundRequest struct {
|
type AddInboundRequest struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Inbound *core.InboundHandlerConfig `protobuf:"bytes,1,opt,name=inbound,proto3" json:"inbound,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
Inbound *core.InboundHandlerConfig `protobuf:"bytes,1,opt,name=inbound,proto3" json:"inbound,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *AddInboundRequest) Reset() {
|
func (x *AddInboundRequest) Reset() {
|
||||||
@@ -159,9 +157,9 @@ func (x *AddInboundRequest) GetInbound() *core.InboundHandlerConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type AddInboundResponse struct {
|
type AddInboundResponse struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *AddInboundResponse) Reset() {
|
func (x *AddInboundResponse) Reset() {
|
||||||
@@ -195,11 +193,10 @@ func (*AddInboundResponse) Descriptor() ([]byte, []int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type RemoveInboundRequest struct {
|
type RemoveInboundRequest struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Tag string `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
Tag string `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *RemoveInboundRequest) Reset() {
|
func (x *RemoveInboundRequest) Reset() {
|
||||||
@@ -240,9 +237,9 @@ func (x *RemoveInboundRequest) GetTag() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type RemoveInboundResponse struct {
|
type RemoveInboundResponse struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *RemoveInboundResponse) Reset() {
|
func (x *RemoveInboundResponse) Reset() {
|
||||||
@@ -276,12 +273,11 @@ func (*RemoveInboundResponse) Descriptor() ([]byte, []int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type AlterInboundRequest struct {
|
type AlterInboundRequest struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Tag string `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"`
|
||||||
|
Operation *serial.TypedMessage `protobuf:"bytes,2,opt,name=operation,proto3" json:"operation,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
Tag string `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"`
|
|
||||||
Operation *serial.TypedMessage `protobuf:"bytes,2,opt,name=operation,proto3" json:"operation,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *AlterInboundRequest) Reset() {
|
func (x *AlterInboundRequest) Reset() {
|
||||||
@@ -329,9 +325,9 @@ func (x *AlterInboundRequest) GetOperation() *serial.TypedMessage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type AlterInboundResponse struct {
|
type AlterInboundResponse struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *AlterInboundResponse) Reset() {
|
func (x *AlterInboundResponse) Reset() {
|
||||||
@@ -365,11 +361,10 @@ func (*AlterInboundResponse) Descriptor() ([]byte, []int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ListInboundsRequest struct {
|
type ListInboundsRequest struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
IsOnlyTags bool `protobuf:"varint,1,opt,name=isOnlyTags,proto3" json:"isOnlyTags,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
IsOnlyTags bool `protobuf:"varint,1,opt,name=isOnlyTags,proto3" json:"isOnlyTags,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ListInboundsRequest) Reset() {
|
func (x *ListInboundsRequest) Reset() {
|
||||||
@@ -410,11 +405,10 @@ func (x *ListInboundsRequest) GetIsOnlyTags() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ListInboundsResponse struct {
|
type ListInboundsResponse struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Inbounds []*core.InboundHandlerConfig `protobuf:"bytes,1,rep,name=inbounds,proto3" json:"inbounds,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
Inbounds []*core.InboundHandlerConfig `protobuf:"bytes,1,rep,name=inbounds,proto3" json:"inbounds,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ListInboundsResponse) Reset() {
|
func (x *ListInboundsResponse) Reset() {
|
||||||
@@ -455,12 +449,11 @@ func (x *ListInboundsResponse) GetInbounds() []*core.InboundHandlerConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type GetInboundUserRequest struct {
|
type GetInboundUserRequest struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Tag string `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"`
|
||||||
|
Email string `protobuf:"bytes,2,opt,name=email,proto3" json:"email,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
Tag string `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"`
|
|
||||||
Email string `protobuf:"bytes,2,opt,name=email,proto3" json:"email,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GetInboundUserRequest) Reset() {
|
func (x *GetInboundUserRequest) Reset() {
|
||||||
@@ -508,11 +501,10 @@ func (x *GetInboundUserRequest) GetEmail() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type GetInboundUserResponse struct {
|
type GetInboundUserResponse struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Users []*protocol.User `protobuf:"bytes,1,rep,name=users,proto3" json:"users,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
Users []*protocol.User `protobuf:"bytes,1,rep,name=users,proto3" json:"users,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GetInboundUserResponse) Reset() {
|
func (x *GetInboundUserResponse) Reset() {
|
||||||
@@ -553,11 +545,10 @@ func (x *GetInboundUserResponse) GetUsers() []*protocol.User {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type GetInboundUsersCountResponse struct {
|
type GetInboundUsersCountResponse struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Count int64 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
Count int64 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GetInboundUsersCountResponse) Reset() {
|
func (x *GetInboundUsersCountResponse) Reset() {
|
||||||
@@ -598,11 +589,10 @@ func (x *GetInboundUsersCountResponse) GetCount() int64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type AddOutboundRequest struct {
|
type AddOutboundRequest struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Outbound *core.OutboundHandlerConfig `protobuf:"bytes,1,opt,name=outbound,proto3" json:"outbound,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
Outbound *core.OutboundHandlerConfig `protobuf:"bytes,1,opt,name=outbound,proto3" json:"outbound,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *AddOutboundRequest) Reset() {
|
func (x *AddOutboundRequest) Reset() {
|
||||||
@@ -643,9 +633,9 @@ func (x *AddOutboundRequest) GetOutbound() *core.OutboundHandlerConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type AddOutboundResponse struct {
|
type AddOutboundResponse struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *AddOutboundResponse) Reset() {
|
func (x *AddOutboundResponse) Reset() {
|
||||||
@@ -679,11 +669,10 @@ func (*AddOutboundResponse) Descriptor() ([]byte, []int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type RemoveOutboundRequest struct {
|
type RemoveOutboundRequest struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Tag string `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
Tag string `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *RemoveOutboundRequest) Reset() {
|
func (x *RemoveOutboundRequest) Reset() {
|
||||||
@@ -724,9 +713,9 @@ func (x *RemoveOutboundRequest) GetTag() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type RemoveOutboundResponse struct {
|
type RemoveOutboundResponse struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *RemoveOutboundResponse) Reset() {
|
func (x *RemoveOutboundResponse) Reset() {
|
||||||
@@ -760,12 +749,11 @@ func (*RemoveOutboundResponse) Descriptor() ([]byte, []int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type AlterOutboundRequest struct {
|
type AlterOutboundRequest struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Tag string `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"`
|
||||||
|
Operation *serial.TypedMessage `protobuf:"bytes,2,opt,name=operation,proto3" json:"operation,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
Tag string `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"`
|
|
||||||
Operation *serial.TypedMessage `protobuf:"bytes,2,opt,name=operation,proto3" json:"operation,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *AlterOutboundRequest) Reset() {
|
func (x *AlterOutboundRequest) Reset() {
|
||||||
@@ -813,9 +801,9 @@ func (x *AlterOutboundRequest) GetOperation() *serial.TypedMessage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type AlterOutboundResponse struct {
|
type AlterOutboundResponse struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *AlterOutboundResponse) Reset() {
|
func (x *AlterOutboundResponse) Reset() {
|
||||||
@@ -849,9 +837,9 @@ func (*AlterOutboundResponse) Descriptor() ([]byte, []int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ListOutboundsRequest struct {
|
type ListOutboundsRequest struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ListOutboundsRequest) Reset() {
|
func (x *ListOutboundsRequest) Reset() {
|
||||||
@@ -885,11 +873,10 @@ func (*ListOutboundsRequest) Descriptor() ([]byte, []int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ListOutboundsResponse struct {
|
type ListOutboundsResponse struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Outbounds []*core.OutboundHandlerConfig `protobuf:"bytes,1,rep,name=outbounds,proto3" json:"outbounds,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
Outbounds []*core.OutboundHandlerConfig `protobuf:"bytes,1,rep,name=outbounds,proto3" json:"outbounds,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ListOutboundsResponse) Reset() {
|
func (x *ListOutboundsResponse) Reset() {
|
||||||
@@ -930,9 +917,9 @@ func (x *ListOutboundsResponse) GetOutbounds() []*core.OutboundHandlerConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Config) Reset() {
|
func (x *Config) Reset() {
|
||||||
@@ -967,183 +954,72 @@ func (*Config) Descriptor() ([]byte, []int) {
|
|||||||
|
|
||||||
var File_app_proxyman_command_command_proto protoreflect.FileDescriptor
|
var File_app_proxyman_command_command_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_app_proxyman_command_command_proto_rawDesc = []byte{
|
const file_app_proxyman_command_command_proto_rawDesc = "" +
|
||||||
0x0a, 0x22, 0x61, 0x70, 0x70, 0x2f, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2f, 0x63,
|
"\n" +
|
||||||
0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x70,
|
"\"app/proxyman/command/command.proto\x12\x19xray.app.proxyman.command\x1a\x1acommon/protocol/user.proto\x1a!common/serial/typed_message.proto\x1a\x11core/config.proto\"B\n" +
|
||||||
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x19, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70,
|
"\x10AddUserOperation\x12.\n" +
|
||||||
0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x1a,
|
"\x04user\x18\x01 \x01(\v2\x1a.xray.common.protocol.UserR\x04user\"+\n" +
|
||||||
0x1a, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c,
|
"\x13RemoveUserOperation\x12\x14\n" +
|
||||||
0x2f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x63, 0x6f, 0x6d,
|
"\x05email\x18\x01 \x01(\tR\x05email\"N\n" +
|
||||||
0x6d, 0x6f, 0x6e, 0x2f, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x64,
|
"\x11AddInboundRequest\x129\n" +
|
||||||
0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x11,
|
"\ainbound\x18\x01 \x01(\v2\x1f.xray.core.InboundHandlerConfigR\ainbound\"\x14\n" +
|
||||||
0x63, 0x6f, 0x72, 0x65, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
"\x12AddInboundResponse\"(\n" +
|
||||||
0x6f, 0x22, 0x42, 0x0a, 0x10, 0x41, 0x64, 0x64, 0x55, 0x73, 0x65, 0x72, 0x4f, 0x70, 0x65, 0x72,
|
"\x14RemoveInboundRequest\x12\x10\n" +
|
||||||
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2e, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20,
|
"\x03tag\x18\x01 \x01(\tR\x03tag\"\x17\n" +
|
||||||
0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f,
|
"\x15RemoveInboundResponse\"g\n" +
|
||||||
0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52,
|
"\x13AlterInboundRequest\x12\x10\n" +
|
||||||
0x04, 0x75, 0x73, 0x65, 0x72, 0x22, 0x2b, 0x0a, 0x13, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x55,
|
"\x03tag\x18\x01 \x01(\tR\x03tag\x12>\n" +
|
||||||
0x73, 0x65, 0x72, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05,
|
"\toperation\x18\x02 \x01(\v2 .xray.common.serial.TypedMessageR\toperation\"\x16\n" +
|
||||||
0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61,
|
"\x14AlterInboundResponse\"5\n" +
|
||||||
0x69, 0x6c, 0x22, 0x4e, 0x0a, 0x11, 0x41, 0x64, 0x64, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64,
|
"\x13ListInboundsRequest\x12\x1e\n" +
|
||||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x39, 0x0a, 0x07, 0x69, 0x6e, 0x62, 0x6f, 0x75,
|
"\n" +
|
||||||
0x6e, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e,
|
"isOnlyTags\x18\x01 \x01(\bR\n" +
|
||||||
0x63, 0x6f, 0x72, 0x65, 0x2e, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x48, 0x61, 0x6e, 0x64,
|
"isOnlyTags\"S\n" +
|
||||||
0x6c, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x07, 0x69, 0x6e, 0x62, 0x6f, 0x75,
|
"\x14ListInboundsResponse\x12;\n" +
|
||||||
0x6e, 0x64, 0x22, 0x14, 0x0a, 0x12, 0x41, 0x64, 0x64, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64,
|
"\binbounds\x18\x01 \x03(\v2\x1f.xray.core.InboundHandlerConfigR\binbounds\"?\n" +
|
||||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x28, 0x0a, 0x14, 0x52, 0x65, 0x6d, 0x6f,
|
"\x15GetInboundUserRequest\x12\x10\n" +
|
||||||
0x76, 0x65, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
"\x03tag\x18\x01 \x01(\tR\x03tag\x12\x14\n" +
|
||||||
0x12, 0x10, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x74,
|
"\x05email\x18\x02 \x01(\tR\x05email\"J\n" +
|
||||||
0x61, 0x67, 0x22, 0x17, 0x0a, 0x15, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x49, 0x6e, 0x62, 0x6f,
|
"\x16GetInboundUserResponse\x120\n" +
|
||||||
0x75, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x67, 0x0a, 0x13, 0x41,
|
"\x05users\x18\x01 \x03(\v2\x1a.xray.common.protocol.UserR\x05users\"4\n" +
|
||||||
0x6c, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65,
|
"\x1cGetInboundUsersCountResponse\x12\x14\n" +
|
||||||
0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
"\x05count\x18\x01 \x01(\x03R\x05count\"R\n" +
|
||||||
0x03, 0x74, 0x61, 0x67, 0x12, 0x3e, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f,
|
"\x12AddOutboundRequest\x12<\n" +
|
||||||
0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63,
|
"\boutbound\x18\x01 \x01(\v2 .xray.core.OutboundHandlerConfigR\boutbound\"\x15\n" +
|
||||||
0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x2e, 0x54, 0x79, 0x70,
|
"\x13AddOutboundResponse\")\n" +
|
||||||
0x65, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61,
|
"\x15RemoveOutboundRequest\x12\x10\n" +
|
||||||
0x74, 0x69, 0x6f, 0x6e, 0x22, 0x16, 0x0a, 0x14, 0x41, 0x6c, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x62,
|
"\x03tag\x18\x01 \x01(\tR\x03tag\"\x18\n" +
|
||||||
0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x35, 0x0a, 0x13,
|
"\x16RemoveOutboundResponse\"h\n" +
|
||||||
0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x52, 0x65, 0x71, 0x75,
|
"\x14AlterOutboundRequest\x12\x10\n" +
|
||||||
0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x73, 0x4f, 0x6e, 0x6c, 0x79, 0x54, 0x61, 0x67,
|
"\x03tag\x18\x01 \x01(\tR\x03tag\x12>\n" +
|
||||||
0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 0x73, 0x4f, 0x6e, 0x6c, 0x79, 0x54,
|
"\toperation\x18\x02 \x01(\v2 .xray.common.serial.TypedMessageR\toperation\"\x17\n" +
|
||||||
0x61, 0x67, 0x73, 0x22, 0x53, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x62, 0x6f, 0x75,
|
"\x15AlterOutboundResponse\"\x16\n" +
|
||||||
0x6e, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x08, 0x69,
|
"\x14ListOutboundsRequest\"W\n" +
|
||||||
0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e,
|
"\x15ListOutboundsResponse\x12>\n" +
|
||||||
0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e,
|
"\toutbounds\x18\x01 \x03(\v2 .xray.core.OutboundHandlerConfigR\toutbounds\"\b\n" +
|
||||||
0x64, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x08,
|
"\x06Config2\xae\t\n" +
|
||||||
0x69, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x22, 0x3f, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x49,
|
"\x0eHandlerService\x12k\n" +
|
||||||
0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
"\n" +
|
||||||
0x74, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03,
|
"AddInbound\x12,.xray.app.proxyman.command.AddInboundRequest\x1a-.xray.app.proxyman.command.AddInboundResponse\"\x00\x12t\n" +
|
||||||
0x74, 0x61, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x02, 0x20, 0x01,
|
"\rRemoveInbound\x12/.xray.app.proxyman.command.RemoveInboundRequest\x1a0.xray.app.proxyman.command.RemoveInboundResponse\"\x00\x12q\n" +
|
||||||
0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x22, 0x4a, 0x0a, 0x16, 0x47, 0x65, 0x74,
|
"\fAlterInbound\x12..xray.app.proxyman.command.AlterInboundRequest\x1a/.xray.app.proxyman.command.AlterInboundResponse\"\x00\x12q\n" +
|
||||||
0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
"\fListInbounds\x12..xray.app.proxyman.command.ListInboundsRequest\x1a/.xray.app.proxyman.command.ListInboundsResponse\"\x00\x12x\n" +
|
||||||
0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03,
|
"\x0fGetInboundUsers\x120.xray.app.proxyman.command.GetInboundUserRequest\x1a1.xray.app.proxyman.command.GetInboundUserResponse\"\x00\x12\x83\x01\n" +
|
||||||
0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
|
"\x14GetInboundUsersCount\x120.xray.app.proxyman.command.GetInboundUserRequest\x1a7.xray.app.proxyman.command.GetInboundUsersCountResponse\"\x00\x12n\n" +
|
||||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x05,
|
"\vAddOutbound\x12-.xray.app.proxyman.command.AddOutboundRequest\x1a..xray.app.proxyman.command.AddOutboundResponse\"\x00\x12w\n" +
|
||||||
0x75, 0x73, 0x65, 0x72, 0x73, 0x22, 0x34, 0x0a, 0x1c, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x62, 0x6f,
|
"\x0eRemoveOutbound\x120.xray.app.proxyman.command.RemoveOutboundRequest\x1a1.xray.app.proxyman.command.RemoveOutboundResponse\"\x00\x12t\n" +
|
||||||
0x75, 0x6e, 0x64, 0x55, 0x73, 0x65, 0x72, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73,
|
"\rAlterOutbound\x12/.xray.app.proxyman.command.AlterOutboundRequest\x1a0.xray.app.proxyman.command.AlterOutboundResponse\"\x00\x12t\n" +
|
||||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01,
|
"\rListOutbounds\x12/.xray.app.proxyman.command.ListOutboundsRequest\x1a0.xray.app.proxyman.command.ListOutboundsResponse\"\x00Bm\n" +
|
||||||
0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x52, 0x0a, 0x12, 0x41,
|
"\x1dcom.xray.app.proxyman.commandP\x01Z.github.com/xtls/xray-core/app/proxyman/command\xaa\x02\x19Xray.App.Proxyman.Commandb\x06proto3"
|
||||||
0x64, 0x64, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
|
||||||
0x74, 0x12, 0x3c, 0x0a, 0x08, 0x6f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x01, 0x20,
|
|
||||||
0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e,
|
|
||||||
0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x43,
|
|
||||||
0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x08, 0x6f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x22,
|
|
||||||
0x15, 0x0a, 0x13, 0x41, 0x64, 0x64, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65,
|
|
||||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x29, 0x0a, 0x15, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65,
|
|
||||||
0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,
|
|
||||||
0x10, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x74, 0x61,
|
|
||||||
0x67, 0x22, 0x18, 0x0a, 0x16, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, 0x75, 0x74, 0x62, 0x6f,
|
|
||||||
0x75, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x68, 0x0a, 0x14, 0x41,
|
|
||||||
0x6c, 0x74, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75,
|
|
||||||
0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
|
||||||
0x52, 0x03, 0x74, 0x61, 0x67, 0x12, 0x3e, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69,
|
|
||||||
0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e,
|
|
||||||
0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x2e, 0x54, 0x79,
|
|
||||||
0x70, 0x65, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72,
|
|
||||||
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x17, 0x0a, 0x15, 0x41, 0x6c, 0x74, 0x65, 0x72, 0x4f, 0x75,
|
|
||||||
0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x16,
|
|
||||||
0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x52,
|
|
||||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x57, 0x0a, 0x15, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x75,
|
|
||||||
0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
|
|
||||||
0x3e, 0x0a, 0x09, 0x6f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03,
|
|
||||||
0x28, 0x0b, 0x32, 0x20, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x4f,
|
|
||||||
0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x43, 0x6f,
|
|
||||||
0x6e, 0x66, 0x69, 0x67, 0x52, 0x09, 0x6f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x22,
|
|
||||||
0x08, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x32, 0xae, 0x09, 0x0a, 0x0e, 0x48, 0x61,
|
|
||||||
0x6e, 0x64, 0x6c, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x6b, 0x0a, 0x0a,
|
|
||||||
0x41, 0x64, 0x64, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x2c, 0x2e, 0x78, 0x72, 0x61,
|
|
||||||
0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2e, 0x63,
|
|
||||||
0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x41, 0x64, 0x64, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e,
|
|
||||||
0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e,
|
|
||||||
0x61, 0x70, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2e, 0x63, 0x6f, 0x6d,
|
|
||||||
0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x41, 0x64, 0x64, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x52,
|
|
||||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x74, 0x0a, 0x0d, 0x52, 0x65, 0x6d,
|
|
||||||
0x6f, 0x76, 0x65, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x2f, 0x2e, 0x78, 0x72, 0x61,
|
|
||||||
0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2e, 0x63,
|
|
||||||
0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x49, 0x6e, 0x62,
|
|
||||||
0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x78, 0x72,
|
|
||||||
0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2e,
|
|
||||||
0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x49, 0x6e,
|
|
||||||
0x62, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12,
|
|
||||||
0x71, 0x0a, 0x0c, 0x41, 0x6c, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x12,
|
|
||||||
0x2e, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79,
|
|
||||||
0x6d, 0x61, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x41, 0x6c, 0x74, 0x65,
|
|
||||||
0x72, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
|
||||||
0x2f, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79,
|
|
||||||
0x6d, 0x61, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x41, 0x6c, 0x74, 0x65,
|
|
||||||
0x72, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
|
||||||
0x22, 0x00, 0x12, 0x71, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e,
|
|
||||||
0x64, 0x73, 0x12, 0x2e, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x72,
|
|
||||||
0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x4c,
|
|
||||||
0x69, 0x73, 0x74, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65,
|
|
||||||
0x73, 0x74, 0x1a, 0x2f, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x72,
|
|
||||||
0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x4c,
|
|
||||||
0x69, 0x73, 0x74, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
|
||||||
0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x78, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x62, 0x6f,
|
|
||||||
0x75, 0x6e, 0x64, 0x55, 0x73, 0x65, 0x72, 0x73, 0x12, 0x30, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e,
|
|
||||||
0x61, 0x70, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2e, 0x63, 0x6f, 0x6d,
|
|
||||||
0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x55,
|
|
||||||
0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x78, 0x72, 0x61,
|
|
||||||
0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2e, 0x63,
|
|
||||||
0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e,
|
|
||||||
0x64, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12,
|
|
||||||
0x83, 0x01, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x55, 0x73,
|
|
||||||
0x65, 0x72, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x30, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e,
|
|
||||||
0x61, 0x70, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2e, 0x63, 0x6f, 0x6d,
|
|
||||||
0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x55,
|
|
||||||
0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x37, 0x2e, 0x78, 0x72, 0x61,
|
|
||||||
0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2e, 0x63,
|
|
||||||
0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e,
|
|
||||||
0x64, 0x55, 0x73, 0x65, 0x72, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
|
||||||
0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x6e, 0x0a, 0x0b, 0x41, 0x64, 0x64, 0x4f, 0x75, 0x74, 0x62,
|
|
||||||
0x6f, 0x75, 0x6e, 0x64, 0x12, 0x2d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e,
|
|
||||||
0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64,
|
|
||||||
0x2e, 0x41, 0x64, 0x64, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75,
|
|
||||||
0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70,
|
|
||||||
0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e,
|
|
||||||
0x41, 0x64, 0x64, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
|
||||||
0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x77, 0x0a, 0x0e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f,
|
|
||||||
0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x30, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61,
|
|
||||||
0x70, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d,
|
|
||||||
0x61, 0x6e, 0x64, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75,
|
|
||||||
0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x78, 0x72, 0x61, 0x79,
|
|
||||||
0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2e, 0x63, 0x6f,
|
|
||||||
0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4f, 0x75, 0x74, 0x62,
|
|
||||||
0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x74,
|
|
||||||
0x0a, 0x0d, 0x41, 0x6c, 0x74, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x12,
|
|
||||||
0x2f, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79,
|
|
||||||
0x6d, 0x61, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x41, 0x6c, 0x74, 0x65,
|
|
||||||
0x72, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
|
||||||
0x1a, 0x30, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78,
|
|
||||||
0x79, 0x6d, 0x61, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x41, 0x6c, 0x74,
|
|
||||||
0x65, 0x72, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
|
||||||
0x73, 0x65, 0x22, 0x00, 0x12, 0x74, 0x0a, 0x0d, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x75, 0x74, 0x62,
|
|
||||||
0x6f, 0x75, 0x6e, 0x64, 0x73, 0x12, 0x2f, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70,
|
|
||||||
0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e,
|
|
||||||
0x64, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x52,
|
|
||||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70,
|
|
||||||
0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61,
|
|
||||||
0x6e, 0x64, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x73,
|
|
||||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x6d, 0x0a, 0x1d, 0x63, 0x6f,
|
|
||||||
0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79,
|
|
||||||
0x6d, 0x61, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x50, 0x01, 0x5a, 0x2e, 0x67,
|
|
||||||
0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x74, 0x6c, 0x73, 0x2f, 0x78,
|
|
||||||
0x72, 0x61, 0x79, 0x2d, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x70, 0x72, 0x6f,
|
|
||||||
0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0xaa, 0x02, 0x19,
|
|
||||||
0x58, 0x72, 0x61, 0x79, 0x2e, 0x41, 0x70, 0x70, 0x2e, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61,
|
|
||||||
0x6e, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
|
||||||
0x33,
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
file_app_proxyman_command_command_proto_rawDescOnce sync.Once
|
file_app_proxyman_command_command_proto_rawDescOnce sync.Once
|
||||||
file_app_proxyman_command_command_proto_rawDescData = file_app_proxyman_command_command_proto_rawDesc
|
file_app_proxyman_command_command_proto_rawDescData []byte
|
||||||
)
|
)
|
||||||
|
|
||||||
func file_app_proxyman_command_command_proto_rawDescGZIP() []byte {
|
func file_app_proxyman_command_command_proto_rawDescGZIP() []byte {
|
||||||
file_app_proxyman_command_command_proto_rawDescOnce.Do(func() {
|
file_app_proxyman_command_command_proto_rawDescOnce.Do(func() {
|
||||||
file_app_proxyman_command_command_proto_rawDescData = protoimpl.X.CompressGZIP(file_app_proxyman_command_command_proto_rawDescData)
|
file_app_proxyman_command_command_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_app_proxyman_command_command_proto_rawDesc), len(file_app_proxyman_command_command_proto_rawDesc)))
|
||||||
})
|
})
|
||||||
return file_app_proxyman_command_command_proto_rawDescData
|
return file_app_proxyman_command_command_proto_rawDescData
|
||||||
}
|
}
|
||||||
@@ -1222,7 +1098,7 @@ func file_app_proxyman_command_command_proto_init() {
|
|||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_app_proxyman_command_command_proto_rawDesc,
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_app_proxyman_command_command_proto_rawDesc), len(file_app_proxyman_command_command_proto_rawDesc)),
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 22,
|
NumMessages: 22,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
@@ -1233,7 +1109,6 @@ func file_app_proxyman_command_command_proto_init() {
|
|||||||
MessageInfos: file_app_proxyman_command_command_proto_msgTypes,
|
MessageInfos: file_app_proxyman_command_command_proto_msgTypes,
|
||||||
}.Build()
|
}.Build()
|
||||||
File_app_proxyman_command_command_proto = out.File
|
File_app_proxyman_command_command_proto = out.File
|
||||||
file_app_proxyman_command_command_proto_rawDesc = nil
|
|
||||||
file_app_proxyman_command_command_proto_goTypes = nil
|
file_app_proxyman_command_command_proto_goTypes = nil
|
||||||
file_app_proxyman_command_command_proto_depIdxs = nil
|
file_app_proxyman_command_command_proto_depIdxs = nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// 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.6.0
|
||||||
// - protoc v5.28.2
|
// - protoc v6.33.5
|
||||||
// source: app/proxyman/command/command.proto
|
// source: app/proxyman/command/command.proto
|
||||||
|
|
||||||
package command
|
package command
|
||||||
@@ -180,34 +180,34 @@ type HandlerServiceServer interface {
|
|||||||
type UnimplementedHandlerServiceServer struct{}
|
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.Error(codes.Unimplemented, "method AddInbound not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedHandlerServiceServer) RemoveInbound(context.Context, *RemoveInboundRequest) (*RemoveInboundResponse, error) {
|
func (UnimplementedHandlerServiceServer) RemoveInbound(context.Context, *RemoveInboundRequest) (*RemoveInboundResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method RemoveInbound not implemented")
|
return nil, status.Error(codes.Unimplemented, "method RemoveInbound not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedHandlerServiceServer) AlterInbound(context.Context, *AlterInboundRequest) (*AlterInboundResponse, error) {
|
func (UnimplementedHandlerServiceServer) AlterInbound(context.Context, *AlterInboundRequest) (*AlterInboundResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method AlterInbound not implemented")
|
return nil, status.Error(codes.Unimplemented, "method AlterInbound not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedHandlerServiceServer) ListInbounds(context.Context, *ListInboundsRequest) (*ListInboundsResponse, error) {
|
func (UnimplementedHandlerServiceServer) ListInbounds(context.Context, *ListInboundsRequest) (*ListInboundsResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method ListInbounds not implemented")
|
return nil, status.Error(codes.Unimplemented, "method ListInbounds not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedHandlerServiceServer) GetInboundUsers(context.Context, *GetInboundUserRequest) (*GetInboundUserResponse, error) {
|
func (UnimplementedHandlerServiceServer) GetInboundUsers(context.Context, *GetInboundUserRequest) (*GetInboundUserResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method GetInboundUsers not implemented")
|
return nil, status.Error(codes.Unimplemented, "method GetInboundUsers not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedHandlerServiceServer) GetInboundUsersCount(context.Context, *GetInboundUserRequest) (*GetInboundUsersCountResponse, error) {
|
func (UnimplementedHandlerServiceServer) GetInboundUsersCount(context.Context, *GetInboundUserRequest) (*GetInboundUsersCountResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method GetInboundUsersCount not implemented")
|
return nil, status.Error(codes.Unimplemented, "method GetInboundUsersCount not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedHandlerServiceServer) AddOutbound(context.Context, *AddOutboundRequest) (*AddOutboundResponse, error) {
|
func (UnimplementedHandlerServiceServer) AddOutbound(context.Context, *AddOutboundRequest) (*AddOutboundResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method AddOutbound not implemented")
|
return nil, status.Error(codes.Unimplemented, "method AddOutbound not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedHandlerServiceServer) RemoveOutbound(context.Context, *RemoveOutboundRequest) (*RemoveOutboundResponse, error) {
|
func (UnimplementedHandlerServiceServer) RemoveOutbound(context.Context, *RemoveOutboundRequest) (*RemoveOutboundResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method RemoveOutbound not implemented")
|
return nil, status.Error(codes.Unimplemented, "method RemoveOutbound not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedHandlerServiceServer) AlterOutbound(context.Context, *AlterOutboundRequest) (*AlterOutboundResponse, error) {
|
func (UnimplementedHandlerServiceServer) AlterOutbound(context.Context, *AlterOutboundRequest) (*AlterOutboundResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method AlterOutbound not implemented")
|
return nil, status.Error(codes.Unimplemented, "method AlterOutbound not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedHandlerServiceServer) ListOutbounds(context.Context, *ListOutboundsRequest) (*ListOutboundsResponse, error) {
|
func (UnimplementedHandlerServiceServer) ListOutbounds(context.Context, *ListOutboundsRequest) (*ListOutboundsResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method ListOutbounds not implemented")
|
return nil, status.Error(codes.Unimplemented, "method ListOutbounds not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedHandlerServiceServer) mustEmbedUnimplementedHandlerServiceServer() {}
|
func (UnimplementedHandlerServiceServer) mustEmbedUnimplementedHandlerServiceServer() {}
|
||||||
func (UnimplementedHandlerServiceServer) testEmbeddedByValue() {}
|
func (UnimplementedHandlerServiceServer) testEmbeddedByValue() {}
|
||||||
@@ -220,7 +220,7 @@ 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
|
// If the following call panics, it indicates UnimplementedHandlerServiceServer was
|
||||||
// embedded by pointer and is nil. This will cause panics if an
|
// embedded by pointer and is nil. This will cause panics if an
|
||||||
// unimplemented method is ever invoked, so we test this at initialization
|
// unimplemented method is ever invoked, so we test this at initialization
|
||||||
// time to prevent it from happening at runtime later due to I/O.
|
// time to prevent it from happening at runtime later due to I/O.
|
||||||
|
|||||||
+65
-140
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.35.1
|
// protoc-gen-go v1.36.11
|
||||||
// protoc v5.28.2
|
// protoc v6.33.5
|
||||||
// source: app/proxyman/config.proto
|
// source: app/proxyman/config.proto
|
||||||
|
|
||||||
package proxyman
|
package proxyman
|
||||||
@@ -14,6 +14,7 @@ import (
|
|||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
sync "sync"
|
sync "sync"
|
||||||
|
unsafe "unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -24,9 +25,9 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type InboundConfig struct {
|
type InboundConfig struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *InboundConfig) Reset() {
|
func (x *InboundConfig) Reset() {
|
||||||
@@ -60,10 +61,7 @@ func (*InboundConfig) Descriptor() ([]byte, []int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type SniffingConfig struct {
|
type SniffingConfig struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
// Whether or not to enable content sniffing on an inbound connection.
|
// Whether or not to enable content sniffing on an inbound connection.
|
||||||
Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"`
|
Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"`
|
||||||
// Override target destination if sniff'ed protocol is in the given list.
|
// Override target destination if sniff'ed protocol is in the given list.
|
||||||
@@ -73,8 +71,10 @@ type SniffingConfig struct {
|
|||||||
// Whether should only try to sniff metadata without waiting for client input.
|
// Whether should only try to sniff metadata without waiting for client input.
|
||||||
// Can be used to support SMTP like protocol where server send the first
|
// Can be used to support SMTP like protocol where server send the first
|
||||||
// message.
|
// message.
|
||||||
MetadataOnly bool `protobuf:"varint,4,opt,name=metadata_only,json=metadataOnly,proto3" json:"metadata_only,omitempty"`
|
MetadataOnly bool `protobuf:"varint,4,opt,name=metadata_only,json=metadataOnly,proto3" json:"metadata_only,omitempty"`
|
||||||
RouteOnly bool `protobuf:"varint,5,opt,name=route_only,json=routeOnly,proto3" json:"route_only,omitempty"`
|
RouteOnly bool `protobuf:"varint,5,opt,name=route_only,json=routeOnly,proto3" json:"route_only,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *SniffingConfig) Reset() {
|
func (x *SniffingConfig) Reset() {
|
||||||
@@ -143,10 +143,7 @@ func (x *SniffingConfig) GetRouteOnly() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ReceiverConfig struct {
|
type ReceiverConfig struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
// PortList specifies the ports which the Receiver should listen on.
|
// PortList specifies the ports which the Receiver should listen on.
|
||||||
PortList *net.PortList `protobuf:"bytes,1,opt,name=port_list,json=portList,proto3" json:"port_list,omitempty"`
|
PortList *net.PortList `protobuf:"bytes,1,opt,name=port_list,json=portList,proto3" json:"port_list,omitempty"`
|
||||||
// Listen specifies the IP address that the Receiver should listen on.
|
// Listen specifies the IP address that the Receiver should listen on.
|
||||||
@@ -154,6 +151,8 @@ type ReceiverConfig struct {
|
|||||||
StreamSettings *internet.StreamConfig `protobuf:"bytes,3,opt,name=stream_settings,json=streamSettings,proto3" json:"stream_settings,omitempty"`
|
StreamSettings *internet.StreamConfig `protobuf:"bytes,3,opt,name=stream_settings,json=streamSettings,proto3" json:"stream_settings,omitempty"`
|
||||||
ReceiveOriginalDestination bool `protobuf:"varint,4,opt,name=receive_original_destination,json=receiveOriginalDestination,proto3" json:"receive_original_destination,omitempty"`
|
ReceiveOriginalDestination bool `protobuf:"varint,4,opt,name=receive_original_destination,json=receiveOriginalDestination,proto3" json:"receive_original_destination,omitempty"`
|
||||||
SniffingSettings *SniffingConfig `protobuf:"bytes,6,opt,name=sniffing_settings,json=sniffingSettings,proto3" json:"sniffing_settings,omitempty"`
|
SniffingSettings *SniffingConfig `protobuf:"bytes,6,opt,name=sniffing_settings,json=sniffingSettings,proto3" json:"sniffing_settings,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ReceiverConfig) Reset() {
|
func (x *ReceiverConfig) Reset() {
|
||||||
@@ -222,13 +221,12 @@ func (x *ReceiverConfig) GetSniffingSettings() *SniffingConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type InboundHandlerConfig struct {
|
type InboundHandlerConfig struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Tag string `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
ReceiverSettings *serial.TypedMessage `protobuf:"bytes,2,opt,name=receiver_settings,json=receiverSettings,proto3" json:"receiver_settings,omitempty"`
|
||||||
|
ProxySettings *serial.TypedMessage `protobuf:"bytes,3,opt,name=proxy_settings,json=proxySettings,proto3" json:"proxy_settings,omitempty"`
|
||||||
Tag string `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"`
|
unknownFields protoimpl.UnknownFields
|
||||||
ReceiverSettings *serial.TypedMessage `protobuf:"bytes,2,opt,name=receiver_settings,json=receiverSettings,proto3" json:"receiver_settings,omitempty"`
|
sizeCache protoimpl.SizeCache
|
||||||
ProxySettings *serial.TypedMessage `protobuf:"bytes,3,opt,name=proxy_settings,json=proxySettings,proto3" json:"proxy_settings,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *InboundHandlerConfig) Reset() {
|
func (x *InboundHandlerConfig) Reset() {
|
||||||
@@ -283,9 +281,9 @@ func (x *InboundHandlerConfig) GetProxySettings() *serial.TypedMessage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type OutboundConfig struct {
|
type OutboundConfig struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *OutboundConfig) Reset() {
|
func (x *OutboundConfig) Reset() {
|
||||||
@@ -319,10 +317,7 @@ func (*OutboundConfig) Descriptor() ([]byte, []int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type SenderConfig struct {
|
type SenderConfig struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
// Send traffic through the given IP. Only IP is allowed.
|
// Send traffic through the given IP. Only IP is allowed.
|
||||||
Via *net.IPOrDomain `protobuf:"bytes,1,opt,name=via,proto3" json:"via,omitempty"`
|
Via *net.IPOrDomain `protobuf:"bytes,1,opt,name=via,proto3" json:"via,omitempty"`
|
||||||
StreamSettings *internet.StreamConfig `protobuf:"bytes,2,opt,name=stream_settings,json=streamSettings,proto3" json:"stream_settings,omitempty"`
|
StreamSettings *internet.StreamConfig `protobuf:"bytes,2,opt,name=stream_settings,json=streamSettings,proto3" json:"stream_settings,omitempty"`
|
||||||
@@ -330,6 +325,8 @@ type SenderConfig struct {
|
|||||||
MultiplexSettings *MultiplexingConfig `protobuf:"bytes,4,opt,name=multiplex_settings,json=multiplexSettings,proto3" json:"multiplex_settings,omitempty"`
|
MultiplexSettings *MultiplexingConfig `protobuf:"bytes,4,opt,name=multiplex_settings,json=multiplexSettings,proto3" json:"multiplex_settings,omitempty"`
|
||||||
ViaCidr string `protobuf:"bytes,5,opt,name=via_cidr,json=viaCidr,proto3" json:"via_cidr,omitempty"`
|
ViaCidr string `protobuf:"bytes,5,opt,name=via_cidr,json=viaCidr,proto3" json:"via_cidr,omitempty"`
|
||||||
TargetStrategy internet.DomainStrategy `protobuf:"varint,6,opt,name=target_strategy,json=targetStrategy,proto3,enum=xray.transport.internet.DomainStrategy" json:"target_strategy,omitempty"`
|
TargetStrategy internet.DomainStrategy `protobuf:"varint,6,opt,name=target_strategy,json=targetStrategy,proto3,enum=xray.transport.internet.DomainStrategy" json:"target_strategy,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *SenderConfig) Reset() {
|
func (x *SenderConfig) Reset() {
|
||||||
@@ -405,10 +402,7 @@ func (x *SenderConfig) GetTargetStrategy() internet.DomainStrategy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type MultiplexingConfig struct {
|
type MultiplexingConfig struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
// Whether or not Mux is enabled.
|
// Whether or not Mux is enabled.
|
||||||
Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"`
|
Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"`
|
||||||
// Max number of concurrent connections that one Mux connection can handle.
|
// Max number of concurrent connections that one Mux connection can handle.
|
||||||
@@ -417,6 +411,8 @@ type MultiplexingConfig struct {
|
|||||||
XudpConcurrency int32 `protobuf:"varint,3,opt,name=xudpConcurrency,proto3" json:"xudpConcurrency,omitempty"`
|
XudpConcurrency int32 `protobuf:"varint,3,opt,name=xudpConcurrency,proto3" json:"xudpConcurrency,omitempty"`
|
||||||
// "reject" (default), "allow" or "skip".
|
// "reject" (default), "allow" or "skip".
|
||||||
XudpProxyUDP443 string `protobuf:"bytes,4,opt,name=xudpProxyUDP443,proto3" json:"xudpProxyUDP443,omitempty"`
|
XudpProxyUDP443 string `protobuf:"bytes,4,opt,name=xudpProxyUDP443,proto3" json:"xudpProxyUDP443,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *MultiplexingConfig) Reset() {
|
func (x *MultiplexingConfig) Reset() {
|
||||||
@@ -479,120 +475,50 @@ func (x *MultiplexingConfig) GetXudpProxyUDP443() string {
|
|||||||
|
|
||||||
var File_app_proxyman_config_proto protoreflect.FileDescriptor
|
var File_app_proxyman_config_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_app_proxyman_config_proto_rawDesc = []byte{
|
const file_app_proxyman_config_proto_rawDesc = "" +
|
||||||
0x0a, 0x19, 0x61, 0x70, 0x70, 0x2f, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2f, 0x63,
|
"\n" +
|
||||||
0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x11, 0x78, 0x72, 0x61,
|
"\x19app/proxyman/config.proto\x12\x11xray.app.proxyman\x1a\x18common/net/address.proto\x1a\x15common/net/port.proto\x1a\x1ftransport/internet/config.proto\x1a!common/serial/typed_message.proto\"\x0f\n" +
|
||||||
0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x1a, 0x18,
|
"\rInboundConfig\"\xcc\x01\n" +
|
||||||
0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x6e, 0x65, 0x74, 0x2f, 0x61, 0x64, 0x64, 0x72, 0x65,
|
"\x0eSniffingConfig\x12\x18\n" +
|
||||||
0x73, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x15, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
|
"\aenabled\x18\x01 \x01(\bR\aenabled\x121\n" +
|
||||||
0x2f, 0x6e, 0x65, 0x74, 0x2f, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a,
|
"\x14destination_override\x18\x02 \x03(\tR\x13destinationOverride\x12)\n" +
|
||||||
0x1f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72,
|
"\x10domains_excluded\x18\x03 \x03(\tR\x0fdomainsExcluded\x12#\n" +
|
||||||
0x6e, 0x65, 0x74, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
"\rmetadata_only\x18\x04 \x01(\bR\fmetadataOnly\x12\x1d\n" +
|
||||||
0x1a, 0x21, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x2f,
|
"\n" +
|
||||||
0x74, 0x79, 0x70, 0x65, 0x64, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72,
|
"route_only\x18\x05 \x01(\bR\trouteOnly\"\xe5\x02\n" +
|
||||||
0x6f, 0x74, 0x6f, 0x22, 0x0f, 0x0a, 0x0d, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x43, 0x6f,
|
"\x0eReceiverConfig\x126\n" +
|
||||||
0x6e, 0x66, 0x69, 0x67, 0x22, 0xcc, 0x01, 0x0a, 0x0e, 0x53, 0x6e, 0x69, 0x66, 0x66, 0x69, 0x6e,
|
"\tport_list\x18\x01 \x01(\v2\x19.xray.common.net.PortListR\bportList\x123\n" +
|
||||||
0x67, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c,
|
"\x06listen\x18\x02 \x01(\v2\x1b.xray.common.net.IPOrDomainR\x06listen\x12N\n" +
|
||||||
0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65,
|
"\x0fstream_settings\x18\x03 \x01(\v2%.xray.transport.internet.StreamConfigR\x0estreamSettings\x12@\n" +
|
||||||
0x64, 0x12, 0x31, 0x0a, 0x14, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e,
|
"\x1creceive_original_destination\x18\x04 \x01(\bR\x1areceiveOriginalDestination\x12N\n" +
|
||||||
0x5f, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52,
|
"\x11sniffing_settings\x18\x06 \x01(\v2!.xray.app.proxyman.SniffingConfigR\x10sniffingSettingsJ\x04\b\x05\x10\x06\"\xc0\x01\n" +
|
||||||
0x13, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x76, 0x65, 0x72,
|
"\x14InboundHandlerConfig\x12\x10\n" +
|
||||||
0x72, 0x69, 0x64, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x73, 0x5f,
|
"\x03tag\x18\x01 \x01(\tR\x03tag\x12M\n" +
|
||||||
0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x64, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f,
|
"\x11receiver_settings\x18\x02 \x01(\v2 .xray.common.serial.TypedMessageR\x10receiverSettings\x12G\n" +
|
||||||
0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x73, 0x45, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x64, 0x12,
|
"\x0eproxy_settings\x18\x03 \x01(\v2 .xray.common.serial.TypedMessageR\rproxySettings\"\x10\n" +
|
||||||
0x23, 0x0a, 0x0d, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x6f, 0x6e, 0x6c, 0x79,
|
"\x0eOutboundConfig\"\x9d\x03\n" +
|
||||||
0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61,
|
"\fSenderConfig\x12-\n" +
|
||||||
0x4f, 0x6e, 0x6c, 0x79, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x5f, 0x6f, 0x6e,
|
"\x03via\x18\x01 \x01(\v2\x1b.xray.common.net.IPOrDomainR\x03via\x12N\n" +
|
||||||
0x6c, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x4f,
|
"\x0fstream_settings\x18\x02 \x01(\v2%.xray.transport.internet.StreamConfigR\x0estreamSettings\x12K\n" +
|
||||||
0x6e, 0x6c, 0x79, 0x22, 0xe5, 0x02, 0x0a, 0x0e, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72,
|
"\x0eproxy_settings\x18\x03 \x01(\v2$.xray.transport.internet.ProxyConfigR\rproxySettings\x12T\n" +
|
||||||
0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x36, 0x0a, 0x09, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x6c,
|
"\x12multiplex_settings\x18\x04 \x01(\v2%.xray.app.proxyman.MultiplexingConfigR\x11multiplexSettings\x12\x19\n" +
|
||||||
0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x78, 0x72, 0x61, 0x79,
|
"\bvia_cidr\x18\x05 \x01(\tR\aviaCidr\x12P\n" +
|
||||||
0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x2e, 0x50, 0x6f, 0x72, 0x74,
|
"\x0ftarget_strategy\x18\x06 \x01(\x0e2'.xray.transport.internet.DomainStrategyR\x0etargetStrategy\"\xa4\x01\n" +
|
||||||
0x4c, 0x69, 0x73, 0x74, 0x52, 0x08, 0x70, 0x6f, 0x72, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x33,
|
"\x12MultiplexingConfig\x12\x18\n" +
|
||||||
0x0a, 0x06, 0x6c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b,
|
"\aenabled\x18\x01 \x01(\bR\aenabled\x12 \n" +
|
||||||
0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6e, 0x65, 0x74,
|
"\vconcurrency\x18\x02 \x01(\x05R\vconcurrency\x12(\n" +
|
||||||
0x2e, 0x49, 0x50, 0x4f, 0x72, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x52, 0x06, 0x6c, 0x69, 0x73,
|
"\x0fxudpConcurrency\x18\x03 \x01(\x05R\x0fxudpConcurrency\x12(\n" +
|
||||||
0x74, 0x65, 0x6e, 0x12, 0x4e, 0x0a, 0x0f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5f, 0x73, 0x65,
|
"\x0fxudpProxyUDP443\x18\x04 \x01(\tR\x0fxudpProxyUDP443BU\n" +
|
||||||
0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x78,
|
"\x15com.xray.app.proxymanP\x01Z&github.com/xtls/xray-core/app/proxyman\xaa\x02\x11Xray.App.Proxymanb\x06proto3"
|
||||||
0x72, 0x61, 0x79, 0x2e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x69, 0x6e,
|
|
||||||
0x74, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x43, 0x6f, 0x6e,
|
|
||||||
0x66, 0x69, 0x67, 0x52, 0x0e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x53, 0x65, 0x74, 0x74, 0x69,
|
|
||||||
0x6e, 0x67, 0x73, 0x12, 0x40, 0x0a, 0x1c, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x5f, 0x6f,
|
|
||||||
0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x5f, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74,
|
|
||||||
0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x1a, 0x72, 0x65, 0x63, 0x65, 0x69,
|
|
||||||
0x76, 0x65, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x44, 0x65, 0x73, 0x74, 0x69, 0x6e,
|
|
||||||
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x4e, 0x0a, 0x11, 0x73, 0x6e, 0x69, 0x66, 0x66, 0x69, 0x6e,
|
|
||||||
0x67, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b,
|
|
||||||
0x32, 0x21, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78,
|
|
||||||
0x79, 0x6d, 0x61, 0x6e, 0x2e, 0x53, 0x6e, 0x69, 0x66, 0x66, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6e,
|
|
||||||
0x66, 0x69, 0x67, 0x52, 0x10, 0x73, 0x6e, 0x69, 0x66, 0x66, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x74,
|
|
||||||
0x74, 0x69, 0x6e, 0x67, 0x73, 0x4a, 0x04, 0x08, 0x05, 0x10, 0x06, 0x22, 0xc0, 0x01, 0x0a, 0x14,
|
|
||||||
0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x43, 0x6f,
|
|
||||||
0x6e, 0x66, 0x69, 0x67, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28,
|
|
||||||
0x09, 0x52, 0x03, 0x74, 0x61, 0x67, 0x12, 0x4d, 0x0a, 0x11, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76,
|
|
||||||
0x65, 0x72, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28,
|
|
||||||
0x0b, 0x32, 0x20, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e,
|
|
||||||
0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x64, 0x4d, 0x65, 0x73, 0x73,
|
|
||||||
0x61, 0x67, 0x65, 0x52, 0x10, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x53, 0x65, 0x74,
|
|
||||||
0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x47, 0x0a, 0x0e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x5f, 0x73,
|
|
||||||
0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e,
|
|
||||||
0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x73, 0x65, 0x72, 0x69,
|
|
||||||
0x61, 0x6c, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52,
|
|
||||||
0x0d, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x22, 0x10,
|
|
||||||
0x0a, 0x0e, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67,
|
|
||||||
0x22, 0x9d, 0x03, 0x0a, 0x0c, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69,
|
|
||||||
0x67, 0x12, 0x2d, 0x0a, 0x03, 0x76, 0x69, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b,
|
|
||||||
0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6e, 0x65, 0x74,
|
|
||||||
0x2e, 0x49, 0x50, 0x4f, 0x72, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x52, 0x03, 0x76, 0x69, 0x61,
|
|
||||||
0x12, 0x4e, 0x0a, 0x0f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69,
|
|
||||||
0x6e, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x78, 0x72, 0x61, 0x79,
|
|
||||||
0x2e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72,
|
|
||||||
0x6e, 0x65, 0x74, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67,
|
|
||||||
0x52, 0x0e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73,
|
|
||||||
0x12, 0x4b, 0x0a, 0x0e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e,
|
|
||||||
0x67, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e,
|
|
||||||
0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e,
|
|
||||||
0x65, 0x74, 0x2e, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0d,
|
|
||||||
0x70, 0x72, 0x6f, 0x78, 0x79, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x54, 0x0a,
|
|
||||||
0x12, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x78, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69,
|
|
||||||
0x6e, 0x67, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x78, 0x72, 0x61, 0x79,
|
|
||||||
0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2e, 0x4d, 0x75,
|
|
||||||
0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x78, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67,
|
|
||||||
0x52, 0x11, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x78, 0x53, 0x65, 0x74, 0x74, 0x69,
|
|
||||||
0x6e, 0x67, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x76, 0x69, 0x61, 0x5f, 0x63, 0x69, 0x64, 0x72, 0x18,
|
|
||||||
0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x69, 0x61, 0x43, 0x69, 0x64, 0x72, 0x12, 0x50,
|
|
||||||
0x0a, 0x0f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67,
|
|
||||||
0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x27, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x74,
|
|
||||||
0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x65,
|
|
||||||
0x74, 0x2e, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79,
|
|
||||||
0x52, 0x0e, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79,
|
|
||||||
0x22, 0xa4, 0x01, 0x0a, 0x12, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x78, 0x69, 0x6e,
|
|
||||||
0x67, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c,
|
|
||||||
0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65,
|
|
||||||
0x64, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x6f, 0x6e, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79,
|
|
||||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x63, 0x75, 0x72, 0x72, 0x65,
|
|
||||||
0x6e, 0x63, 0x79, 0x12, 0x28, 0x0a, 0x0f, 0x78, 0x75, 0x64, 0x70, 0x43, 0x6f, 0x6e, 0x63, 0x75,
|
|
||||||
0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0f, 0x78, 0x75,
|
|
||||||
0x64, 0x70, 0x43, 0x6f, 0x6e, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x12, 0x28, 0x0a,
|
|
||||||
0x0f, 0x78, 0x75, 0x64, 0x70, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x55, 0x44, 0x50, 0x34, 0x34, 0x33,
|
|
||||||
0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x78, 0x75, 0x64, 0x70, 0x50, 0x72, 0x6f, 0x78,
|
|
||||||
0x79, 0x55, 0x44, 0x50, 0x34, 0x34, 0x33, 0x42, 0x55, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x2e, 0x78,
|
|
||||||
0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e,
|
|
||||||
0x50, 0x01, 0x5a, 0x26, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78,
|
|
||||||
0x74, 0x6c, 0x73, 0x2f, 0x78, 0x72, 0x61, 0x79, 0x2d, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x61, 0x70,
|
|
||||||
0x70, 0x2f, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0xaa, 0x02, 0x11, 0x58, 0x72, 0x61,
|
|
||||||
0x79, 0x2e, 0x41, 0x70, 0x70, 0x2e, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x62, 0x06,
|
|
||||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
file_app_proxyman_config_proto_rawDescOnce sync.Once
|
file_app_proxyman_config_proto_rawDescOnce sync.Once
|
||||||
file_app_proxyman_config_proto_rawDescData = file_app_proxyman_config_proto_rawDesc
|
file_app_proxyman_config_proto_rawDescData []byte
|
||||||
)
|
)
|
||||||
|
|
||||||
func file_app_proxyman_config_proto_rawDescGZIP() []byte {
|
func file_app_proxyman_config_proto_rawDescGZIP() []byte {
|
||||||
file_app_proxyman_config_proto_rawDescOnce.Do(func() {
|
file_app_proxyman_config_proto_rawDescOnce.Do(func() {
|
||||||
file_app_proxyman_config_proto_rawDescData = protoimpl.X.CompressGZIP(file_app_proxyman_config_proto_rawDescData)
|
file_app_proxyman_config_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_app_proxyman_config_proto_rawDesc), len(file_app_proxyman_config_proto_rawDesc)))
|
||||||
})
|
})
|
||||||
return file_app_proxyman_config_proto_rawDescData
|
return file_app_proxyman_config_proto_rawDescData
|
||||||
}
|
}
|
||||||
@@ -641,7 +567,7 @@ func file_app_proxyman_config_proto_init() {
|
|||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_app_proxyman_config_proto_rawDesc,
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_app_proxyman_config_proto_rawDesc), len(file_app_proxyman_config_proto_rawDesc)),
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 7,
|
NumMessages: 7,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
@@ -652,7 +578,6 @@ func file_app_proxyman_config_proto_init() {
|
|||||||
MessageInfos: file_app_proxyman_config_proto_msgTypes,
|
MessageInfos: file_app_proxyman_config_proto_msgTypes,
|
||||||
}.Build()
|
}.Build()
|
||||||
File_app_proxyman_config_proto = out.File
|
File_app_proxyman_config_proto = out.File
|
||||||
file_app_proxyman_config_proto_rawDesc = nil
|
|
||||||
file_app_proxyman_config_proto_goTypes = nil
|
file_app_proxyman_config_proto_goTypes = nil
|
||||||
file_app_proxyman_config_proto_depIdxs = nil
|
file_app_proxyman_config_proto_depIdxs = nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import (
|
|||||||
"github.com/xtls/xray-core/common/mux"
|
"github.com/xtls/xray-core/common/mux"
|
||||||
"github.com/xtls/xray-core/common/net"
|
"github.com/xtls/xray-core/common/net"
|
||||||
"github.com/xtls/xray-core/common/serial"
|
"github.com/xtls/xray-core/common/serial"
|
||||||
|
"github.com/xtls/xray-core/common/session"
|
||||||
"github.com/xtls/xray-core/core"
|
"github.com/xtls/xray-core/core"
|
||||||
"github.com/xtls/xray-core/features/policy"
|
"github.com/xtls/xray-core/features/policy"
|
||||||
"github.com/xtls/xray-core/features/stats"
|
"github.com/xtls/xray-core/features/stats"
|
||||||
@@ -52,6 +53,20 @@ type AlwaysOnInboundHandler struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewAlwaysOnInboundHandler(ctx context.Context, tag string, receiverConfig *proxyman.ReceiverConfig, proxyConfig interface{}) (*AlwaysOnInboundHandler, error) {
|
func NewAlwaysOnInboundHandler(ctx context.Context, tag string, receiverConfig *proxyman.ReceiverConfig, proxyConfig interface{}) (*AlwaysOnInboundHandler, error) {
|
||||||
|
// Set tag and sniffing config in context before creating proxy
|
||||||
|
// This allows proxies like TUN to access these settings
|
||||||
|
ctx = session.ContextWithInbound(ctx, &session.Inbound{Tag: tag})
|
||||||
|
if receiverConfig.SniffingSettings != nil {
|
||||||
|
ctx = session.ContextWithContent(ctx, &session.Content{
|
||||||
|
SniffingRequest: session.SniffingRequest{
|
||||||
|
Enabled: receiverConfig.SniffingSettings.Enabled,
|
||||||
|
OverrideDestinationForProtocol: receiverConfig.SniffingSettings.DestinationOverride,
|
||||||
|
ExcludeForDomain: receiverConfig.SniffingSettings.DomainsExcluded,
|
||||||
|
MetadataOnly: receiverConfig.SniffingSettings.MetadataOnly,
|
||||||
|
RouteOnly: receiverConfig.SniffingSettings.RouteOnly,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
rawProxy, err := common.CreateObject(ctx, proxyConfig)
|
rawProxy, err := common.CreateObject(ctx, proxyConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ import (
|
|||||||
"github.com/xtls/xray-core/features/routing"
|
"github.com/xtls/xray-core/features/routing"
|
||||||
"github.com/xtls/xray-core/features/stats"
|
"github.com/xtls/xray-core/features/stats"
|
||||||
"github.com/xtls/xray-core/proxy"
|
"github.com/xtls/xray-core/proxy"
|
||||||
|
"github.com/xtls/xray-core/proxy/hysteria/account"
|
||||||
|
hyCtx "github.com/xtls/xray-core/proxy/hysteria/ctx"
|
||||||
"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/tcp"
|
"github.com/xtls/xray-core/transport/internet/tcp"
|
||||||
@@ -138,6 +140,13 @@ func (w *tcpWorker) Proxy() proxy.Inbound {
|
|||||||
|
|
||||||
func (w *tcpWorker) Start() error {
|
func (w *tcpWorker) Start() error {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
|
type HysteriaInboundValidator interface{ HysteriaInboundValidator() *account.Validator }
|
||||||
|
if v, ok := w.proxy.(HysteriaInboundValidator); ok {
|
||||||
|
ctx = hyCtx.ContextWithRequireDatagram(ctx, true)
|
||||||
|
ctx = hyCtx.ContextWithValidator(ctx, v.HysteriaInboundValidator())
|
||||||
|
}
|
||||||
|
|
||||||
hub, err := internet.ListenTCP(ctx, w.address, w.port, w.stream, func(conn stat.Connection) {
|
hub, err := internet.ListenTCP(ctx, w.address, w.port, w.stream, func(conn stat.Connection) {
|
||||||
go w.callback(conn)
|
go w.callback(conn)
|
||||||
})
|
})
|
||||||
|
|||||||
+42
-61
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.35.1
|
// protoc-gen-go v1.36.11
|
||||||
// protoc v5.28.2
|
// protoc v6.33.5
|
||||||
// source: app/reverse/config.proto
|
// source: app/reverse/config.proto
|
||||||
|
|
||||||
package reverse
|
package reverse
|
||||||
@@ -11,6 +11,7 @@ import (
|
|||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
sync "sync"
|
sync "sync"
|
||||||
|
unsafe "unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -67,12 +68,11 @@ func (Control_State) EnumDescriptor() ([]byte, []int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Control struct {
|
type Control struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
State Control_State `protobuf:"varint,1,opt,name=state,proto3,enum=xray.app.reverse.Control_State" json:"state,omitempty"`
|
||||||
|
Random []byte `protobuf:"bytes,99,opt,name=random,proto3" json:"random,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
State Control_State `protobuf:"varint,1,opt,name=state,proto3,enum=xray.app.reverse.Control_State" json:"state,omitempty"`
|
|
||||||
Random []byte `protobuf:"bytes,99,opt,name=random,proto3" json:"random,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Control) Reset() {
|
func (x *Control) Reset() {
|
||||||
@@ -120,12 +120,11 @@ func (x *Control) GetRandom() []byte {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type BridgeConfig struct {
|
type BridgeConfig struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Tag string `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"`
|
||||||
|
Domain string `protobuf:"bytes,2,opt,name=domain,proto3" json:"domain,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
Tag string `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"`
|
|
||||||
Domain string `protobuf:"bytes,2,opt,name=domain,proto3" json:"domain,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *BridgeConfig) Reset() {
|
func (x *BridgeConfig) Reset() {
|
||||||
@@ -173,12 +172,11 @@ func (x *BridgeConfig) GetDomain() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type PortalConfig struct {
|
type PortalConfig struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Tag string `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"`
|
||||||
|
Domain string `protobuf:"bytes,2,opt,name=domain,proto3" json:"domain,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
Tag string `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"`
|
|
||||||
Domain string `protobuf:"bytes,2,opt,name=domain,proto3" json:"domain,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *PortalConfig) Reset() {
|
func (x *PortalConfig) Reset() {
|
||||||
@@ -226,12 +224,11 @@ func (x *PortalConfig) GetDomain() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
BridgeConfig []*BridgeConfig `protobuf:"bytes,1,rep,name=bridge_config,json=bridgeConfig,proto3" json:"bridge_config,omitempty"`
|
||||||
|
PortalConfig []*PortalConfig `protobuf:"bytes,2,rep,name=portal_config,json=portalConfig,proto3" json:"portal_config,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
BridgeConfig []*BridgeConfig `protobuf:"bytes,1,rep,name=bridge_config,json=bridgeConfig,proto3" json:"bridge_config,omitempty"`
|
|
||||||
PortalConfig []*PortalConfig `protobuf:"bytes,2,rep,name=portal_config,json=portalConfig,proto3" json:"portal_config,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Config) Reset() {
|
func (x *Config) Reset() {
|
||||||
@@ -280,50 +277,35 @@ func (x *Config) GetPortalConfig() []*PortalConfig {
|
|||||||
|
|
||||||
var File_app_reverse_config_proto protoreflect.FileDescriptor
|
var File_app_reverse_config_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_app_reverse_config_proto_rawDesc = []byte{
|
const file_app_reverse_config_proto_rawDesc = "" +
|
||||||
0x0a, 0x18, 0x61, 0x70, 0x70, 0x2f, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x2f, 0x63, 0x6f,
|
"\n" +
|
||||||
0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x78, 0x72, 0x61, 0x79,
|
"\x18app/reverse/config.proto\x12\x10xray.app.reverse\"x\n" +
|
||||||
0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x22, 0x78, 0x0a, 0x07,
|
"\aControl\x125\n" +
|
||||||
0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x12, 0x35, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65,
|
"\x05state\x18\x01 \x01(\x0e2\x1f.xray.app.reverse.Control.StateR\x05state\x12\x16\n" +
|
||||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1f, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70,
|
"\x06random\x18c \x01(\fR\x06random\"\x1e\n" +
|
||||||
0x70, 0x2e, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f,
|
"\x05State\x12\n" +
|
||||||
0x6c, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x16,
|
"\n" +
|
||||||
0x0a, 0x06, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x18, 0x63, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06,
|
"\x06ACTIVE\x10\x00\x12\t\n" +
|
||||||
0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x22, 0x1e, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12,
|
"\x05DRAIN\x10\x01\"8\n" +
|
||||||
0x0a, 0x0a, 0x06, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x44,
|
"\fBridgeConfig\x12\x10\n" +
|
||||||
0x52, 0x41, 0x49, 0x4e, 0x10, 0x01, 0x22, 0x38, 0x0a, 0x0c, 0x42, 0x72, 0x69, 0x64, 0x67, 0x65,
|
"\x03tag\x18\x01 \x01(\tR\x03tag\x12\x16\n" +
|
||||||
0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18, 0x01, 0x20,
|
"\x06domain\x18\x02 \x01(\tR\x06domain\"8\n" +
|
||||||
0x01, 0x28, 0x09, 0x52, 0x03, 0x74, 0x61, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x6f, 0x6d, 0x61,
|
"\fPortalConfig\x12\x10\n" +
|
||||||
0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e,
|
"\x03tag\x18\x01 \x01(\tR\x03tag\x12\x16\n" +
|
||||||
0x22, 0x38, 0x0a, 0x0c, 0x50, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67,
|
"\x06domain\x18\x02 \x01(\tR\x06domain\"\x92\x01\n" +
|
||||||
0x12, 0x10, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x74,
|
"\x06Config\x12C\n" +
|
||||||
0x61, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01,
|
"\rbridge_config\x18\x01 \x03(\v2\x1e.xray.app.reverse.BridgeConfigR\fbridgeConfig\x12C\n" +
|
||||||
0x28, 0x09, 0x52, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x22, 0x92, 0x01, 0x0a, 0x06, 0x43,
|
"\rportal_config\x18\x02 \x03(\v2\x1e.xray.app.reverse.PortalConfigR\fportalConfigBV\n" +
|
||||||
0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x43, 0x0a, 0x0d, 0x62, 0x72, 0x69, 0x64, 0x67, 0x65, 0x5f,
|
"\x16com.xray.proxy.reverseP\x01Z%github.com/xtls/xray-core/app/reverse\xaa\x02\x12Xray.Proxy.Reverseb\x06proto3"
|
||||||
0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x78,
|
|
||||||
0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x2e,
|
|
||||||
0x42, 0x72, 0x69, 0x64, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0c, 0x62, 0x72,
|
|
||||||
0x69, 0x64, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x43, 0x0a, 0x0d, 0x70, 0x6f,
|
|
||||||
0x72, 0x74, 0x61, 0x6c, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x02, 0x20, 0x03, 0x28,
|
|
||||||
0x0b, 0x32, 0x1e, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x65, 0x76,
|
|
||||||
0x65, 0x72, 0x73, 0x65, 0x2e, 0x50, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x43, 0x6f, 0x6e, 0x66, 0x69,
|
|
||||||
0x67, 0x52, 0x0c, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x42,
|
|
||||||
0x56, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x78,
|
|
||||||
0x79, 0x2e, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x50, 0x01, 0x5a, 0x25, 0x67, 0x69, 0x74,
|
|
||||||
0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x74, 0x6c, 0x73, 0x2f, 0x78, 0x72, 0x61,
|
|
||||||
0x79, 0x2d, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x72, 0x65, 0x76, 0x65, 0x72,
|
|
||||||
0x73, 0x65, 0xaa, 0x02, 0x12, 0x58, 0x72, 0x61, 0x79, 0x2e, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x2e,
|
|
||||||
0x52, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
file_app_reverse_config_proto_rawDescOnce sync.Once
|
file_app_reverse_config_proto_rawDescOnce sync.Once
|
||||||
file_app_reverse_config_proto_rawDescData = file_app_reverse_config_proto_rawDesc
|
file_app_reverse_config_proto_rawDescData []byte
|
||||||
)
|
)
|
||||||
|
|
||||||
func file_app_reverse_config_proto_rawDescGZIP() []byte {
|
func file_app_reverse_config_proto_rawDescGZIP() []byte {
|
||||||
file_app_reverse_config_proto_rawDescOnce.Do(func() {
|
file_app_reverse_config_proto_rawDescOnce.Do(func() {
|
||||||
file_app_reverse_config_proto_rawDescData = protoimpl.X.CompressGZIP(file_app_reverse_config_proto_rawDescData)
|
file_app_reverse_config_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_app_reverse_config_proto_rawDesc), len(file_app_reverse_config_proto_rawDesc)))
|
||||||
})
|
})
|
||||||
return file_app_reverse_config_proto_rawDescData
|
return file_app_reverse_config_proto_rawDescData
|
||||||
}
|
}
|
||||||
@@ -357,7 +339,7 @@ func file_app_reverse_config_proto_init() {
|
|||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_app_reverse_config_proto_rawDesc,
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_app_reverse_config_proto_rawDesc), len(file_app_reverse_config_proto_rawDesc)),
|
||||||
NumEnums: 1,
|
NumEnums: 1,
|
||||||
NumMessages: 4,
|
NumMessages: 4,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
@@ -369,7 +351,6 @@ func file_app_reverse_config_proto_init() {
|
|||||||
MessageInfos: file_app_reverse_config_proto_msgTypes,
|
MessageInfos: file_app_reverse_config_proto_msgTypes,
|
||||||
}.Build()
|
}.Build()
|
||||||
File_app_reverse_config_proto = out.File
|
File_app_reverse_config_proto = out.File
|
||||||
file_app_reverse_config_proto_rawDesc = nil
|
|
||||||
file_app_reverse_config_proto_goTypes = nil
|
file_app_reverse_config_proto_goTypes = nil
|
||||||
file_app_reverse_config_proto_depIdxs = nil
|
file_app_reverse_config_proto_depIdxs = nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ func (s *routingServer) AddRule(ctx context.Context, request *AddRuleRequest) (*
|
|||||||
return nil, errors.New("unsupported router implementation")
|
return nil, errors.New("unsupported router implementation")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *routingServer) RemoveRule(ctx context.Context, request *RemoveRuleRequest) (*RemoveRuleResponse, error) {
|
func (s *routingServer) RemoveRule(ctx context.Context, request *RemoveRuleRequest) (*RemoveRuleResponse, error) {
|
||||||
if bo, ok := s.router.(routing.Router); ok {
|
if bo, ok := s.router.(routing.Router); ok {
|
||||||
return &RemoveRuleResponse{}, bo.RemoveRule(request.RuleTag)
|
return &RemoveRuleResponse{}, bo.RemoveRule(request.RuleTag)
|
||||||
@@ -67,6 +68,20 @@ func (s *routingServer) RemoveRule(ctx context.Context, request *RemoveRuleReque
|
|||||||
return nil, errors.New("unsupported router implementation")
|
return nil, errors.New("unsupported router implementation")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *routingServer) ListRule(ctx context.Context, request *ListRuleRequest) (*ListRuleResponse, error) {
|
||||||
|
if bo, ok := s.router.(routing.Router); ok {
|
||||||
|
response := &ListRuleResponse{}
|
||||||
|
for _, v := range bo.ListRule() {
|
||||||
|
response.Rules = append(response.Rules, &ListRuleItem{
|
||||||
|
Tag: v.GetOutboundTag(),
|
||||||
|
RuleTag: v.GetRuleTag(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return response, nil
|
||||||
|
}
|
||||||
|
return nil, errors.New("unsupported router implementation")
|
||||||
|
}
|
||||||
|
|
||||||
// NewRoutingServer creates a statistics service with statistics manager.
|
// NewRoutingServer creates a statistics service with statistics manager.
|
||||||
func NewRoutingServer(router routing.Router, routingStats stats.Channel) RoutingServiceServer {
|
func NewRoutingServer(router routing.Router, routingStats stats.Channel) RoutingServiceServer {
|
||||||
return &routingServer{
|
return &routingServer{
|
||||||
|
|||||||
+316
-273
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.35.1
|
// protoc-gen-go v1.36.11
|
||||||
// protoc v5.28.2
|
// protoc v6.33.5
|
||||||
// source: app/router/command/command.proto
|
// source: app/router/command/command.proto
|
||||||
|
|
||||||
package command
|
package command
|
||||||
@@ -13,6 +13,7 @@ import (
|
|||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
sync "sync"
|
sync "sync"
|
||||||
|
unsafe "unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -26,25 +27,24 @@ const (
|
|||||||
// It conforms to the structure of xray.features.routing.Context and
|
// It conforms to the structure of xray.features.routing.Context and
|
||||||
// xray.features.routing.Route.
|
// xray.features.routing.Route.
|
||||||
type RoutingContext struct {
|
type RoutingContext struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
InboundTag string `protobuf:"bytes,1,opt,name=InboundTag,proto3" json:"InboundTag,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
Network net.Network `protobuf:"varint,2,opt,name=Network,proto3,enum=xray.common.net.Network" json:"Network,omitempty"`
|
||||||
|
SourceIPs [][]byte `protobuf:"bytes,3,rep,name=SourceIPs,proto3" json:"SourceIPs,omitempty"`
|
||||||
InboundTag string `protobuf:"bytes,1,opt,name=InboundTag,proto3" json:"InboundTag,omitempty"`
|
TargetIPs [][]byte `protobuf:"bytes,4,rep,name=TargetIPs,proto3" json:"TargetIPs,omitempty"`
|
||||||
Network net.Network `protobuf:"varint,2,opt,name=Network,proto3,enum=xray.common.net.Network" json:"Network,omitempty"`
|
SourcePort uint32 `protobuf:"varint,5,opt,name=SourcePort,proto3" json:"SourcePort,omitempty"`
|
||||||
SourceIPs [][]byte `protobuf:"bytes,3,rep,name=SourceIPs,proto3" json:"SourceIPs,omitempty"`
|
TargetPort uint32 `protobuf:"varint,6,opt,name=TargetPort,proto3" json:"TargetPort,omitempty"`
|
||||||
TargetIPs [][]byte `protobuf:"bytes,4,rep,name=TargetIPs,proto3" json:"TargetIPs,omitempty"`
|
TargetDomain string `protobuf:"bytes,7,opt,name=TargetDomain,proto3" json:"TargetDomain,omitempty"`
|
||||||
SourcePort uint32 `protobuf:"varint,5,opt,name=SourcePort,proto3" json:"SourcePort,omitempty"`
|
Protocol string `protobuf:"bytes,8,opt,name=Protocol,proto3" json:"Protocol,omitempty"`
|
||||||
TargetPort uint32 `protobuf:"varint,6,opt,name=TargetPort,proto3" json:"TargetPort,omitempty"`
|
User string `protobuf:"bytes,9,opt,name=User,proto3" json:"User,omitempty"`
|
||||||
TargetDomain string `protobuf:"bytes,7,opt,name=TargetDomain,proto3" json:"TargetDomain,omitempty"`
|
Attributes map[string]string `protobuf:"bytes,10,rep,name=Attributes,proto3" json:"Attributes,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||||
Protocol string `protobuf:"bytes,8,opt,name=Protocol,proto3" json:"Protocol,omitempty"`
|
OutboundGroupTags []string `protobuf:"bytes,11,rep,name=OutboundGroupTags,proto3" json:"OutboundGroupTags,omitempty"`
|
||||||
User string `protobuf:"bytes,9,opt,name=User,proto3" json:"User,omitempty"`
|
OutboundTag string `protobuf:"bytes,12,opt,name=OutboundTag,proto3" json:"OutboundTag,omitempty"`
|
||||||
Attributes map[string]string `protobuf:"bytes,10,rep,name=Attributes,proto3" json:"Attributes,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
LocalIPs [][]byte `protobuf:"bytes,13,rep,name=LocalIPs,proto3" json:"LocalIPs,omitempty"`
|
||||||
OutboundGroupTags []string `protobuf:"bytes,11,rep,name=OutboundGroupTags,proto3" json:"OutboundGroupTags,omitempty"`
|
LocalPort uint32 `protobuf:"varint,14,opt,name=LocalPort,proto3" json:"LocalPort,omitempty"`
|
||||||
OutboundTag string `protobuf:"bytes,12,opt,name=OutboundTag,proto3" json:"OutboundTag,omitempty"`
|
VlessRoute uint32 `protobuf:"varint,15,opt,name=VlessRoute,proto3" json:"VlessRoute,omitempty"`
|
||||||
LocalIPs [][]byte `protobuf:"bytes,13,rep,name=LocalIPs,proto3" json:"LocalIPs,omitempty"`
|
unknownFields protoimpl.UnknownFields
|
||||||
LocalPort uint32 `protobuf:"varint,14,opt,name=LocalPort,proto3" json:"LocalPort,omitempty"`
|
sizeCache protoimpl.SizeCache
|
||||||
VlessRoute uint32 `protobuf:"varint,15,opt,name=VlessRoute,proto3" json:"VlessRoute,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *RoutingContext) Reset() {
|
func (x *RoutingContext) Reset() {
|
||||||
@@ -201,11 +201,10 @@ func (x *RoutingContext) GetVlessRoute() uint32 {
|
|||||||
//
|
//
|
||||||
// * If FieldSelectors is left empty, all fields will be returned.
|
// * If FieldSelectors is left empty, all fields will be returned.
|
||||||
type SubscribeRoutingStatsRequest struct {
|
type SubscribeRoutingStatsRequest struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
FieldSelectors []string `protobuf:"bytes,1,rep,name=FieldSelectors,proto3" json:"FieldSelectors,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
FieldSelectors []string `protobuf:"bytes,1,rep,name=FieldSelectors,proto3" json:"FieldSelectors,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *SubscribeRoutingStatsRequest) Reset() {
|
func (x *SubscribeRoutingStatsRequest) Reset() {
|
||||||
@@ -253,13 +252,12 @@ func (x *SubscribeRoutingStatsRequest) GetFieldSelectors() []string {
|
|||||||
// * PublishResult broadcasts the routing result to routing statistics channel
|
// * PublishResult broadcasts the routing result to routing statistics channel
|
||||||
// if set true.
|
// if set true.
|
||||||
type TestRouteRequest struct {
|
type TestRouteRequest struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
RoutingContext *RoutingContext `protobuf:"bytes,1,opt,name=RoutingContext,proto3" json:"RoutingContext,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
FieldSelectors []string `protobuf:"bytes,2,rep,name=FieldSelectors,proto3" json:"FieldSelectors,omitempty"`
|
||||||
|
PublishResult bool `protobuf:"varint,3,opt,name=PublishResult,proto3" json:"PublishResult,omitempty"`
|
||||||
RoutingContext *RoutingContext `protobuf:"bytes,1,opt,name=RoutingContext,proto3" json:"RoutingContext,omitempty"`
|
unknownFields protoimpl.UnknownFields
|
||||||
FieldSelectors []string `protobuf:"bytes,2,rep,name=FieldSelectors,proto3" json:"FieldSelectors,omitempty"`
|
sizeCache protoimpl.SizeCache
|
||||||
PublishResult bool `protobuf:"varint,3,opt,name=PublishResult,proto3" json:"PublishResult,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *TestRouteRequest) Reset() {
|
func (x *TestRouteRequest) Reset() {
|
||||||
@@ -314,11 +312,10 @@ func (x *TestRouteRequest) GetPublishResult() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type PrincipleTargetInfo struct {
|
type PrincipleTargetInfo struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Tag []string `protobuf:"bytes,1,rep,name=tag,proto3" json:"tag,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
Tag []string `protobuf:"bytes,1,rep,name=tag,proto3" json:"tag,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *PrincipleTargetInfo) Reset() {
|
func (x *PrincipleTargetInfo) Reset() {
|
||||||
@@ -359,11 +356,10 @@ func (x *PrincipleTargetInfo) GetTag() []string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type OverrideInfo struct {
|
type OverrideInfo struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Target string `protobuf:"bytes,2,opt,name=target,proto3" json:"target,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
Target string `protobuf:"bytes,2,opt,name=target,proto3" json:"target,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *OverrideInfo) Reset() {
|
func (x *OverrideInfo) Reset() {
|
||||||
@@ -404,12 +400,11 @@ func (x *OverrideInfo) GetTarget() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type BalancerMsg struct {
|
type BalancerMsg struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Override *OverrideInfo `protobuf:"bytes,5,opt,name=override,proto3" json:"override,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
PrincipleTarget *PrincipleTargetInfo `protobuf:"bytes,6,opt,name=principle_target,json=principleTarget,proto3" json:"principle_target,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
Override *OverrideInfo `protobuf:"bytes,5,opt,name=override,proto3" json:"override,omitempty"`
|
sizeCache protoimpl.SizeCache
|
||||||
PrincipleTarget *PrincipleTargetInfo `protobuf:"bytes,6,opt,name=principle_target,json=principleTarget,proto3" json:"principle_target,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *BalancerMsg) Reset() {
|
func (x *BalancerMsg) Reset() {
|
||||||
@@ -457,11 +452,10 @@ func (x *BalancerMsg) GetPrincipleTarget() *PrincipleTargetInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type GetBalancerInfoRequest struct {
|
type GetBalancerInfoRequest struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Tag string `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
Tag string `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GetBalancerInfoRequest) Reset() {
|
func (x *GetBalancerInfoRequest) Reset() {
|
||||||
@@ -502,11 +496,10 @@ func (x *GetBalancerInfoRequest) GetTag() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type GetBalancerInfoResponse struct {
|
type GetBalancerInfoResponse struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Balancer *BalancerMsg `protobuf:"bytes,1,opt,name=balancer,proto3" json:"balancer,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
Balancer *BalancerMsg `protobuf:"bytes,1,opt,name=balancer,proto3" json:"balancer,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GetBalancerInfoResponse) Reset() {
|
func (x *GetBalancerInfoResponse) Reset() {
|
||||||
@@ -547,12 +540,11 @@ func (x *GetBalancerInfoResponse) GetBalancer() *BalancerMsg {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type OverrideBalancerTargetRequest struct {
|
type OverrideBalancerTargetRequest struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
BalancerTag string `protobuf:"bytes,1,opt,name=balancerTag,proto3" json:"balancerTag,omitempty"`
|
||||||
|
Target string `protobuf:"bytes,2,opt,name=target,proto3" json:"target,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
BalancerTag string `protobuf:"bytes,1,opt,name=balancerTag,proto3" json:"balancerTag,omitempty"`
|
|
||||||
Target string `protobuf:"bytes,2,opt,name=target,proto3" json:"target,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *OverrideBalancerTargetRequest) Reset() {
|
func (x *OverrideBalancerTargetRequest) Reset() {
|
||||||
@@ -600,9 +592,9 @@ func (x *OverrideBalancerTargetRequest) GetTarget() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type OverrideBalancerTargetResponse struct {
|
type OverrideBalancerTargetResponse struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *OverrideBalancerTargetResponse) Reset() {
|
func (x *OverrideBalancerTargetResponse) Reset() {
|
||||||
@@ -636,12 +628,11 @@ func (*OverrideBalancerTargetResponse) Descriptor() ([]byte, []int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type AddRuleRequest struct {
|
type AddRuleRequest struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Config *serial.TypedMessage `protobuf:"bytes,1,opt,name=config,proto3" json:"config,omitempty"`
|
||||||
|
ShouldAppend bool `protobuf:"varint,2,opt,name=shouldAppend,proto3" json:"shouldAppend,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
Config *serial.TypedMessage `protobuf:"bytes,1,opt,name=config,proto3" json:"config,omitempty"`
|
|
||||||
ShouldAppend bool `protobuf:"varint,2,opt,name=shouldAppend,proto3" json:"shouldAppend,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *AddRuleRequest) Reset() {
|
func (x *AddRuleRequest) Reset() {
|
||||||
@@ -689,9 +680,9 @@ func (x *AddRuleRequest) GetShouldAppend() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type AddRuleResponse struct {
|
type AddRuleResponse struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *AddRuleResponse) Reset() {
|
func (x *AddRuleResponse) Reset() {
|
||||||
@@ -725,11 +716,10 @@ func (*AddRuleResponse) Descriptor() ([]byte, []int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type RemoveRuleRequest struct {
|
type RemoveRuleRequest struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
RuleTag string `protobuf:"bytes,1,opt,name=ruleTag,proto3" json:"ruleTag,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
RuleTag string `protobuf:"bytes,1,opt,name=ruleTag,proto3" json:"ruleTag,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *RemoveRuleRequest) Reset() {
|
func (x *RemoveRuleRequest) Reset() {
|
||||||
@@ -770,9 +760,9 @@ func (x *RemoveRuleRequest) GetRuleTag() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type RemoveRuleResponse struct {
|
type RemoveRuleResponse struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *RemoveRuleResponse) Reset() {
|
func (x *RemoveRuleResponse) Reset() {
|
||||||
@@ -805,15 +795,147 @@ func (*RemoveRuleResponse) Descriptor() ([]byte, []int) {
|
|||||||
return file_app_router_command_command_proto_rawDescGZIP(), []int{13}
|
return file_app_router_command_command_proto_rawDescGZIP(), []int{13}
|
||||||
}
|
}
|
||||||
|
|
||||||
type Config struct {
|
type ListRuleRequest struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ListRuleRequest) Reset() {
|
||||||
|
*x = ListRuleRequest{}
|
||||||
|
mi := &file_app_router_command_command_proto_msgTypes[14]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ListRuleRequest) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*ListRuleRequest) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *ListRuleRequest) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_app_router_command_command_proto_msgTypes[14]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use ListRuleRequest.ProtoReflect.Descriptor instead.
|
||||||
|
func (*ListRuleRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return file_app_router_command_command_proto_rawDescGZIP(), []int{14}
|
||||||
|
}
|
||||||
|
|
||||||
|
type ListRuleItem struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
Tag string `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"`
|
||||||
|
RuleTag string `protobuf:"bytes,2,opt,name=ruleTag,proto3" json:"ruleTag,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ListRuleItem) Reset() {
|
||||||
|
*x = ListRuleItem{}
|
||||||
|
mi := &file_app_router_command_command_proto_msgTypes[15]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ListRuleItem) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*ListRuleItem) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *ListRuleItem) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_app_router_command_command_proto_msgTypes[15]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use ListRuleItem.ProtoReflect.Descriptor instead.
|
||||||
|
func (*ListRuleItem) Descriptor() ([]byte, []int) {
|
||||||
|
return file_app_router_command_command_proto_rawDescGZIP(), []int{15}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ListRuleItem) GetTag() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Tag
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ListRuleItem) GetRuleTag() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.RuleTag
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type ListRuleResponse struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
Rules []*ListRuleItem `protobuf:"bytes,1,rep,name=rules,proto3" json:"rules,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ListRuleResponse) Reset() {
|
||||||
|
*x = ListRuleResponse{}
|
||||||
|
mi := &file_app_router_command_command_proto_msgTypes[16]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ListRuleResponse) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*ListRuleResponse) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *ListRuleResponse) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_app_router_command_command_proto_msgTypes[16]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use ListRuleResponse.ProtoReflect.Descriptor instead.
|
||||||
|
func (*ListRuleResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return file_app_router_command_command_proto_rawDescGZIP(), []int{16}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ListRuleResponse) GetRules() []*ListRuleItem {
|
||||||
|
if x != nil {
|
||||||
|
return x.Rules
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type Config struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Config) Reset() {
|
func (x *Config) Reset() {
|
||||||
*x = Config{}
|
*x = Config{}
|
||||||
mi := &file_app_router_command_command_proto_msgTypes[14]
|
mi := &file_app_router_command_command_proto_msgTypes[17]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@@ -825,7 +947,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_app_router_command_command_proto_msgTypes[14]
|
mi := &file_app_router_command_command_proto_msgTypes[17]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@@ -838,187 +960,103 @@ 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_app_router_command_command_proto_rawDescGZIP(), []int{14}
|
return file_app_router_command_command_proto_rawDescGZIP(), []int{17}
|
||||||
}
|
}
|
||||||
|
|
||||||
var File_app_router_command_command_proto protoreflect.FileDescriptor
|
var File_app_router_command_command_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_app_router_command_command_proto_rawDesc = []byte{
|
const file_app_router_command_command_proto_rawDesc = "" +
|
||||||
0x0a, 0x20, 0x61, 0x70, 0x70, 0x2f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x6d,
|
"\n" +
|
||||||
0x6d, 0x61, 0x6e, 0x64, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x70, 0x72, 0x6f,
|
" app/router/command/command.proto\x12\x17xray.app.router.command\x1a\x18common/net/network.proto\x1a!common/serial/typed_message.proto\"\xf6\x04\n" +
|
||||||
0x74, 0x6f, 0x12, 0x17, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75,
|
"\x0eRoutingContext\x12\x1e\n" +
|
||||||
0x74, 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x1a, 0x18, 0x63, 0x6f, 0x6d,
|
"\n" +
|
||||||
0x6d, 0x6f, 0x6e, 0x2f, 0x6e, 0x65, 0x74, 0x2f, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e,
|
"InboundTag\x18\x01 \x01(\tR\n" +
|
||||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x73, 0x65,
|
"InboundTag\x122\n" +
|
||||||
0x72, 0x69, 0x61, 0x6c, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x64, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61,
|
"\aNetwork\x18\x02 \x01(\x0e2\x18.xray.common.net.NetworkR\aNetwork\x12\x1c\n" +
|
||||||
0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf6, 0x04, 0x0a, 0x0e, 0x52, 0x6f, 0x75,
|
"\tSourceIPs\x18\x03 \x03(\fR\tSourceIPs\x12\x1c\n" +
|
||||||
0x74, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x49,
|
"\tTargetIPs\x18\x04 \x03(\fR\tTargetIPs\x12\x1e\n" +
|
||||||
0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x54, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
"\n" +
|
||||||
0x0a, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x54, 0x61, 0x67, 0x12, 0x32, 0x0a, 0x07, 0x4e,
|
"SourcePort\x18\x05 \x01(\rR\n" +
|
||||||
0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x78,
|
"SourcePort\x12\x1e\n" +
|
||||||
0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x2e, 0x4e,
|
"\n" +
|
||||||
0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x52, 0x07, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x12,
|
"TargetPort\x18\x06 \x01(\rR\n" +
|
||||||
0x1c, 0x0a, 0x09, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x50, 0x73, 0x18, 0x03, 0x20, 0x03,
|
"TargetPort\x12\"\n" +
|
||||||
0x28, 0x0c, 0x52, 0x09, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x50, 0x73, 0x12, 0x1c, 0x0a,
|
"\fTargetDomain\x18\a \x01(\tR\fTargetDomain\x12\x1a\n" +
|
||||||
0x09, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x49, 0x50, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0c,
|
"\bProtocol\x18\b \x01(\tR\bProtocol\x12\x12\n" +
|
||||||
0x52, 0x09, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x49, 0x50, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x53,
|
"\x04User\x18\t \x01(\tR\x04User\x12W\n" +
|
||||||
0x6f, 0x75, 0x72, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52,
|
"\n" +
|
||||||
0x0a, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x54,
|
"Attributes\x18\n" +
|
||||||
0x61, 0x72, 0x67, 0x65, 0x74, 0x50, 0x6f, 0x72, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52,
|
" \x03(\v27.xray.app.router.command.RoutingContext.AttributesEntryR\n" +
|
||||||
0x0a, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x22, 0x0a, 0x0c, 0x54,
|
"Attributes\x12,\n" +
|
||||||
0x61, 0x72, 0x67, 0x65, 0x74, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28,
|
"\x11OutboundGroupTags\x18\v \x03(\tR\x11OutboundGroupTags\x12 \n" +
|
||||||
0x09, 0x52, 0x0c, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x12,
|
"\vOutboundTag\x18\f \x01(\tR\vOutboundTag\x12\x1a\n" +
|
||||||
0x1a, 0x0a, 0x08, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x08, 0x20, 0x01, 0x28,
|
"\bLocalIPs\x18\r \x03(\fR\bLocalIPs\x12\x1c\n" +
|
||||||
0x09, 0x52, 0x08, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x55,
|
"\tLocalPort\x18\x0e \x01(\rR\tLocalPort\x12\x1e\n" +
|
||||||
0x73, 0x65, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12,
|
"\n" +
|
||||||
0x57, 0x0a, 0x0a, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x0a, 0x20,
|
"VlessRoute\x18\x0f \x01(\rR\n" +
|
||||||
0x03, 0x28, 0x0b, 0x32, 0x37, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72,
|
"VlessRoute\x1a=\n" +
|
||||||
0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x52, 0x6f,
|
"\x0fAttributesEntry\x12\x10\n" +
|
||||||
0x75, 0x74, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x2e, 0x41, 0x74, 0x74,
|
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
|
||||||
0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0a, 0x41, 0x74,
|
"\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"F\n" +
|
||||||
0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x2c, 0x0a, 0x11, 0x4f, 0x75, 0x74, 0x62,
|
"\x1cSubscribeRoutingStatsRequest\x12&\n" +
|
||||||
0x6f, 0x75, 0x6e, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x54, 0x61, 0x67, 0x73, 0x18, 0x0b, 0x20,
|
"\x0eFieldSelectors\x18\x01 \x03(\tR\x0eFieldSelectors\"\xb1\x01\n" +
|
||||||
0x03, 0x28, 0x09, 0x52, 0x11, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x47, 0x72, 0x6f,
|
"\x10TestRouteRequest\x12O\n" +
|
||||||
0x75, 0x70, 0x54, 0x61, 0x67, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75,
|
"\x0eRoutingContext\x18\x01 \x01(\v2'.xray.app.router.command.RoutingContextR\x0eRoutingContext\x12&\n" +
|
||||||
0x6e, 0x64, 0x54, 0x61, 0x67, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x4f, 0x75, 0x74,
|
"\x0eFieldSelectors\x18\x02 \x03(\tR\x0eFieldSelectors\x12$\n" +
|
||||||
0x62, 0x6f, 0x75, 0x6e, 0x64, 0x54, 0x61, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x4c, 0x6f, 0x63, 0x61,
|
"\rPublishResult\x18\x03 \x01(\bR\rPublishResult\"'\n" +
|
||||||
0x6c, 0x49, 0x50, 0x73, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x08, 0x4c, 0x6f, 0x63, 0x61,
|
"\x13PrincipleTargetInfo\x12\x10\n" +
|
||||||
0x6c, 0x49, 0x50, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x50, 0x6f, 0x72,
|
"\x03tag\x18\x01 \x03(\tR\x03tag\"&\n" +
|
||||||
0x74, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x50, 0x6f,
|
"\fOverrideInfo\x12\x16\n" +
|
||||||
0x72, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x56, 0x6c, 0x65, 0x73, 0x73, 0x52, 0x6f, 0x75, 0x74, 0x65,
|
"\x06target\x18\x02 \x01(\tR\x06target\"\xa9\x01\n" +
|
||||||
0x18, 0x0f, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x56, 0x6c, 0x65, 0x73, 0x73, 0x52, 0x6f, 0x75,
|
"\vBalancerMsg\x12A\n" +
|
||||||
0x74, 0x65, 0x1a, 0x3d, 0x0a, 0x0f, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73,
|
"\boverride\x18\x05 \x01(\v2%.xray.app.router.command.OverrideInfoR\boverride\x12W\n" +
|
||||||
0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01,
|
"\x10principle_target\x18\x06 \x01(\v2,.xray.app.router.command.PrincipleTargetInfoR\x0fprincipleTarget\"*\n" +
|
||||||
0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
|
"\x16GetBalancerInfoRequest\x12\x10\n" +
|
||||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38,
|
"\x03tag\x18\x01 \x01(\tR\x03tag\"[\n" +
|
||||||
0x01, 0x22, 0x46, 0x0a, 0x1c, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x6f,
|
"\x17GetBalancerInfoResponse\x12@\n" +
|
||||||
0x75, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
"\bbalancer\x18\x01 \x01(\v2$.xray.app.router.command.BalancerMsgR\bbalancer\"Y\n" +
|
||||||
0x74, 0x12, 0x26, 0x0a, 0x0e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74,
|
"\x1dOverrideBalancerTargetRequest\x12 \n" +
|
||||||
0x6f, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x46, 0x69, 0x65, 0x6c, 0x64,
|
"\vbalancerTag\x18\x01 \x01(\tR\vbalancerTag\x12\x16\n" +
|
||||||
0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x22, 0xb1, 0x01, 0x0a, 0x10, 0x54, 0x65,
|
"\x06target\x18\x02 \x01(\tR\x06target\" \n" +
|
||||||
0x73, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x4f,
|
"\x1eOverrideBalancerTargetResponse\"n\n" +
|
||||||
0x0a, 0x0e, 0x52, 0x6f, 0x75, 0x74, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74,
|
"\x0eAddRuleRequest\x128\n" +
|
||||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70,
|
"\x06config\x18\x01 \x01(\v2 .xray.common.serial.TypedMessageR\x06config\x12\"\n" +
|
||||||
0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64,
|
"\fshouldAppend\x18\x02 \x01(\bR\fshouldAppend\"\x11\n" +
|
||||||
0x2e, 0x52, 0x6f, 0x75, 0x74, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x52,
|
"\x0fAddRuleResponse\"-\n" +
|
||||||
0x0e, 0x52, 0x6f, 0x75, 0x74, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12,
|
"\x11RemoveRuleRequest\x12\x18\n" +
|
||||||
0x26, 0x0a, 0x0e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72,
|
"\aruleTag\x18\x01 \x01(\tR\aruleTag\"\x14\n" +
|
||||||
0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x53, 0x65,
|
"\x12RemoveRuleResponse\"\x11\n" +
|
||||||
0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x50, 0x75, 0x62, 0x6c, 0x69,
|
"\x0fListRuleRequest\":\n" +
|
||||||
0x73, 0x68, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d,
|
"\fListRuleItem\x12\x10\n" +
|
||||||
0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x27, 0x0a,
|
"\x03tag\x18\x01 \x01(\tR\x03tag\x12\x18\n" +
|
||||||
0x13, 0x50, 0x72, 0x69, 0x6e, 0x63, 0x69, 0x70, 0x6c, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74,
|
"\aruleTag\x18\x02 \x01(\tR\aruleTag\"O\n" +
|
||||||
0x49, 0x6e, 0x66, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18, 0x01, 0x20, 0x03, 0x28,
|
"\x10ListRuleResponse\x12;\n" +
|
||||||
0x09, 0x52, 0x03, 0x74, 0x61, 0x67, 0x22, 0x26, 0x0a, 0x0c, 0x4f, 0x76, 0x65, 0x72, 0x72, 0x69,
|
"\x05rules\x18\x01 \x03(\v2%.xray.app.router.command.ListRuleItemR\x05rules\"\b\n" +
|
||||||
0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74,
|
"\x06Config2\xa2\x06\n" +
|
||||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x22, 0xa9,
|
"\x0eRoutingService\x12{\n" +
|
||||||
0x01, 0x0a, 0x0b, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x72, 0x4d, 0x73, 0x67, 0x12, 0x41,
|
"\x15SubscribeRoutingStats\x125.xray.app.router.command.SubscribeRoutingStatsRequest\x1a'.xray.app.router.command.RoutingContext\"\x000\x01\x12a\n" +
|
||||||
0x0a, 0x08, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b,
|
"\tTestRoute\x12).xray.app.router.command.TestRouteRequest\x1a'.xray.app.router.command.RoutingContext\"\x00\x12v\n" +
|
||||||
0x32, 0x25, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74,
|
"\x0fGetBalancerInfo\x12/.xray.app.router.command.GetBalancerInfoRequest\x1a0.xray.app.router.command.GetBalancerInfoResponse\"\x00\x12\x8b\x01\n" +
|
||||||
0x65, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x4f, 0x76, 0x65, 0x72, 0x72,
|
"\x16OverrideBalancerTarget\x126.xray.app.router.command.OverrideBalancerTargetRequest\x1a7.xray.app.router.command.OverrideBalancerTargetResponse\"\x00\x12^\n" +
|
||||||
0x69, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64,
|
"\aAddRule\x12'.xray.app.router.command.AddRuleRequest\x1a(.xray.app.router.command.AddRuleResponse\"\x00\x12g\n" +
|
||||||
0x65, 0x12, 0x57, 0x0a, 0x10, 0x70, 0x72, 0x69, 0x6e, 0x63, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x74,
|
"\n" +
|
||||||
0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x78, 0x72,
|
"RemoveRule\x12*.xray.app.router.command.RemoveRuleRequest\x1a+.xray.app.router.command.RemoveRuleResponse\"\x00\x12a\n" +
|
||||||
0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x63, 0x6f,
|
"\bListRule\x12(.xray.app.router.command.ListRuleRequest\x1a).xray.app.router.command.ListRuleResponse\"\x00Bg\n" +
|
||||||
0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x50, 0x72, 0x69, 0x6e, 0x63, 0x69, 0x70, 0x6c, 0x65, 0x54,
|
"\x1bcom.xray.app.router.commandP\x01Z,github.com/xtls/xray-core/app/router/command\xaa\x02\x17Xray.App.Router.Commandb\x06proto3"
|
||||||
0x61, 0x72, 0x67, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0f, 0x70, 0x72, 0x69, 0x6e, 0x63,
|
|
||||||
0x69, 0x70, 0x6c, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x22, 0x2a, 0x0a, 0x16, 0x47, 0x65,
|
|
||||||
0x74, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71,
|
|
||||||
0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28,
|
|
||||||
0x09, 0x52, 0x03, 0x74, 0x61, 0x67, 0x22, 0x5b, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x42, 0x61, 0x6c,
|
|
||||||
0x61, 0x6e, 0x63, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
|
||||||
0x65, 0x12, 0x40, 0x0a, 0x08, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x72, 0x18, 0x01, 0x20,
|
|
||||||
0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72,
|
|
||||||
0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x42, 0x61,
|
|
||||||
0x6c, 0x61, 0x6e, 0x63, 0x65, 0x72, 0x4d, 0x73, 0x67, 0x52, 0x08, 0x62, 0x61, 0x6c, 0x61, 0x6e,
|
|
||||||
0x63, 0x65, 0x72, 0x22, 0x59, 0x0a, 0x1d, 0x4f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x42,
|
|
||||||
0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x72, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x65, 0x71,
|
|
||||||
0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x72,
|
|
||||||
0x54, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, 0x61, 0x6c, 0x61, 0x6e,
|
|
||||||
0x63, 0x65, 0x72, 0x54, 0x61, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74,
|
|
||||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x22, 0x20,
|
|
||||||
0x0a, 0x1e, 0x4f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63,
|
|
||||||
0x65, 0x72, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
|
||||||
0x22, 0x6e, 0x0a, 0x0e, 0x41, 0x64, 0x64, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65,
|
|
||||||
0x73, 0x74, 0x12, 0x38, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01,
|
|
||||||
0x28, 0x0b, 0x32, 0x20, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
|
|
||||||
0x2e, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x64, 0x4d, 0x65, 0x73,
|
|
||||||
0x73, 0x61, 0x67, 0x65, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x22, 0x0a, 0x0c,
|
|
||||||
0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x41, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01,
|
|
||||||
0x28, 0x08, 0x52, 0x0c, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x41, 0x70, 0x70, 0x65, 0x6e, 0x64,
|
|
||||||
0x22, 0x11, 0x0a, 0x0f, 0x41, 0x64, 0x64, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
|
||||||
0x6e, 0x73, 0x65, 0x22, 0x2d, 0x0a, 0x11, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x75, 0x6c,
|
|
||||||
0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x75, 0x6c, 0x65,
|
|
||||||
0x54, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x72, 0x75, 0x6c, 0x65, 0x54,
|
|
||||||
0x61, 0x67, 0x22, 0x14, 0x0a, 0x12, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x75, 0x6c, 0x65,
|
|
||||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x08, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66,
|
|
||||||
0x69, 0x67, 0x32, 0xbf, 0x05, 0x0a, 0x0e, 0x52, 0x6f, 0x75, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65,
|
|
||||||
0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x7b, 0x0a, 0x15, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69,
|
|
||||||
0x62, 0x65, 0x52, 0x6f, 0x75, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x35,
|
|
||||||
0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72,
|
|
||||||
0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69,
|
|
||||||
0x62, 0x65, 0x52, 0x6f, 0x75, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65,
|
|
||||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70,
|
|
||||||
0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e,
|
|
||||||
0x52, 0x6f, 0x75, 0x74, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x22, 0x00,
|
|
||||||
0x30, 0x01, 0x12, 0x61, 0x0a, 0x09, 0x54, 0x65, 0x73, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x12,
|
|
||||||
0x29, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65,
|
|
||||||
0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x52, 0x6f,
|
|
||||||
0x75, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x78, 0x72, 0x61,
|
|
||||||
0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x6d,
|
|
||||||
0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6e, 0x74,
|
|
||||||
0x65, 0x78, 0x74, 0x22, 0x00, 0x12, 0x76, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x42, 0x61, 0x6c, 0x61,
|
|
||||||
0x6e, 0x63, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2f, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e,
|
|
||||||
0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61,
|
|
||||||
0x6e, 0x64, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x72, 0x49, 0x6e,
|
|
||||||
0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x78, 0x72, 0x61, 0x79,
|
|
||||||
0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x6d,
|
|
||||||
0x61, 0x6e, 0x64, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x72, 0x49,
|
|
||||||
0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x8b, 0x01,
|
|
||||||
0x0a, 0x16, 0x4f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63,
|
|
||||||
0x65, 0x72, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x36, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e,
|
|
||||||
0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61,
|
|
||||||
0x6e, 0x64, 0x2e, 0x4f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x42, 0x61, 0x6c, 0x61, 0x6e,
|
|
||||||
0x63, 0x65, 0x72, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
|
||||||
0x1a, 0x37, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74,
|
|
||||||
0x65, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x4f, 0x76, 0x65, 0x72, 0x72,
|
|
||||||
0x69, 0x64, 0x65, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x72, 0x54, 0x61, 0x72, 0x67, 0x65,
|
|
||||||
0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x5e, 0x0a, 0x07, 0x41,
|
|
||||||
0x64, 0x64, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x27, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70,
|
|
||||||
0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64,
|
|
||||||
0x2e, 0x41, 0x64, 0x64, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
|
||||||
0x28, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65,
|
|
||||||
0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x41, 0x64, 0x64, 0x52, 0x75, 0x6c,
|
|
||||||
0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x67, 0x0a, 0x0a, 0x52,
|
|
||||||
0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x2a, 0x2e, 0x78, 0x72, 0x61, 0x79,
|
|
||||||
0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x6d,
|
|
||||||
0x61, 0x6e, 0x64, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x65,
|
|
||||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70,
|
|
||||||
0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e,
|
|
||||||
0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
|
||||||
0x73, 0x65, 0x22, 0x00, 0x42, 0x67, 0x0a, 0x1b, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79,
|
|
||||||
0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x6d,
|
|
||||||
0x61, 0x6e, 0x64, 0x50, 0x01, 0x5a, 0x2c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f,
|
|
||||||
0x6d, 0x2f, 0x78, 0x74, 0x6c, 0x73, 0x2f, 0x78, 0x72, 0x61, 0x79, 0x2d, 0x63, 0x6f, 0x72, 0x65,
|
|
||||||
0x2f, 0x61, 0x70, 0x70, 0x2f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x6d, 0x6d,
|
|
||||||
0x61, 0x6e, 0x64, 0xaa, 0x02, 0x17, 0x58, 0x72, 0x61, 0x79, 0x2e, 0x41, 0x70, 0x70, 0x2e, 0x52,
|
|
||||||
0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x62, 0x06, 0x70,
|
|
||||||
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
file_app_router_command_command_proto_rawDescOnce sync.Once
|
file_app_router_command_command_proto_rawDescOnce sync.Once
|
||||||
file_app_router_command_command_proto_rawDescData = file_app_router_command_command_proto_rawDesc
|
file_app_router_command_command_proto_rawDescData []byte
|
||||||
)
|
)
|
||||||
|
|
||||||
func file_app_router_command_command_proto_rawDescGZIP() []byte {
|
func file_app_router_command_command_proto_rawDescGZIP() []byte {
|
||||||
file_app_router_command_command_proto_rawDescOnce.Do(func() {
|
file_app_router_command_command_proto_rawDescOnce.Do(func() {
|
||||||
file_app_router_command_command_proto_rawDescData = protoimpl.X.CompressGZIP(file_app_router_command_command_proto_rawDescData)
|
file_app_router_command_command_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_app_router_command_command_proto_rawDesc), len(file_app_router_command_command_proto_rawDesc)))
|
||||||
})
|
})
|
||||||
return file_app_router_command_command_proto_rawDescData
|
return file_app_router_command_command_proto_rawDescData
|
||||||
}
|
}
|
||||||
|
|
||||||
var file_app_router_command_command_proto_msgTypes = make([]protoimpl.MessageInfo, 16)
|
var file_app_router_command_command_proto_msgTypes = make([]protoimpl.MessageInfo, 19)
|
||||||
var file_app_router_command_command_proto_goTypes = []any{
|
var file_app_router_command_command_proto_goTypes = []any{
|
||||||
(*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
|
||||||
@@ -1034,36 +1072,42 @@ var file_app_router_command_command_proto_goTypes = []any{
|
|||||||
(*AddRuleResponse)(nil), // 11: xray.app.router.command.AddRuleResponse
|
(*AddRuleResponse)(nil), // 11: xray.app.router.command.AddRuleResponse
|
||||||
(*RemoveRuleRequest)(nil), // 12: xray.app.router.command.RemoveRuleRequest
|
(*RemoveRuleRequest)(nil), // 12: xray.app.router.command.RemoveRuleRequest
|
||||||
(*RemoveRuleResponse)(nil), // 13: xray.app.router.command.RemoveRuleResponse
|
(*RemoveRuleResponse)(nil), // 13: xray.app.router.command.RemoveRuleResponse
|
||||||
(*Config)(nil), // 14: xray.app.router.command.Config
|
(*ListRuleRequest)(nil), // 14: xray.app.router.command.ListRuleRequest
|
||||||
nil, // 15: xray.app.router.command.RoutingContext.AttributesEntry
|
(*ListRuleItem)(nil), // 15: xray.app.router.command.ListRuleItem
|
||||||
(net.Network)(0), // 16: xray.common.net.Network
|
(*ListRuleResponse)(nil), // 16: xray.app.router.command.ListRuleResponse
|
||||||
(*serial.TypedMessage)(nil), // 17: xray.common.serial.TypedMessage
|
(*Config)(nil), // 17: xray.app.router.command.Config
|
||||||
|
nil, // 18: xray.app.router.command.RoutingContext.AttributesEntry
|
||||||
|
(net.Network)(0), // 19: xray.common.net.Network
|
||||||
|
(*serial.TypedMessage)(nil), // 20: xray.common.serial.TypedMessage
|
||||||
}
|
}
|
||||||
var file_app_router_command_command_proto_depIdxs = []int32{
|
var file_app_router_command_command_proto_depIdxs = []int32{
|
||||||
16, // 0: xray.app.router.command.RoutingContext.Network:type_name -> xray.common.net.Network
|
19, // 0: xray.app.router.command.RoutingContext.Network:type_name -> xray.common.net.Network
|
||||||
15, // 1: xray.app.router.command.RoutingContext.Attributes:type_name -> xray.app.router.command.RoutingContext.AttributesEntry
|
18, // 1: xray.app.router.command.RoutingContext.Attributes:type_name -> xray.app.router.command.RoutingContext.AttributesEntry
|
||||||
0, // 2: xray.app.router.command.TestRouteRequest.RoutingContext:type_name -> xray.app.router.command.RoutingContext
|
0, // 2: xray.app.router.command.TestRouteRequest.RoutingContext:type_name -> xray.app.router.command.RoutingContext
|
||||||
4, // 3: xray.app.router.command.BalancerMsg.override:type_name -> xray.app.router.command.OverrideInfo
|
4, // 3: xray.app.router.command.BalancerMsg.override:type_name -> xray.app.router.command.OverrideInfo
|
||||||
3, // 4: xray.app.router.command.BalancerMsg.principle_target:type_name -> xray.app.router.command.PrincipleTargetInfo
|
3, // 4: xray.app.router.command.BalancerMsg.principle_target:type_name -> xray.app.router.command.PrincipleTargetInfo
|
||||||
5, // 5: xray.app.router.command.GetBalancerInfoResponse.balancer:type_name -> xray.app.router.command.BalancerMsg
|
5, // 5: xray.app.router.command.GetBalancerInfoResponse.balancer:type_name -> xray.app.router.command.BalancerMsg
|
||||||
17, // 6: xray.app.router.command.AddRuleRequest.config:type_name -> xray.common.serial.TypedMessage
|
20, // 6: xray.app.router.command.AddRuleRequest.config:type_name -> xray.common.serial.TypedMessage
|
||||||
1, // 7: xray.app.router.command.RoutingService.SubscribeRoutingStats:input_type -> xray.app.router.command.SubscribeRoutingStatsRequest
|
15, // 7: xray.app.router.command.ListRuleResponse.rules:type_name -> xray.app.router.command.ListRuleItem
|
||||||
2, // 8: xray.app.router.command.RoutingService.TestRoute:input_type -> xray.app.router.command.TestRouteRequest
|
1, // 8: xray.app.router.command.RoutingService.SubscribeRoutingStats:input_type -> xray.app.router.command.SubscribeRoutingStatsRequest
|
||||||
6, // 9: xray.app.router.command.RoutingService.GetBalancerInfo:input_type -> xray.app.router.command.GetBalancerInfoRequest
|
2, // 9: xray.app.router.command.RoutingService.TestRoute:input_type -> xray.app.router.command.TestRouteRequest
|
||||||
8, // 10: xray.app.router.command.RoutingService.OverrideBalancerTarget:input_type -> xray.app.router.command.OverrideBalancerTargetRequest
|
6, // 10: xray.app.router.command.RoutingService.GetBalancerInfo:input_type -> xray.app.router.command.GetBalancerInfoRequest
|
||||||
10, // 11: xray.app.router.command.RoutingService.AddRule:input_type -> xray.app.router.command.AddRuleRequest
|
8, // 11: xray.app.router.command.RoutingService.OverrideBalancerTarget:input_type -> xray.app.router.command.OverrideBalancerTargetRequest
|
||||||
12, // 12: xray.app.router.command.RoutingService.RemoveRule:input_type -> xray.app.router.command.RemoveRuleRequest
|
10, // 12: xray.app.router.command.RoutingService.AddRule:input_type -> xray.app.router.command.AddRuleRequest
|
||||||
0, // 13: xray.app.router.command.RoutingService.SubscribeRoutingStats:output_type -> xray.app.router.command.RoutingContext
|
12, // 13: xray.app.router.command.RoutingService.RemoveRule:input_type -> xray.app.router.command.RemoveRuleRequest
|
||||||
0, // 14: xray.app.router.command.RoutingService.TestRoute:output_type -> xray.app.router.command.RoutingContext
|
14, // 14: xray.app.router.command.RoutingService.ListRule:input_type -> xray.app.router.command.ListRuleRequest
|
||||||
7, // 15: xray.app.router.command.RoutingService.GetBalancerInfo:output_type -> xray.app.router.command.GetBalancerInfoResponse
|
0, // 15: xray.app.router.command.RoutingService.SubscribeRoutingStats:output_type -> xray.app.router.command.RoutingContext
|
||||||
9, // 16: xray.app.router.command.RoutingService.OverrideBalancerTarget:output_type -> xray.app.router.command.OverrideBalancerTargetResponse
|
0, // 16: xray.app.router.command.RoutingService.TestRoute:output_type -> xray.app.router.command.RoutingContext
|
||||||
11, // 17: xray.app.router.command.RoutingService.AddRule:output_type -> xray.app.router.command.AddRuleResponse
|
7, // 17: xray.app.router.command.RoutingService.GetBalancerInfo:output_type -> xray.app.router.command.GetBalancerInfoResponse
|
||||||
13, // 18: xray.app.router.command.RoutingService.RemoveRule:output_type -> xray.app.router.command.RemoveRuleResponse
|
9, // 18: xray.app.router.command.RoutingService.OverrideBalancerTarget:output_type -> xray.app.router.command.OverrideBalancerTargetResponse
|
||||||
13, // [13:19] is the sub-list for method output_type
|
11, // 19: xray.app.router.command.RoutingService.AddRule:output_type -> xray.app.router.command.AddRuleResponse
|
||||||
7, // [7:13] is the sub-list for method input_type
|
13, // 20: xray.app.router.command.RoutingService.RemoveRule:output_type -> xray.app.router.command.RemoveRuleResponse
|
||||||
7, // [7:7] is the sub-list for extension type_name
|
16, // 21: xray.app.router.command.RoutingService.ListRule:output_type -> xray.app.router.command.ListRuleResponse
|
||||||
7, // [7:7] is the sub-list for extension extendee
|
15, // [15:22] is the sub-list for method output_type
|
||||||
0, // [0:7] is the sub-list for field type_name
|
8, // [8:15] is the sub-list for method input_type
|
||||||
|
8, // [8:8] is the sub-list for extension type_name
|
||||||
|
8, // [8:8] is the sub-list for extension extendee
|
||||||
|
0, // [0:8] is the sub-list for field type_name
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { file_app_router_command_command_proto_init() }
|
func init() { file_app_router_command_command_proto_init() }
|
||||||
@@ -1075,9 +1119,9 @@ func file_app_router_command_command_proto_init() {
|
|||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_app_router_command_command_proto_rawDesc,
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_app_router_command_command_proto_rawDesc), len(file_app_router_command_command_proto_rawDesc)),
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 16,
|
NumMessages: 19,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 1,
|
NumServices: 1,
|
||||||
},
|
},
|
||||||
@@ -1086,7 +1130,6 @@ func file_app_router_command_command_proto_init() {
|
|||||||
MessageInfos: file_app_router_command_command_proto_msgTypes,
|
MessageInfos: file_app_router_command_command_proto_msgTypes,
|
||||||
}.Build()
|
}.Build()
|
||||||
File_app_router_command_command_proto = out.File
|
File_app_router_command_command_proto = out.File
|
||||||
file_app_router_command_command_proto_rawDesc = nil
|
|
||||||
file_app_router_command_command_proto_goTypes = nil
|
file_app_router_command_command_proto_goTypes = nil
|
||||||
file_app_router_command_command_proto_depIdxs = nil
|
file_app_router_command_command_proto_depIdxs = nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,6 +104,17 @@ message RemoveRuleRequest {
|
|||||||
|
|
||||||
message RemoveRuleResponse {}
|
message RemoveRuleResponse {}
|
||||||
|
|
||||||
|
message ListRuleRequest {}
|
||||||
|
|
||||||
|
message ListRuleItem {
|
||||||
|
string tag = 1;
|
||||||
|
string ruleTag = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ListRuleResponse{
|
||||||
|
repeated ListRuleItem rules = 1;
|
||||||
|
}
|
||||||
|
|
||||||
service RoutingService {
|
service RoutingService {
|
||||||
rpc SubscribeRoutingStats(SubscribeRoutingStatsRequest)
|
rpc SubscribeRoutingStats(SubscribeRoutingStatsRequest)
|
||||||
returns (stream RoutingContext) {}
|
returns (stream RoutingContext) {}
|
||||||
@@ -114,6 +125,8 @@ service RoutingService {
|
|||||||
|
|
||||||
rpc AddRule(AddRuleRequest) returns (AddRuleResponse) {}
|
rpc AddRule(AddRuleRequest) returns (AddRuleResponse) {}
|
||||||
rpc RemoveRule(RemoveRuleRequest) returns (RemoveRuleResponse) {}
|
rpc RemoveRule(RemoveRuleRequest) returns (RemoveRuleResponse) {}
|
||||||
|
|
||||||
|
rpc ListRule(ListRuleRequest) returns (ListRuleResponse) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
message Config {}
|
message Config {}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// 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.6.0
|
||||||
// - protoc v5.28.2
|
// - protoc v6.33.5
|
||||||
// source: app/router/command/command.proto
|
// source: app/router/command/command.proto
|
||||||
|
|
||||||
package command
|
package command
|
||||||
@@ -25,6 +25,7 @@ const (
|
|||||||
RoutingService_OverrideBalancerTarget_FullMethodName = "/xray.app.router.command.RoutingService/OverrideBalancerTarget"
|
RoutingService_OverrideBalancerTarget_FullMethodName = "/xray.app.router.command.RoutingService/OverrideBalancerTarget"
|
||||||
RoutingService_AddRule_FullMethodName = "/xray.app.router.command.RoutingService/AddRule"
|
RoutingService_AddRule_FullMethodName = "/xray.app.router.command.RoutingService/AddRule"
|
||||||
RoutingService_RemoveRule_FullMethodName = "/xray.app.router.command.RoutingService/RemoveRule"
|
RoutingService_RemoveRule_FullMethodName = "/xray.app.router.command.RoutingService/RemoveRule"
|
||||||
|
RoutingService_ListRule_FullMethodName = "/xray.app.router.command.RoutingService/ListRule"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RoutingServiceClient is the client API for RoutingService service.
|
// RoutingServiceClient is the client API for RoutingService service.
|
||||||
@@ -37,6 +38,7 @@ type RoutingServiceClient interface {
|
|||||||
OverrideBalancerTarget(ctx context.Context, in *OverrideBalancerTargetRequest, opts ...grpc.CallOption) (*OverrideBalancerTargetResponse, error)
|
OverrideBalancerTarget(ctx context.Context, in *OverrideBalancerTargetRequest, opts ...grpc.CallOption) (*OverrideBalancerTargetResponse, error)
|
||||||
AddRule(ctx context.Context, in *AddRuleRequest, opts ...grpc.CallOption) (*AddRuleResponse, error)
|
AddRule(ctx context.Context, in *AddRuleRequest, opts ...grpc.CallOption) (*AddRuleResponse, error)
|
||||||
RemoveRule(ctx context.Context, in *RemoveRuleRequest, opts ...grpc.CallOption) (*RemoveRuleResponse, error)
|
RemoveRule(ctx context.Context, in *RemoveRuleRequest, opts ...grpc.CallOption) (*RemoveRuleResponse, error)
|
||||||
|
ListRule(ctx context.Context, in *ListRuleRequest, opts ...grpc.CallOption) (*ListRuleResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type routingServiceClient struct {
|
type routingServiceClient struct {
|
||||||
@@ -116,6 +118,16 @@ func (c *routingServiceClient) RemoveRule(ctx context.Context, in *RemoveRuleReq
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *routingServiceClient) ListRule(ctx context.Context, in *ListRuleRequest, opts ...grpc.CallOption) (*ListRuleResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(ListRuleResponse)
|
||||||
|
err := c.cc.Invoke(ctx, RoutingService_ListRule_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
// 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.
|
||||||
@@ -126,6 +138,7 @@ type RoutingServiceServer interface {
|
|||||||
OverrideBalancerTarget(context.Context, *OverrideBalancerTargetRequest) (*OverrideBalancerTargetResponse, error)
|
OverrideBalancerTarget(context.Context, *OverrideBalancerTargetRequest) (*OverrideBalancerTargetResponse, error)
|
||||||
AddRule(context.Context, *AddRuleRequest) (*AddRuleResponse, error)
|
AddRule(context.Context, *AddRuleRequest) (*AddRuleResponse, error)
|
||||||
RemoveRule(context.Context, *RemoveRuleRequest) (*RemoveRuleResponse, error)
|
RemoveRule(context.Context, *RemoveRuleRequest) (*RemoveRuleResponse, error)
|
||||||
|
ListRule(context.Context, *ListRuleRequest) (*ListRuleResponse, error)
|
||||||
mustEmbedUnimplementedRoutingServiceServer()
|
mustEmbedUnimplementedRoutingServiceServer()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,22 +150,25 @@ type RoutingServiceServer interface {
|
|||||||
type UnimplementedRoutingServiceServer struct{}
|
type UnimplementedRoutingServiceServer struct{}
|
||||||
|
|
||||||
func (UnimplementedRoutingServiceServer) SubscribeRoutingStats(*SubscribeRoutingStatsRequest, grpc.ServerStreamingServer[RoutingContext]) error {
|
func (UnimplementedRoutingServiceServer) SubscribeRoutingStats(*SubscribeRoutingStatsRequest, grpc.ServerStreamingServer[RoutingContext]) error {
|
||||||
return status.Errorf(codes.Unimplemented, "method SubscribeRoutingStats not implemented")
|
return status.Error(codes.Unimplemented, "method SubscribeRoutingStats not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedRoutingServiceServer) TestRoute(context.Context, *TestRouteRequest) (*RoutingContext, error) {
|
func (UnimplementedRoutingServiceServer) TestRoute(context.Context, *TestRouteRequest) (*RoutingContext, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method TestRoute not implemented")
|
return nil, status.Error(codes.Unimplemented, "method TestRoute not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedRoutingServiceServer) GetBalancerInfo(context.Context, *GetBalancerInfoRequest) (*GetBalancerInfoResponse, error) {
|
func (UnimplementedRoutingServiceServer) GetBalancerInfo(context.Context, *GetBalancerInfoRequest) (*GetBalancerInfoResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method GetBalancerInfo not implemented")
|
return nil, status.Error(codes.Unimplemented, "method GetBalancerInfo not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedRoutingServiceServer) OverrideBalancerTarget(context.Context, *OverrideBalancerTargetRequest) (*OverrideBalancerTargetResponse, error) {
|
func (UnimplementedRoutingServiceServer) OverrideBalancerTarget(context.Context, *OverrideBalancerTargetRequest) (*OverrideBalancerTargetResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method OverrideBalancerTarget not implemented")
|
return nil, status.Error(codes.Unimplemented, "method OverrideBalancerTarget not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedRoutingServiceServer) AddRule(context.Context, *AddRuleRequest) (*AddRuleResponse, error) {
|
func (UnimplementedRoutingServiceServer) AddRule(context.Context, *AddRuleRequest) (*AddRuleResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method AddRule not implemented")
|
return nil, status.Error(codes.Unimplemented, "method AddRule not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedRoutingServiceServer) RemoveRule(context.Context, *RemoveRuleRequest) (*RemoveRuleResponse, error) {
|
func (UnimplementedRoutingServiceServer) RemoveRule(context.Context, *RemoveRuleRequest) (*RemoveRuleResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method RemoveRule not implemented")
|
return nil, status.Error(codes.Unimplemented, "method RemoveRule not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedRoutingServiceServer) ListRule(context.Context, *ListRuleRequest) (*ListRuleResponse, error) {
|
||||||
|
return nil, status.Error(codes.Unimplemented, "method ListRule not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedRoutingServiceServer) mustEmbedUnimplementedRoutingServiceServer() {}
|
func (UnimplementedRoutingServiceServer) mustEmbedUnimplementedRoutingServiceServer() {}
|
||||||
func (UnimplementedRoutingServiceServer) testEmbeddedByValue() {}
|
func (UnimplementedRoutingServiceServer) testEmbeddedByValue() {}
|
||||||
@@ -165,7 +181,7 @@ 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
|
// If the following call panics, it indicates UnimplementedRoutingServiceServer was
|
||||||
// embedded by pointer and is nil. This will cause panics if an
|
// embedded by pointer and is nil. This will cause panics if an
|
||||||
// unimplemented method is ever invoked, so we test this at initialization
|
// unimplemented method is ever invoked, so we test this at initialization
|
||||||
// time to prevent it from happening at runtime later due to I/O.
|
// time to prevent it from happening at runtime later due to I/O.
|
||||||
@@ -276,6 +292,24 @@ func _RoutingService_RemoveRule_Handler(srv interface{}, ctx context.Context, de
|
|||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func _RoutingService_ListRule_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(ListRuleRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(RoutingServiceServer).ListRule(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: RoutingService_ListRule_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(RoutingServiceServer).ListRule(ctx, req.(*ListRuleRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
// RoutingService_ServiceDesc is the grpc.ServiceDesc for RoutingService service.
|
// RoutingService_ServiceDesc is the grpc.ServiceDesc for RoutingService service.
|
||||||
// It's only intended for direct use with grpc.RegisterService,
|
// It's only intended for direct use with grpc.RegisterService,
|
||||||
// and not to be introspected or modified (even as a copy)
|
// and not to be introspected or modified (even as a copy)
|
||||||
@@ -303,6 +337,10 @@ var RoutingService_ServiceDesc = grpc.ServiceDesc{
|
|||||||
MethodName: "RemoveRule",
|
MethodName: "RemoveRule",
|
||||||
Handler: _RoutingService_RemoveRule_Handler,
|
Handler: _RoutingService_RemoveRule_Handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
MethodName: "ListRule",
|
||||||
|
Handler: _RoutingService_ListRule_Handler,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Streams: []grpc.StreamDesc{
|
Streams: []grpc.StreamDesc{
|
||||||
{
|
{
|
||||||
|
|||||||
+37
-47
@@ -2,6 +2,7 @@ package router
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
@@ -52,12 +53,40 @@ var matcherTypeMap = map[Domain_Type]strmatcher.Type{
|
|||||||
}
|
}
|
||||||
|
|
||||||
type DomainMatcher struct {
|
type DomainMatcher struct {
|
||||||
matchers strmatcher.IndexMatcher
|
Matchers strmatcher.IndexMatcher
|
||||||
|
}
|
||||||
|
|
||||||
|
func SerializeDomainMatcher(domains []*Domain, w io.Writer) error {
|
||||||
|
|
||||||
|
g := strmatcher.NewMphMatcherGroup()
|
||||||
|
for _, d := range domains {
|
||||||
|
matcherType, f := matcherTypeMap[d.Type]
|
||||||
|
if !f {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err := g.AddPattern(d.Value, matcherType)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
g.Build()
|
||||||
|
// serialize
|
||||||
|
return g.Serialize(w)
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewDomainMatcherFromBuffer(data []byte) (*strmatcher.MphMatcherGroup, error) {
|
||||||
|
matcher, err := strmatcher.NewMphMatcherGroupFromBuffer(data)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return matcher, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewMphMatcherGroup(domains []*Domain) (*DomainMatcher, error) {
|
func NewMphMatcherGroup(domains []*Domain) (*DomainMatcher, error) {
|
||||||
g := strmatcher.NewMphMatcherGroup()
|
g := strmatcher.NewMphMatcherGroup()
|
||||||
for _, d := range domains {
|
for i, d := range domains {
|
||||||
|
domains[i] = nil
|
||||||
matcherType, f := matcherTypeMap[d.Type]
|
matcherType, f := matcherTypeMap[d.Type]
|
||||||
if !f {
|
if !f {
|
||||||
errors.LogError(context.Background(), "ignore unsupported domain type ", d.Type, " of rule ", d.Value)
|
errors.LogError(context.Background(), "ignore unsupported domain type ", d.Type, " of rule ", d.Value)
|
||||||
@@ -71,12 +100,12 @@ func NewMphMatcherGroup(domains []*Domain) (*DomainMatcher, error) {
|
|||||||
}
|
}
|
||||||
g.Build()
|
g.Build()
|
||||||
return &DomainMatcher{
|
return &DomainMatcher{
|
||||||
matchers: g,
|
Matchers: g,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *DomainMatcher) ApplyDomain(domain string) bool {
|
func (m *DomainMatcher) ApplyDomain(domain string) bool {
|
||||||
return len(m.matchers.Match(strings.ToLower(domain))) > 0
|
return len(m.Matchers.Match(strings.ToLower(domain))) > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply implements Condition.
|
// Apply implements Condition.
|
||||||
@@ -309,48 +338,6 @@ func (m *AttributeMatcher) Apply(ctx routing.Context) bool {
|
|||||||
return m.Match(attributes)
|
return m.Match(attributes)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Geo attribute
|
|
||||||
type GeoAttributeMatcher interface {
|
|
||||||
Match(*Domain) bool
|
|
||||||
}
|
|
||||||
|
|
||||||
type GeoBooleanMatcher string
|
|
||||||
|
|
||||||
func (m GeoBooleanMatcher) Match(domain *Domain) bool {
|
|
||||||
for _, attr := range domain.Attribute {
|
|
||||||
if attr.Key == string(m) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
type GeoAttributeList struct {
|
|
||||||
Matcher []GeoAttributeMatcher
|
|
||||||
}
|
|
||||||
|
|
||||||
func (al *GeoAttributeList) Match(domain *Domain) bool {
|
|
||||||
for _, matcher := range al.Matcher {
|
|
||||||
if !matcher.Match(domain) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
func (al *GeoAttributeList) IsEmpty() bool {
|
|
||||||
return len(al.Matcher) == 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func ParseAttrs(attrs []string) *GeoAttributeList {
|
|
||||||
al := new(GeoAttributeList)
|
|
||||||
for _, attr := range attrs {
|
|
||||||
lc := strings.ToLower(attr)
|
|
||||||
al.Matcher = append(al.Matcher, GeoBooleanMatcher(lc))
|
|
||||||
}
|
|
||||||
return al
|
|
||||||
}
|
|
||||||
|
|
||||||
type ProcessNameMatcher struct {
|
type ProcessNameMatcher struct {
|
||||||
ProcessNames []string
|
ProcessNames []string
|
||||||
AbsPaths []string
|
AbsPaths []string
|
||||||
@@ -400,6 +387,9 @@ func NewProcessNameMatcher(names []string) *ProcessNameMatcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *ProcessNameMatcher) Apply(ctx routing.Context) bool {
|
func (m *ProcessNameMatcher) Apply(ctx routing.Context) bool {
|
||||||
|
if len(ctx.GetSourceIPs()) == 0 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
srcPort := ctx.GetSourcePort().String()
|
srcPort := ctx.GetSourcePort().String()
|
||||||
srcIP := ctx.GetSourceIPs()[0].String()
|
srcIP := ctx.GetSourceIPs()[0].String()
|
||||||
var network string
|
var network string
|
||||||
@@ -439,4 +429,4 @@ func (m *ProcessNameMatcher) Apply(ctx routing.Context) bool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -822,7 +822,8 @@ func (f *GeoIPSetFactory) Create(cidrGroups ...[]*CIDR) (*GeoIPSet, error) {
|
|||||||
var ipv4Builder, ipv6Builder netipx.IPSetBuilder
|
var ipv4Builder, ipv6Builder netipx.IPSetBuilder
|
||||||
|
|
||||||
for _, cidrGroup := range cidrGroups {
|
for _, cidrGroup := range cidrGroups {
|
||||||
for _, cidrEntry := range cidrGroup {
|
for i, cidrEntry := range cidrGroup {
|
||||||
|
cidrGroup[i] = nil
|
||||||
ipBytes := cidrEntry.GetIp()
|
ipBytes := cidrEntry.GetIp()
|
||||||
prefixLen := int(cidrEntry.GetPrefix())
|
prefixLen := int(cidrEntry.GetPrefix())
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,40 @@
|
|||||||
package router_test
|
package router_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/xtls/xray-core/app/router"
|
"github.com/xtls/xray-core/app/router"
|
||||||
"github.com/xtls/xray-core/common"
|
"github.com/xtls/xray-core/common"
|
||||||
"github.com/xtls/xray-core/common/net"
|
"github.com/xtls/xray-core/common/net"
|
||||||
"github.com/xtls/xray-core/infra/conf"
|
"github.com/xtls/xray-core/common/platform"
|
||||||
|
"github.com/xtls/xray-core/common/platform/filesystem"
|
||||||
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func getAssetPath(file string) (string, error) {
|
||||||
|
path := platform.GetAssetLocation(file)
|
||||||
|
_, err := os.Stat(path)
|
||||||
|
if os.IsNotExist(err) {
|
||||||
|
path := filepath.Join("..", "..", "resources", file)
|
||||||
|
_, err := os.Stat(path)
|
||||||
|
if os.IsNotExist(err) {
|
||||||
|
return "", fmt.Errorf("can't find %s in standard asset locations or {project_root}/resources", file)
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
return "", fmt.Errorf("can't stat %s: %v", path, err)
|
||||||
|
}
|
||||||
|
return path, nil
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
return "", fmt.Errorf("can't stat %s: %v", path, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return path, nil
|
||||||
|
}
|
||||||
|
|
||||||
func TestGeoIPMatcher(t *testing.T) {
|
func TestGeoIPMatcher(t *testing.T) {
|
||||||
cidrList := []*router.CIDR{
|
cidrList := []*router.CIDR{
|
||||||
{Ip: []byte{0, 0, 0, 0}, Prefix: 8},
|
{Ip: []byte{0, 0, 0, 0}, Prefix: 8},
|
||||||
@@ -159,11 +182,12 @@ func TestGeoIPReverseMatcher(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGeoIPMatcher4CN(t *testing.T) {
|
func TestGeoIPMatcher4CN(t *testing.T) {
|
||||||
geo := "geoip:cn"
|
ips, err := loadGeoIP("CN")
|
||||||
geoip, err := loadGeoIP(geo)
|
|
||||||
common.Must(err)
|
common.Must(err)
|
||||||
|
|
||||||
matcher, err := router.BuildOptimizedGeoIPMatcher(geoip)
|
matcher, err := router.BuildOptimizedGeoIPMatcher(&router.GeoIP{
|
||||||
|
Cidr: ips,
|
||||||
|
})
|
||||||
common.Must(err)
|
common.Must(err)
|
||||||
|
|
||||||
if matcher.Match([]byte{8, 8, 8, 8}) {
|
if matcher.Match([]byte{8, 8, 8, 8}) {
|
||||||
@@ -172,11 +196,12 @@ func TestGeoIPMatcher4CN(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGeoIPMatcher6US(t *testing.T) {
|
func TestGeoIPMatcher6US(t *testing.T) {
|
||||||
geo := "geoip:us"
|
ips, err := loadGeoIP("US")
|
||||||
geoip, err := loadGeoIP(geo)
|
|
||||||
common.Must(err)
|
common.Must(err)
|
||||||
|
|
||||||
matcher, err := router.BuildOptimizedGeoIPMatcher(geoip)
|
matcher, err := router.BuildOptimizedGeoIPMatcher(&router.GeoIP{
|
||||||
|
Cidr: ips,
|
||||||
|
})
|
||||||
common.Must(err)
|
common.Must(err)
|
||||||
|
|
||||||
if !matcher.Match(net.ParseAddress("2001:4860:4860::8888").IP()) {
|
if !matcher.Match(net.ParseAddress("2001:4860:4860::8888").IP()) {
|
||||||
@@ -184,34 +209,37 @@ func TestGeoIPMatcher6US(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadGeoIP(geo string) (*router.GeoIP, error) {
|
func loadGeoIP(country string) ([]*router.CIDR, error) {
|
||||||
os.Setenv("XRAY_LOCATION_ASSET", filepath.Join("..", "..", "resources"))
|
path, err := getAssetPath("geoip.dat")
|
||||||
|
if err != nil {
|
||||||
geoip, err := conf.ToCidrList([]string{geo})
|
return nil, err
|
||||||
|
}
|
||||||
|
geoipBytes, err := filesystem.ReadFile(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if runtime.GOOS != "windows" && runtime.GOOS != "wasm" {
|
var geoipList router.GeoIPList
|
||||||
geoip, err = router.GetGeoIPList(geoip)
|
if err := proto.Unmarshal(geoipBytes, &geoipList); err != nil {
|
||||||
if err != nil {
|
return nil, err
|
||||||
return nil, err
|
}
|
||||||
|
|
||||||
|
for _, geoip := range geoipList.Entry {
|
||||||
|
if geoip.CountryCode == country {
|
||||||
|
return geoip.Cidr, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(geoip) == 0 {
|
panic("country not found: " + country)
|
||||||
panic("country not found: " + geo)
|
|
||||||
}
|
|
||||||
|
|
||||||
return geoip[0], nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func BenchmarkGeoIPMatcher4CN(b *testing.B) {
|
func BenchmarkGeoIPMatcher4CN(b *testing.B) {
|
||||||
geo := "geoip:cn"
|
ips, err := loadGeoIP("CN")
|
||||||
geoip, err := loadGeoIP(geo)
|
|
||||||
common.Must(err)
|
common.Must(err)
|
||||||
|
|
||||||
matcher, err := router.BuildOptimizedGeoIPMatcher(geoip)
|
matcher, err := router.BuildOptimizedGeoIPMatcher(&router.GeoIP{
|
||||||
|
Cidr: ips,
|
||||||
|
})
|
||||||
common.Must(err)
|
common.Must(err)
|
||||||
|
|
||||||
b.ResetTimer()
|
b.ResetTimer()
|
||||||
@@ -222,11 +250,12 @@ func BenchmarkGeoIPMatcher4CN(b *testing.B) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func BenchmarkGeoIPMatcher6US(b *testing.B) {
|
func BenchmarkGeoIPMatcher6US(b *testing.B) {
|
||||||
geo := "geoip:us"
|
ips, err := loadGeoIP("US")
|
||||||
geoip, err := loadGeoIP(geo)
|
|
||||||
common.Must(err)
|
common.Must(err)
|
||||||
|
|
||||||
matcher, err := router.BuildOptimizedGeoIPMatcher(geoip)
|
matcher, err := router.BuildOptimizedGeoIPMatcher(&router.GeoIP{
|
||||||
|
Cidr: ips,
|
||||||
|
})
|
||||||
common.Must(err)
|
common.Must(err)
|
||||||
|
|
||||||
b.ResetTimer()
|
b.ResetTimer()
|
||||||
|
|||||||
@@ -0,0 +1,167 @@
|
|||||||
|
package router_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
"github.com/xtls/xray-core/app/router"
|
||||||
|
"github.com/xtls/xray-core/common/platform/filesystem"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestDomainMatcherSerialization(t *testing.T) {
|
||||||
|
|
||||||
|
domains := []*router.Domain{
|
||||||
|
{Type: router.Domain_Domain, Value: "google.com"},
|
||||||
|
{Type: router.Domain_Domain, Value: "v2ray.com"},
|
||||||
|
{Type: router.Domain_Full, Value: "full.example.com"},
|
||||||
|
}
|
||||||
|
|
||||||
|
var buf bytes.Buffer
|
||||||
|
if err := router.SerializeDomainMatcher(domains, &buf); err != nil {
|
||||||
|
t.Fatalf("Serialize failed: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
matcher, err := router.NewDomainMatcherFromBuffer(buf.Bytes())
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("Deserialize failed: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
dMatcher := &router.DomainMatcher{
|
||||||
|
Matchers: matcher,
|
||||||
|
}
|
||||||
|
testCases := []struct {
|
||||||
|
Input string
|
||||||
|
Match bool
|
||||||
|
}{
|
||||||
|
{"google.com", true},
|
||||||
|
{"maps.google.com", true},
|
||||||
|
{"v2ray.com", true},
|
||||||
|
{"full.example.com", true},
|
||||||
|
|
||||||
|
{"example.com", false},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, tc := range testCases {
|
||||||
|
if res := dMatcher.ApplyDomain(tc.Input); res != tc.Match {
|
||||||
|
t.Errorf("Match(%s) = %v, want %v", tc.Input, res, tc.Match)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestGeoSiteSerialization(t *testing.T) {
|
||||||
|
sites := []*router.GeoSite{
|
||||||
|
{
|
||||||
|
CountryCode: "CN",
|
||||||
|
Domain: []*router.Domain{
|
||||||
|
{Type: router.Domain_Domain, Value: "baidu.cn"},
|
||||||
|
{Type: router.Domain_Domain, Value: "qq.com"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
CountryCode: "US",
|
||||||
|
Domain: []*router.Domain{
|
||||||
|
{Type: router.Domain_Domain, Value: "google.com"},
|
||||||
|
{Type: router.Domain_Domain, Value: "facebook.com"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
var buf bytes.Buffer
|
||||||
|
if err := router.SerializeGeoSiteList(sites, nil, nil, &buf); err != nil {
|
||||||
|
t.Fatalf("SerializeGeoSiteList failed: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
tmp := t.TempDir()
|
||||||
|
path := filepath.Join(tmp, "matcher.cache")
|
||||||
|
|
||||||
|
f, err := os.Create(path)
|
||||||
|
require.NoError(t, err)
|
||||||
|
_, err = f.Write(buf.Bytes())
|
||||||
|
require.NoError(t, err)
|
||||||
|
f.Close()
|
||||||
|
|
||||||
|
f, err = os.Open(path)
|
||||||
|
require.NoError(t, err)
|
||||||
|
defer f.Close()
|
||||||
|
|
||||||
|
require.NoError(t, err)
|
||||||
|
data, _ := filesystem.ReadFile(path)
|
||||||
|
|
||||||
|
// cn
|
||||||
|
gp, err := router.LoadGeoSiteMatcher(bytes.NewReader(data), "CN")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("LoadGeoSiteMatcher(CN) failed: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
cnMatcher := &router.DomainMatcher{
|
||||||
|
Matchers: gp,
|
||||||
|
}
|
||||||
|
|
||||||
|
if !cnMatcher.ApplyDomain("baidu.cn") {
|
||||||
|
t.Error("CN matcher should match baidu.cn")
|
||||||
|
}
|
||||||
|
if cnMatcher.ApplyDomain("google.com") {
|
||||||
|
t.Error("CN matcher should NOT match google.com")
|
||||||
|
}
|
||||||
|
|
||||||
|
// us
|
||||||
|
gp, err = router.LoadGeoSiteMatcher(bytes.NewReader(data), "US")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("LoadGeoSiteMatcher(US) failed: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
usMatcher := &router.DomainMatcher{
|
||||||
|
Matchers: gp,
|
||||||
|
}
|
||||||
|
if !usMatcher.ApplyDomain("google.com") {
|
||||||
|
t.Error("US matcher should match google.com")
|
||||||
|
}
|
||||||
|
if usMatcher.ApplyDomain("baidu.cn") {
|
||||||
|
t.Error("US matcher should NOT match baidu.cn")
|
||||||
|
}
|
||||||
|
|
||||||
|
// unknown
|
||||||
|
_, err = router.LoadGeoSiteMatcher(bytes.NewReader(data), "unknown")
|
||||||
|
if err == nil {
|
||||||
|
t.Error("LoadGeoSiteMatcher(unknown) should fail")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func TestGeoSiteSerializationWithDeps(t *testing.T) {
|
||||||
|
sites := []*router.GeoSite{
|
||||||
|
{
|
||||||
|
CountryCode: "geosite:cn",
|
||||||
|
Domain: []*router.Domain{
|
||||||
|
{Type: router.Domain_Domain, Value: "baidu.cn"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
CountryCode: "geosite:google@cn",
|
||||||
|
Domain: []*router.Domain{
|
||||||
|
{Type: router.Domain_Domain, Value: "google.cn"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
CountryCode: "rule-1",
|
||||||
|
Domain: []*router.Domain{
|
||||||
|
{Type: router.Domain_Domain, Value: "google.com"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
deps := map[string][]string{
|
||||||
|
"rule-1": {"geosite:cn", "geosite:google@cn"},
|
||||||
|
}
|
||||||
|
|
||||||
|
var buf bytes.Buffer
|
||||||
|
err := router.SerializeGeoSiteList(sites, deps, nil, &buf)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
matcher, err := router.LoadGeoSiteMatcher(bytes.NewReader(buf.Bytes()), "rule-1")
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
require.True(t, matcher.Match("google.com") != nil)
|
||||||
|
require.True(t, matcher.Match("baidu.cn") != nil)
|
||||||
|
require.True(t, matcher.Match("google.cn") != nil)
|
||||||
|
}
|
||||||
@@ -1,22 +1,20 @@
|
|||||||
package router_test
|
package router_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
"runtime"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/xtls/xray-core/app/router"
|
|
||||||
. "github.com/xtls/xray-core/app/router"
|
. "github.com/xtls/xray-core/app/router"
|
||||||
"github.com/xtls/xray-core/common"
|
"github.com/xtls/xray-core/common"
|
||||||
|
"github.com/xtls/xray-core/common/errors"
|
||||||
"github.com/xtls/xray-core/common/net"
|
"github.com/xtls/xray-core/common/net"
|
||||||
|
"github.com/xtls/xray-core/common/platform/filesystem"
|
||||||
"github.com/xtls/xray-core/common/protocol"
|
"github.com/xtls/xray-core/common/protocol"
|
||||||
"github.com/xtls/xray-core/common/protocol/http"
|
"github.com/xtls/xray-core/common/protocol/http"
|
||||||
"github.com/xtls/xray-core/common/session"
|
"github.com/xtls/xray-core/common/session"
|
||||||
"github.com/xtls/xray-core/features/routing"
|
"github.com/xtls/xray-core/features/routing"
|
||||||
routing_session "github.com/xtls/xray-core/features/routing/session"
|
routing_session "github.com/xtls/xray-core/features/routing/session"
|
||||||
"github.com/xtls/xray-core/infra/conf"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func withBackground() routing.Context {
|
func withBackground() routing.Context {
|
||||||
@@ -302,25 +300,32 @@ func TestRoutingRule(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadGeoSiteDomains(geo string) ([]*Domain, error) {
|
func loadGeoSite(country string) ([]*Domain, error) {
|
||||||
os.Setenv("XRAY_LOCATION_ASSET", filepath.Join("..", "..", "resources"))
|
path, err := getAssetPath("geosite.dat")
|
||||||
|
if err != nil {
|
||||||
domains, err := conf.ParseDomainRule(geo)
|
return nil, err
|
||||||
|
}
|
||||||
|
geositeBytes, err := filesystem.ReadFile(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if runtime.GOOS != "windows" && runtime.GOOS != "wasm" {
|
var geositeList GeoSiteList
|
||||||
domains, err = router.GetDomainList(domains)
|
if err := proto.Unmarshal(geositeBytes, &geositeList); err != nil {
|
||||||
if err != nil {
|
return nil, err
|
||||||
return nil, err
|
}
|
||||||
|
|
||||||
|
for _, site := range geositeList.Entry {
|
||||||
|
if site.CountryCode == country {
|
||||||
|
return site.Domain, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return domains, nil
|
|
||||||
|
return nil, errors.New("country not found: " + country)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestChinaSites(t *testing.T) {
|
func TestChinaSites(t *testing.T) {
|
||||||
domains, err := loadGeoSiteDomains("geosite:cn")
|
domains, err := loadGeoSite("CN")
|
||||||
common.Must(err)
|
common.Must(err)
|
||||||
|
|
||||||
acMatcher, err := NewMphMatcherGroup(domains)
|
acMatcher, err := NewMphMatcherGroup(domains)
|
||||||
@@ -361,50 +366,8 @@ func TestChinaSites(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestChinaSitesWithAttrs(t *testing.T) {
|
|
||||||
domains, err := loadGeoSiteDomains("geosite:google@cn")
|
|
||||||
common.Must(err)
|
|
||||||
|
|
||||||
acMatcher, err := NewMphMatcherGroup(domains)
|
|
||||||
common.Must(err)
|
|
||||||
|
|
||||||
type TestCase struct {
|
|
||||||
Domain string
|
|
||||||
Output bool
|
|
||||||
}
|
|
||||||
testCases := []TestCase{
|
|
||||||
{
|
|
||||||
Domain: "google.cn",
|
|
||||||
Output: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Domain: "recaptcha.net",
|
|
||||||
Output: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Domain: "164.com",
|
|
||||||
Output: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Domain: "164.com",
|
|
||||||
Output: false,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
for i := 0; i < 1024; i++ {
|
|
||||||
testCases = append(testCases, TestCase{Domain: strconv.Itoa(i) + ".not-exists.com", Output: false})
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, testCase := range testCases {
|
|
||||||
r := acMatcher.ApplyDomain(testCase.Domain)
|
|
||||||
if r != testCase.Output {
|
|
||||||
t.Error("ACDomainMatcher expected output ", testCase.Output, " for domain ", testCase.Domain, " but got ", r)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func BenchmarkMphDomainMatcher(b *testing.B) {
|
func BenchmarkMphDomainMatcher(b *testing.B) {
|
||||||
domains, err := loadGeoSiteDomains("geosite:cn")
|
domains, err := loadGeoSite("CN")
|
||||||
common.Must(err)
|
common.Must(err)
|
||||||
|
|
||||||
matcher, err := NewMphMatcherGroup(domains)
|
matcher, err := NewMphMatcherGroup(domains)
|
||||||
@@ -449,11 +412,11 @@ func BenchmarkMultiGeoIPMatcher(b *testing.B) {
|
|||||||
var geoips []*GeoIP
|
var geoips []*GeoIP
|
||||||
|
|
||||||
{
|
{
|
||||||
ips, err := loadGeoIP("geoip:cn")
|
ips, err := loadGeoIP("CN")
|
||||||
common.Must(err)
|
common.Must(err)
|
||||||
geoips = append(geoips, &GeoIP{
|
geoips = append(geoips, &GeoIP{
|
||||||
CountryCode: "CN",
|
CountryCode: "CN",
|
||||||
Cidr: ips.Cidr,
|
Cidr: ips,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -462,25 +425,25 @@ func BenchmarkMultiGeoIPMatcher(b *testing.B) {
|
|||||||
common.Must(err)
|
common.Must(err)
|
||||||
geoips = append(geoips, &GeoIP{
|
geoips = append(geoips, &GeoIP{
|
||||||
CountryCode: "JP",
|
CountryCode: "JP",
|
||||||
Cidr: ips.Cidr,
|
Cidr: ips,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
ips, err := loadGeoIP("geoip:ca")
|
ips, err := loadGeoIP("CA")
|
||||||
common.Must(err)
|
common.Must(err)
|
||||||
geoips = append(geoips, &GeoIP{
|
geoips = append(geoips, &GeoIP{
|
||||||
CountryCode: "CA",
|
CountryCode: "CA",
|
||||||
Cidr: ips.Cidr,
|
Cidr: ips,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
ips, err := loadGeoIP("geoip:us")
|
ips, err := loadGeoIP("US")
|
||||||
common.Must(err)
|
common.Must(err)
|
||||||
geoips = append(geoips, &GeoIP{
|
geoips = append(geoips, &GeoIP{
|
||||||
CountryCode: "US",
|
CountryCode: "US",
|
||||||
Cidr: ips.Cidr,
|
Cidr: ips,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+41
-95
@@ -7,10 +7,10 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/xtls/xray-core/common/errors"
|
"github.com/xtls/xray-core/common/errors"
|
||||||
|
"github.com/xtls/xray-core/common/platform"
|
||||||
"github.com/xtls/xray-core/common/platform/filesystem"
|
"github.com/xtls/xray-core/common/platform/filesystem"
|
||||||
"github.com/xtls/xray-core/features/outbound"
|
"github.com/xtls/xray-core/features/outbound"
|
||||||
"github.com/xtls/xray-core/features/routing"
|
"github.com/xtls/xray-core/features/routing"
|
||||||
"google.golang.org/protobuf/proto"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Rule struct {
|
type Rule struct {
|
||||||
@@ -18,6 +18,7 @@ type Rule struct {
|
|||||||
RuleTag string
|
RuleTag string
|
||||||
Balancer *Balancer
|
Balancer *Balancer
|
||||||
Condition Condition
|
Condition Condition
|
||||||
|
Webhook *WebhookNotifier
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Rule) GetTag() (string, error) {
|
func (r *Rule) GetTag() (string, error) {
|
||||||
@@ -76,19 +77,13 @@ func (rr *RoutingRule) BuildCondition() (Condition, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(rr.Geoip) > 0 {
|
if len(rr.Geoip) > 0 {
|
||||||
geoip := rr.Geoip
|
cond, err := NewIPMatcher(rr.Geoip, MatcherAsType_Target)
|
||||||
if runtime.GOOS != "windows" && runtime.GOOS != "wasm" {
|
|
||||||
var err error
|
|
||||||
geoip, err = GetGeoIPList(rr.Geoip)
|
|
||||||
if err != nil {
|
|
||||||
return nil, errors.New("failed to build geoip from mmap").Base(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cond, err := NewIPMatcher(geoip, MatcherAsType_Target)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
conds.Add(cond)
|
conds.Add(cond)
|
||||||
|
rr.Geoip = nil
|
||||||
|
runtime.GC()
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(rr.SourceGeoip) > 0 {
|
if len(rr.SourceGeoip) > 0 {
|
||||||
@@ -97,6 +92,8 @@ func (rr *RoutingRule) BuildCondition() (Condition, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
conds.Add(cond)
|
conds.Add(cond)
|
||||||
|
rr.SourceGeoip = nil
|
||||||
|
runtime.GC()
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(rr.LocalGeoip) > 0 {
|
if len(rr.LocalGeoip) > 0 {
|
||||||
@@ -106,24 +103,33 @@ func (rr *RoutingRule) BuildCondition() (Condition, error) {
|
|||||||
}
|
}
|
||||||
conds.Add(cond)
|
conds.Add(cond)
|
||||||
errors.LogWarning(context.Background(), "Due to some limitations, in UDP connections, localIP is always equal to listen interface IP, so \"localIP\" rule condition does not work properly on UDP inbound connections that listen on all interfaces")
|
errors.LogWarning(context.Background(), "Due to some limitations, in UDP connections, localIP is always equal to listen interface IP, so \"localIP\" rule condition does not work properly on UDP inbound connections that listen on all interfaces")
|
||||||
|
rr.LocalGeoip = nil
|
||||||
|
runtime.GC()
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(rr.Domain) > 0 {
|
if len(rr.Domain) > 0 {
|
||||||
domains := rr.Domain
|
var matcher *DomainMatcher
|
||||||
if runtime.GOOS != "windows" && runtime.GOOS != "wasm" {
|
var err error
|
||||||
var err error
|
// Check if domain matcher cache is provided via environment
|
||||||
domains, err = GetDomainList(rr.Domain)
|
domainMatcherPath := platform.NewEnvFlag(platform.MphCachePath).GetValue(func() string { return "" })
|
||||||
if err != nil {
|
|
||||||
return nil, errors.New("failed to build domains from mmap").Base(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
matcher, err := NewMphMatcherGroup(domains)
|
if domainMatcherPath != "" {
|
||||||
if err != nil {
|
matcher, err = GetDomainMatcherWithRuleTag(domainMatcherPath, rr.RuleTag)
|
||||||
return nil, errors.New("failed to build domain condition with MphDomainMatcher").Base(err)
|
if err != nil {
|
||||||
|
return nil, errors.New("failed to build domain condition from cached MphDomainMatcher").Base(err)
|
||||||
|
}
|
||||||
|
errors.LogDebug(context.Background(), "MphDomainMatcher loaded from cache for ", rr.RuleTag, " rule tag)")
|
||||||
|
|
||||||
|
} else {
|
||||||
|
matcher, err = NewMphMatcherGroup(rr.Domain)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.New("failed to build domain condition with MphDomainMatcher").Base(err)
|
||||||
|
}
|
||||||
|
errors.LogDebug(context.Background(), "MphDomainMatcher is enabled for ", len(rr.Domain), " domain rule(s)")
|
||||||
}
|
}
|
||||||
errors.LogDebug(context.Background(), "MphDomainMatcher is enabled for ", len(domains), " domain rule(s)")
|
|
||||||
conds.Add(matcher)
|
conds.Add(matcher)
|
||||||
|
rr.Domain = nil
|
||||||
|
runtime.GC()
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(rr.Process) > 0 {
|
if len(rr.Process) > 0 {
|
||||||
@@ -184,79 +190,19 @@ func (br *BalancingRule) Build(ohm outbound.Manager, dispatcher routing.Dispatch
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetGeoIPList(ips []*GeoIP) ([]*GeoIP, error) {
|
func GetDomainMatcherWithRuleTag(domainMatcherPath string, ruleTag string) (*DomainMatcher, error) {
|
||||||
geoipList := []*GeoIP{}
|
f, err := filesystem.NewFileReader(domainMatcherPath)
|
||||||
for _, ip := range ips {
|
if err != nil {
|
||||||
if ip.CountryCode != "" {
|
return nil, errors.New("failed to load file: ", domainMatcherPath).Base(err)
|
||||||
val := strings.Split(ip.CountryCode, "_")
|
|
||||||
fileName := "geoip.dat"
|
|
||||||
if len(val) == 2 {
|
|
||||||
fileName = strings.ToLower(val[0])
|
|
||||||
}
|
|
||||||
bs, err := filesystem.ReadAsset(fileName)
|
|
||||||
if err != nil {
|
|
||||||
return nil, errors.New("failed to load file: ", fileName).Base(err)
|
|
||||||
}
|
|
||||||
bs = filesystem.Find(bs, []byte(ip.CountryCode))
|
|
||||||
|
|
||||||
var geoip GeoIP
|
|
||||||
|
|
||||||
if err := proto.Unmarshal(bs, &geoip); err != nil {
|
|
||||||
return nil, errors.New("failed Unmarshal :").Base(err)
|
|
||||||
}
|
|
||||||
geoipList = append(geoipList, &geoip)
|
|
||||||
|
|
||||||
} else {
|
|
||||||
geoipList = append(geoipList, ip)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return geoipList, nil
|
defer f.Close()
|
||||||
|
|
||||||
|
g, err := LoadGeoSiteMatcher(f, ruleTag)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.New("failed to load file:", domainMatcherPath).Base(err)
|
||||||
|
}
|
||||||
|
return &DomainMatcher{
|
||||||
|
Matchers: g,
|
||||||
|
}, nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetDomainList(domains []*Domain) ([]*Domain, error) {
|
|
||||||
domainList := []*Domain{}
|
|
||||||
for _, domain := range domains {
|
|
||||||
val := strings.Split(domain.Value, "_")
|
|
||||||
|
|
||||||
if len(val) >= 2 {
|
|
||||||
|
|
||||||
fileName := val[0]
|
|
||||||
code := val[1]
|
|
||||||
|
|
||||||
bs, err := filesystem.ReadAsset(fileName)
|
|
||||||
if err != nil {
|
|
||||||
return nil, errors.New("failed to load file: ", fileName).Base(err)
|
|
||||||
}
|
|
||||||
bs = filesystem.Find(bs, []byte(code))
|
|
||||||
var geosite GeoSite
|
|
||||||
|
|
||||||
if err := proto.Unmarshal(bs, &geosite); err != nil {
|
|
||||||
return nil, errors.New("failed Unmarshal :").Base(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// parse attr
|
|
||||||
if len(val) == 3 {
|
|
||||||
siteWithAttr := strings.Split(val[2], ",")
|
|
||||||
attrs := ParseAttrs(siteWithAttr)
|
|
||||||
|
|
||||||
if !attrs.IsEmpty() {
|
|
||||||
filteredDomains := make([]*Domain, 0, len(domains))
|
|
||||||
for _, domain := range geosite.Domain {
|
|
||||||
if attrs.Match(domain) {
|
|
||||||
filteredDomains = append(filteredDomains, domain)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
geosite.Domain = filteredDomains
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
domainList = append(domainList, geosite.Domain...)
|
|
||||||
|
|
||||||
} else {
|
|
||||||
domainList = append(domainList, domain)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return domainList, nil
|
|
||||||
}
|
|
||||||
|
|||||||
+296
-297
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.35.1
|
// protoc-gen-go v1.36.11
|
||||||
// protoc v5.28.2
|
// protoc v6.33.5
|
||||||
// source: app/router/config.proto
|
// source: app/router/config.proto
|
||||||
|
|
||||||
package router
|
package router
|
||||||
@@ -13,6 +13,7 @@ import (
|
|||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
sync "sync"
|
sync "sync"
|
||||||
|
unsafe "unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -128,21 +129,20 @@ 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_app_router_config_proto_rawDescGZIP(), []int{10, 0}
|
return file_app_router_config_proto_rawDescGZIP(), []int{11, 0}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Domain for routing decision.
|
// Domain for routing decision.
|
||||||
type Domain struct {
|
type Domain struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
// Domain matching type.
|
// Domain matching type.
|
||||||
Type Domain_Type `protobuf:"varint,1,opt,name=type,proto3,enum=xray.app.router.Domain_Type" json:"type,omitempty"`
|
Type Domain_Type `protobuf:"varint,1,opt,name=type,proto3,enum=xray.app.router.Domain_Type" json:"type,omitempty"`
|
||||||
// Domain value.
|
// Domain value.
|
||||||
Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
|
Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
|
||||||
// Attributes of this domain. May be used for filtering.
|
// Attributes of this domain. May be used for filtering.
|
||||||
Attribute []*Domain_Attribute `protobuf:"bytes,3,rep,name=attribute,proto3" json:"attribute,omitempty"`
|
Attribute []*Domain_Attribute `protobuf:"bytes,3,rep,name=attribute,proto3" json:"attribute,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Domain) Reset() {
|
func (x *Domain) Reset() {
|
||||||
@@ -198,14 +198,13 @@ func (x *Domain) GetAttribute() []*Domain_Attribute {
|
|||||||
|
|
||||||
// IP for routing decision, in CIDR form.
|
// IP for routing decision, in CIDR form.
|
||||||
type CIDR struct {
|
type CIDR struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
// IP address, should be either 4 or 16 bytes.
|
// IP address, should be either 4 or 16 bytes.
|
||||||
Ip []byte `protobuf:"bytes,1,opt,name=ip,proto3" json:"ip,omitempty"`
|
Ip []byte `protobuf:"bytes,1,opt,name=ip,proto3" json:"ip,omitempty"`
|
||||||
// Number of leading ones in the network mask.
|
// Number of leading ones in the network mask.
|
||||||
Prefix uint32 `protobuf:"varint,2,opt,name=prefix,proto3" json:"prefix,omitempty"`
|
Prefix uint32 `protobuf:"varint,2,opt,name=prefix,proto3" json:"prefix,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *CIDR) Reset() {
|
func (x *CIDR) Reset() {
|
||||||
@@ -253,13 +252,12 @@ func (x *CIDR) GetPrefix() uint32 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type GeoIP struct {
|
type GeoIP struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
CountryCode string `protobuf:"bytes,1,opt,name=country_code,json=countryCode,proto3" json:"country_code,omitempty"`
|
||||||
|
Cidr []*CIDR `protobuf:"bytes,2,rep,name=cidr,proto3" json:"cidr,omitempty"`
|
||||||
|
ReverseMatch bool `protobuf:"varint,3,opt,name=reverse_match,json=reverseMatch,proto3" json:"reverse_match,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
CountryCode string `protobuf:"bytes,1,opt,name=country_code,json=countryCode,proto3" json:"country_code,omitempty"`
|
|
||||||
Cidr []*CIDR `protobuf:"bytes,2,rep,name=cidr,proto3" json:"cidr,omitempty"`
|
|
||||||
ReverseMatch bool `protobuf:"varint,3,opt,name=reverse_match,json=reverseMatch,proto3" json:"reverse_match,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GeoIP) Reset() {
|
func (x *GeoIP) Reset() {
|
||||||
@@ -314,11 +312,10 @@ func (x *GeoIP) GetReverseMatch() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type GeoIPList struct {
|
type GeoIPList struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Entry []*GeoIP `protobuf:"bytes,1,rep,name=entry,proto3" json:"entry,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
Entry []*GeoIP `protobuf:"bytes,1,rep,name=entry,proto3" json:"entry,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GeoIPList) Reset() {
|
func (x *GeoIPList) Reset() {
|
||||||
@@ -359,12 +356,11 @@ func (x *GeoIPList) GetEntry() []*GeoIP {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type GeoSite struct {
|
type GeoSite struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
CountryCode string `protobuf:"bytes,1,opt,name=country_code,json=countryCode,proto3" json:"country_code,omitempty"`
|
||||||
|
Domain []*Domain `protobuf:"bytes,2,rep,name=domain,proto3" json:"domain,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
CountryCode string `protobuf:"bytes,1,opt,name=country_code,json=countryCode,proto3" json:"country_code,omitempty"`
|
|
||||||
Domain []*Domain `protobuf:"bytes,2,rep,name=domain,proto3" json:"domain,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GeoSite) Reset() {
|
func (x *GeoSite) Reset() {
|
||||||
@@ -412,11 +408,10 @@ func (x *GeoSite) GetDomain() []*Domain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type GeoSiteList struct {
|
type GeoSiteList struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Entry []*GeoSite `protobuf:"bytes,1,rep,name=entry,proto3" json:"entry,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
Entry []*GeoSite `protobuf:"bytes,1,rep,name=entry,proto3" json:"entry,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GeoSiteList) Reset() {
|
func (x *GeoSiteList) Reset() {
|
||||||
@@ -457,11 +452,8 @@ func (x *GeoSiteList) GetEntry() []*GeoSite {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type RoutingRule struct {
|
type RoutingRule struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
// Types that are valid to be assigned to TargetTag:
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
// Types that are assignable to TargetTag:
|
|
||||||
//
|
//
|
||||||
// *RoutingRule_Tag
|
// *RoutingRule_Tag
|
||||||
// *RoutingRule_BalancingTag
|
// *RoutingRule_BalancingTag
|
||||||
@@ -486,11 +478,14 @@ type RoutingRule struct {
|
|||||||
UserEmail []string `protobuf:"bytes,7,rep,name=user_email,json=userEmail,proto3" json:"user_email,omitempty"`
|
UserEmail []string `protobuf:"bytes,7,rep,name=user_email,json=userEmail,proto3" json:"user_email,omitempty"`
|
||||||
InboundTag []string `protobuf:"bytes,8,rep,name=inbound_tag,json=inboundTag,proto3" json:"inbound_tag,omitempty"`
|
InboundTag []string `protobuf:"bytes,8,rep,name=inbound_tag,json=inboundTag,proto3" json:"inbound_tag,omitempty"`
|
||||||
Protocol []string `protobuf:"bytes,9,rep,name=protocol,proto3" json:"protocol,omitempty"`
|
Protocol []string `protobuf:"bytes,9,rep,name=protocol,proto3" json:"protocol,omitempty"`
|
||||||
Attributes map[string]string `protobuf:"bytes,15,rep,name=attributes,proto3" json:"attributes,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
Attributes map[string]string `protobuf:"bytes,15,rep,name=attributes,proto3" json:"attributes,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||||
LocalGeoip []*GeoIP `protobuf:"bytes,17,rep,name=local_geoip,json=localGeoip,proto3" json:"local_geoip,omitempty"`
|
LocalGeoip []*GeoIP `protobuf:"bytes,17,rep,name=local_geoip,json=localGeoip,proto3" json:"local_geoip,omitempty"`
|
||||||
LocalPortList *net.PortList `protobuf:"bytes,18,opt,name=local_port_list,json=localPortList,proto3" json:"local_port_list,omitempty"`
|
LocalPortList *net.PortList `protobuf:"bytes,18,opt,name=local_port_list,json=localPortList,proto3" json:"local_port_list,omitempty"`
|
||||||
VlessRouteList *net.PortList `protobuf:"bytes,20,opt,name=vless_route_list,json=vlessRouteList,proto3" json:"vless_route_list,omitempty"`
|
VlessRouteList *net.PortList `protobuf:"bytes,20,opt,name=vless_route_list,json=vlessRouteList,proto3" json:"vless_route_list,omitempty"`
|
||||||
Process []string `protobuf:"bytes,21,rep,name=process,proto3" json:"process,omitempty"`
|
Process []string `protobuf:"bytes,21,rep,name=process,proto3" json:"process,omitempty"`
|
||||||
|
Webhook *WebhookConfig `protobuf:"bytes,22,opt,name=webhook,proto3" json:"webhook,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *RoutingRule) Reset() {
|
func (x *RoutingRule) Reset() {
|
||||||
@@ -523,23 +518,27 @@ func (*RoutingRule) Descriptor() ([]byte, []int) {
|
|||||||
return file_app_router_config_proto_rawDescGZIP(), []int{6}
|
return file_app_router_config_proto_rawDescGZIP(), []int{6}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *RoutingRule) GetTargetTag() isRoutingRule_TargetTag {
|
func (x *RoutingRule) GetTargetTag() isRoutingRule_TargetTag {
|
||||||
if m != nil {
|
if x != nil {
|
||||||
return m.TargetTag
|
return x.TargetTag
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *RoutingRule) GetTag() string {
|
func (x *RoutingRule) GetTag() string {
|
||||||
if x, ok := x.GetTargetTag().(*RoutingRule_Tag); ok {
|
if x != nil {
|
||||||
return x.Tag
|
if x, ok := x.TargetTag.(*RoutingRule_Tag); ok {
|
||||||
|
return x.Tag
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *RoutingRule) GetBalancingTag() string {
|
func (x *RoutingRule) GetBalancingTag() string {
|
||||||
if x, ok := x.GetTargetTag().(*RoutingRule_BalancingTag); ok {
|
if x != nil {
|
||||||
return x.BalancingTag
|
if x, ok := x.TargetTag.(*RoutingRule_BalancingTag); ok {
|
||||||
|
return x.BalancingTag
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
@@ -649,6 +648,13 @@ func (x *RoutingRule) GetProcess() []string {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *RoutingRule) GetWebhook() *WebhookConfig {
|
||||||
|
if x != nil {
|
||||||
|
return x.Webhook
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
type isRoutingRule_TargetTag interface {
|
type isRoutingRule_TargetTag interface {
|
||||||
isRoutingRule_TargetTag()
|
isRoutingRule_TargetTag()
|
||||||
}
|
}
|
||||||
@@ -667,21 +673,80 @@ func (*RoutingRule_Tag) isRoutingRule_TargetTag() {}
|
|||||||
|
|
||||||
func (*RoutingRule_BalancingTag) isRoutingRule_TargetTag() {}
|
func (*RoutingRule_BalancingTag) isRoutingRule_TargetTag() {}
|
||||||
|
|
||||||
type BalancingRule struct {
|
type WebhookConfig struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"`
|
||||||
|
Deduplication uint32 `protobuf:"varint,2,opt,name=deduplication,proto3" json:"deduplication,omitempty"`
|
||||||
|
Headers map[string]string `protobuf:"bytes,3,rep,name=headers,proto3" json:"headers,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
Tag string `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"`
|
func (x *WebhookConfig) Reset() {
|
||||||
OutboundSelector []string `protobuf:"bytes,2,rep,name=outbound_selector,json=outboundSelector,proto3" json:"outbound_selector,omitempty"`
|
*x = WebhookConfig{}
|
||||||
Strategy string `protobuf:"bytes,3,opt,name=strategy,proto3" json:"strategy,omitempty"`
|
mi := &file_app_router_config_proto_msgTypes[7]
|
||||||
StrategySettings *serial.TypedMessage `protobuf:"bytes,4,opt,name=strategy_settings,json=strategySettings,proto3" json:"strategy_settings,omitempty"`
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
FallbackTag string `protobuf:"bytes,5,opt,name=fallback_tag,json=fallbackTag,proto3" json:"fallback_tag,omitempty"`
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *WebhookConfig) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*WebhookConfig) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *WebhookConfig) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_app_router_config_proto_msgTypes[7]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use WebhookConfig.ProtoReflect.Descriptor instead.
|
||||||
|
func (*WebhookConfig) Descriptor() ([]byte, []int) {
|
||||||
|
return file_app_router_config_proto_rawDescGZIP(), []int{7}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *WebhookConfig) GetUrl() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Url
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *WebhookConfig) GetDeduplication() uint32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Deduplication
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *WebhookConfig) GetHeaders() map[string]string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Headers
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type BalancingRule struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
Tag string `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"`
|
||||||
|
OutboundSelector []string `protobuf:"bytes,2,rep,name=outbound_selector,json=outboundSelector,proto3" json:"outbound_selector,omitempty"`
|
||||||
|
Strategy string `protobuf:"bytes,3,opt,name=strategy,proto3" json:"strategy,omitempty"`
|
||||||
|
StrategySettings *serial.TypedMessage `protobuf:"bytes,4,opt,name=strategy_settings,json=strategySettings,proto3" json:"strategy_settings,omitempty"`
|
||||||
|
FallbackTag string `protobuf:"bytes,5,opt,name=fallback_tag,json=fallbackTag,proto3" json:"fallback_tag,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *BalancingRule) Reset() {
|
func (x *BalancingRule) Reset() {
|
||||||
*x = BalancingRule{}
|
*x = BalancingRule{}
|
||||||
mi := &file_app_router_config_proto_msgTypes[7]
|
mi := &file_app_router_config_proto_msgTypes[8]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@@ -693,7 +758,7 @@ func (x *BalancingRule) String() string {
|
|||||||
func (*BalancingRule) ProtoMessage() {}
|
func (*BalancingRule) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *BalancingRule) ProtoReflect() protoreflect.Message {
|
func (x *BalancingRule) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_app_router_config_proto_msgTypes[7]
|
mi := &file_app_router_config_proto_msgTypes[8]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@@ -706,7 +771,7 @@ func (x *BalancingRule) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use BalancingRule.ProtoReflect.Descriptor instead.
|
// Deprecated: Use BalancingRule.ProtoReflect.Descriptor instead.
|
||||||
func (*BalancingRule) Descriptor() ([]byte, []int) {
|
func (*BalancingRule) Descriptor() ([]byte, []int) {
|
||||||
return file_app_router_config_proto_rawDescGZIP(), []int{7}
|
return file_app_router_config_proto_rawDescGZIP(), []int{8}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *BalancingRule) GetTag() string {
|
func (x *BalancingRule) GetTag() string {
|
||||||
@@ -745,18 +810,17 @@ func (x *BalancingRule) GetFallbackTag() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type StrategyWeight struct {
|
type StrategyWeight struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Regexp bool `protobuf:"varint,1,opt,name=regexp,proto3" json:"regexp,omitempty"`
|
||||||
|
Match string `protobuf:"bytes,2,opt,name=match,proto3" json:"match,omitempty"`
|
||||||
|
Value float32 `protobuf:"fixed32,3,opt,name=value,proto3" json:"value,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
Regexp bool `protobuf:"varint,1,opt,name=regexp,proto3" json:"regexp,omitempty"`
|
|
||||||
Match string `protobuf:"bytes,2,opt,name=match,proto3" json:"match,omitempty"`
|
|
||||||
Value float32 `protobuf:"fixed32,3,opt,name=value,proto3" json:"value,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *StrategyWeight) Reset() {
|
func (x *StrategyWeight) Reset() {
|
||||||
*x = StrategyWeight{}
|
*x = StrategyWeight{}
|
||||||
mi := &file_app_router_config_proto_msgTypes[8]
|
mi := &file_app_router_config_proto_msgTypes[9]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@@ -768,7 +832,7 @@ func (x *StrategyWeight) String() string {
|
|||||||
func (*StrategyWeight) ProtoMessage() {}
|
func (*StrategyWeight) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *StrategyWeight) ProtoReflect() protoreflect.Message {
|
func (x *StrategyWeight) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_app_router_config_proto_msgTypes[8]
|
mi := &file_app_router_config_proto_msgTypes[9]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@@ -781,7 +845,7 @@ func (x *StrategyWeight) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use StrategyWeight.ProtoReflect.Descriptor instead.
|
// Deprecated: Use StrategyWeight.ProtoReflect.Descriptor instead.
|
||||||
func (*StrategyWeight) Descriptor() ([]byte, []int) {
|
func (*StrategyWeight) Descriptor() ([]byte, []int) {
|
||||||
return file_app_router_config_proto_rawDescGZIP(), []int{8}
|
return file_app_router_config_proto_rawDescGZIP(), []int{9}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *StrategyWeight) GetRegexp() bool {
|
func (x *StrategyWeight) GetRegexp() bool {
|
||||||
@@ -806,10 +870,7 @@ func (x *StrategyWeight) GetValue() float32 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type StrategyLeastLoadConfig struct {
|
type StrategyLeastLoadConfig struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
// weight settings
|
// weight settings
|
||||||
Costs []*StrategyWeight `protobuf:"bytes,2,rep,name=costs,proto3" json:"costs,omitempty"`
|
Costs []*StrategyWeight `protobuf:"bytes,2,rep,name=costs,proto3" json:"costs,omitempty"`
|
||||||
// RTT baselines for selecting, int64 values of time.Duration
|
// RTT baselines for selecting, int64 values of time.Duration
|
||||||
@@ -819,12 +880,14 @@ type StrategyLeastLoadConfig struct {
|
|||||||
// max acceptable rtt, filter away high delay nodes. default 0
|
// max acceptable rtt, filter away high delay nodes. default 0
|
||||||
MaxRTT int64 `protobuf:"varint,5,opt,name=maxRTT,proto3" json:"maxRTT,omitempty"`
|
MaxRTT int64 `protobuf:"varint,5,opt,name=maxRTT,proto3" json:"maxRTT,omitempty"`
|
||||||
// acceptable failure rate
|
// acceptable failure rate
|
||||||
Tolerance float32 `protobuf:"fixed32,6,opt,name=tolerance,proto3" json:"tolerance,omitempty"`
|
Tolerance float32 `protobuf:"fixed32,6,opt,name=tolerance,proto3" json:"tolerance,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *StrategyLeastLoadConfig) Reset() {
|
func (x *StrategyLeastLoadConfig) Reset() {
|
||||||
*x = StrategyLeastLoadConfig{}
|
*x = StrategyLeastLoadConfig{}
|
||||||
mi := &file_app_router_config_proto_msgTypes[9]
|
mi := &file_app_router_config_proto_msgTypes[10]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@@ -836,7 +899,7 @@ func (x *StrategyLeastLoadConfig) String() string {
|
|||||||
func (*StrategyLeastLoadConfig) ProtoMessage() {}
|
func (*StrategyLeastLoadConfig) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *StrategyLeastLoadConfig) ProtoReflect() protoreflect.Message {
|
func (x *StrategyLeastLoadConfig) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_app_router_config_proto_msgTypes[9]
|
mi := &file_app_router_config_proto_msgTypes[10]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@@ -849,7 +912,7 @@ func (x *StrategyLeastLoadConfig) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use StrategyLeastLoadConfig.ProtoReflect.Descriptor instead.
|
// Deprecated: Use StrategyLeastLoadConfig.ProtoReflect.Descriptor instead.
|
||||||
func (*StrategyLeastLoadConfig) Descriptor() ([]byte, []int) {
|
func (*StrategyLeastLoadConfig) Descriptor() ([]byte, []int) {
|
||||||
return file_app_router_config_proto_rawDescGZIP(), []int{9}
|
return file_app_router_config_proto_rawDescGZIP(), []int{10}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *StrategyLeastLoadConfig) GetCosts() []*StrategyWeight {
|
func (x *StrategyLeastLoadConfig) GetCosts() []*StrategyWeight {
|
||||||
@@ -888,18 +951,17 @@ func (x *StrategyLeastLoadConfig) GetTolerance() float32 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
DomainStrategy Config_DomainStrategy `protobuf:"varint,1,opt,name=domain_strategy,json=domainStrategy,proto3,enum=xray.app.router.Config_DomainStrategy" json:"domain_strategy,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
Rule []*RoutingRule `protobuf:"bytes,2,rep,name=rule,proto3" json:"rule,omitempty"`
|
||||||
|
BalancingRule []*BalancingRule `protobuf:"bytes,3,rep,name=balancing_rule,json=balancingRule,proto3" json:"balancing_rule,omitempty"`
|
||||||
DomainStrategy Config_DomainStrategy `protobuf:"varint,1,opt,name=domain_strategy,json=domainStrategy,proto3,enum=xray.app.router.Config_DomainStrategy" json:"domain_strategy,omitempty"`
|
unknownFields protoimpl.UnknownFields
|
||||||
Rule []*RoutingRule `protobuf:"bytes,2,rep,name=rule,proto3" json:"rule,omitempty"`
|
sizeCache protoimpl.SizeCache
|
||||||
BalancingRule []*BalancingRule `protobuf:"bytes,3,rep,name=balancing_rule,json=balancingRule,proto3" json:"balancing_rule,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Config) Reset() {
|
func (x *Config) Reset() {
|
||||||
*x = Config{}
|
*x = Config{}
|
||||||
mi := &file_app_router_config_proto_msgTypes[10]
|
mi := &file_app_router_config_proto_msgTypes[11]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@@ -911,7 +973,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_app_router_config_proto_msgTypes[10]
|
mi := &file_app_router_config_proto_msgTypes[11]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@@ -924,7 +986,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_app_router_config_proto_rawDescGZIP(), []int{10}
|
return file_app_router_config_proto_rawDescGZIP(), []int{11}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Config) GetDomainStrategy() Config_DomainStrategy {
|
func (x *Config) GetDomainStrategy() Config_DomainStrategy {
|
||||||
@@ -949,21 +1011,20 @@ func (x *Config) GetBalancingRule() []*BalancingRule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Domain_Attribute struct {
|
type Domain_Attribute struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
// Types that are valid to be assigned to TypedValue:
|
||||||
|
|
||||||
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
|
|
||||||
// Types that are assignable to TypedValue:
|
|
||||||
//
|
//
|
||||||
// *Domain_Attribute_BoolValue
|
// *Domain_Attribute_BoolValue
|
||||||
// *Domain_Attribute_IntValue
|
// *Domain_Attribute_IntValue
|
||||||
TypedValue isDomain_Attribute_TypedValue `protobuf_oneof:"typed_value"`
|
TypedValue isDomain_Attribute_TypedValue `protobuf_oneof:"typed_value"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Domain_Attribute) Reset() {
|
func (x *Domain_Attribute) Reset() {
|
||||||
*x = Domain_Attribute{}
|
*x = Domain_Attribute{}
|
||||||
mi := &file_app_router_config_proto_msgTypes[11]
|
mi := &file_app_router_config_proto_msgTypes[12]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@@ -975,7 +1036,7 @@ func (x *Domain_Attribute) String() string {
|
|||||||
func (*Domain_Attribute) ProtoMessage() {}
|
func (*Domain_Attribute) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *Domain_Attribute) ProtoReflect() protoreflect.Message {
|
func (x *Domain_Attribute) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_app_router_config_proto_msgTypes[11]
|
mi := &file_app_router_config_proto_msgTypes[12]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@@ -998,23 +1059,27 @@ func (x *Domain_Attribute) GetKey() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Domain_Attribute) GetTypedValue() isDomain_Attribute_TypedValue {
|
func (x *Domain_Attribute) GetTypedValue() isDomain_Attribute_TypedValue {
|
||||||
if m != nil {
|
if x != nil {
|
||||||
return m.TypedValue
|
return x.TypedValue
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Domain_Attribute) GetBoolValue() bool {
|
func (x *Domain_Attribute) GetBoolValue() bool {
|
||||||
if x, ok := x.GetTypedValue().(*Domain_Attribute_BoolValue); ok {
|
if x != nil {
|
||||||
return x.BoolValue
|
if x, ok := x.TypedValue.(*Domain_Attribute_BoolValue); ok {
|
||||||
|
return x.BoolValue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Domain_Attribute) GetIntValue() int64 {
|
func (x *Domain_Attribute) GetIntValue() int64 {
|
||||||
if x, ok := x.GetTypedValue().(*Domain_Attribute_IntValue); ok {
|
if x != nil {
|
||||||
return x.IntValue
|
if x, ok := x.TypedValue.(*Domain_Attribute_IntValue); ok {
|
||||||
|
return x.IntValue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@@ -1037,186 +1102,117 @@ func (*Domain_Attribute_IntValue) isDomain_Attribute_TypedValue() {}
|
|||||||
|
|
||||||
var File_app_router_config_proto protoreflect.FileDescriptor
|
var File_app_router_config_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_app_router_config_proto_rawDesc = []byte{
|
const file_app_router_config_proto_rawDesc = "" +
|
||||||
0x0a, 0x17, 0x61, 0x70, 0x70, 0x2f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x6e,
|
"\n" +
|
||||||
0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x78, 0x72, 0x61, 0x79, 0x2e,
|
"\x17app/router/config.proto\x12\x0fxray.app.router\x1a!common/serial/typed_message.proto\x1a\x15common/net/port.proto\x1a\x18common/net/network.proto\"\xb3\x02\n" +
|
||||||
0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x1a, 0x21, 0x63, 0x6f, 0x6d, 0x6d,
|
"\x06Domain\x120\n" +
|
||||||
0x6f, 0x6e, 0x2f, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x64, 0x5f,
|
"\x04type\x18\x01 \x01(\x0e2\x1c.xray.app.router.Domain.TypeR\x04type\x12\x14\n" +
|
||||||
0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x15, 0x63,
|
"\x05value\x18\x02 \x01(\tR\x05value\x12?\n" +
|
||||||
0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x6e, 0x65, 0x74, 0x2f, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x70,
|
"\tattribute\x18\x03 \x03(\v2!.xray.app.router.Domain.AttributeR\tattribute\x1al\n" +
|
||||||
0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x6e, 0x65, 0x74,
|
"\tAttribute\x12\x10\n" +
|
||||||
0x2f, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb3,
|
"\x03key\x18\x01 \x01(\tR\x03key\x12\x1f\n" +
|
||||||
0x02, 0x0a, 0x06, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x12, 0x30, 0x0a, 0x04, 0x74, 0x79, 0x70,
|
"\n" +
|
||||||
0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61,
|
"bool_value\x18\x02 \x01(\bH\x00R\tboolValue\x12\x1d\n" +
|
||||||
0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e,
|
"\tint_value\x18\x03 \x01(\x03H\x00R\bintValueB\r\n" +
|
||||||
0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76,
|
"\vtyped_value\"2\n" +
|
||||||
0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75,
|
"\x04Type\x12\t\n" +
|
||||||
0x65, 0x12, 0x3f, 0x0a, 0x09, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x18, 0x03,
|
"\x05Plain\x10\x00\x12\t\n" +
|
||||||
0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e,
|
"\x05Regex\x10\x01\x12\n" +
|
||||||
0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x41, 0x74,
|
"\n" +
|
||||||
0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x09, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75,
|
"\x06Domain\x10\x02\x12\b\n" +
|
||||||
0x74, 0x65, 0x1a, 0x6c, 0x0a, 0x09, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x12,
|
"\x04Full\x10\x03\".\n" +
|
||||||
0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65,
|
"\x04CIDR\x12\x0e\n" +
|
||||||
0x79, 0x12, 0x1f, 0x0a, 0x0a, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18,
|
"\x02ip\x18\x01 \x01(\fR\x02ip\x12\x16\n" +
|
||||||
0x02, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x09, 0x62, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c,
|
"\x06prefix\x18\x02 \x01(\rR\x06prefix\"z\n" +
|
||||||
0x75, 0x65, 0x12, 0x1d, 0x0a, 0x09, 0x69, 0x6e, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18,
|
"\x05GeoIP\x12!\n" +
|
||||||
0x03, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x56, 0x61, 0x6c, 0x75,
|
"\fcountry_code\x18\x01 \x01(\tR\vcountryCode\x12)\n" +
|
||||||
0x65, 0x42, 0x0d, 0x0a, 0x0b, 0x74, 0x79, 0x70, 0x65, 0x64, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65,
|
"\x04cidr\x18\x02 \x03(\v2\x15.xray.app.router.CIDRR\x04cidr\x12#\n" +
|
||||||
0x22, 0x32, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x09, 0x0a, 0x05, 0x50, 0x6c, 0x61, 0x69,
|
"\rreverse_match\x18\x03 \x01(\bR\freverseMatch\"9\n" +
|
||||||
0x6e, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x65, 0x67, 0x65, 0x78, 0x10, 0x01, 0x12, 0x0a,
|
"\tGeoIPList\x12,\n" +
|
||||||
0x0a, 0x06, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x46, 0x75,
|
"\x05entry\x18\x01 \x03(\v2\x16.xray.app.router.GeoIPR\x05entry\"]\n" +
|
||||||
0x6c, 0x6c, 0x10, 0x03, 0x22, 0x2e, 0x0a, 0x04, 0x43, 0x49, 0x44, 0x52, 0x12, 0x0e, 0x0a, 0x02,
|
"\aGeoSite\x12!\n" +
|
||||||
0x69, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x02, 0x69, 0x70, 0x12, 0x16, 0x0a, 0x06,
|
"\fcountry_code\x18\x01 \x01(\tR\vcountryCode\x12/\n" +
|
||||||
0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x70, 0x72,
|
"\x06domain\x18\x02 \x03(\v2\x17.xray.app.router.DomainR\x06domain\"=\n" +
|
||||||
0x65, 0x66, 0x69, 0x78, 0x22, 0x7a, 0x0a, 0x05, 0x47, 0x65, 0x6f, 0x49, 0x50, 0x12, 0x21, 0x0a,
|
"\vGeoSiteList\x12.\n" +
|
||||||
0x0c, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20,
|
"\x05entry\x18\x01 \x03(\v2\x18.xray.app.router.GeoSiteR\x05entry\"\xbc\a\n" +
|
||||||
0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x43, 0x6f, 0x64, 0x65,
|
"\vRoutingRule\x12\x12\n" +
|
||||||
0x12, 0x29, 0x0a, 0x04, 0x63, 0x69, 0x64, 0x72, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15,
|
"\x03tag\x18\x01 \x01(\tH\x00R\x03tag\x12%\n" +
|
||||||
0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72,
|
"\rbalancing_tag\x18\f \x01(\tH\x00R\fbalancingTag\x12\x19\n" +
|
||||||
0x2e, 0x43, 0x49, 0x44, 0x52, 0x52, 0x04, 0x63, 0x69, 0x64, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x72,
|
"\brule_tag\x18\x13 \x01(\tR\aruleTag\x12/\n" +
|
||||||
0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01,
|
"\x06domain\x18\x02 \x03(\v2\x17.xray.app.router.DomainR\x06domain\x12,\n" +
|
||||||
0x28, 0x08, 0x52, 0x0c, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68,
|
"\x05geoip\x18\n" +
|
||||||
0x22, 0x39, 0x0a, 0x09, 0x47, 0x65, 0x6f, 0x49, 0x50, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x2c, 0x0a,
|
" \x03(\v2\x16.xray.app.router.GeoIPR\x05geoip\x126\n" +
|
||||||
0x05, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x78,
|
"\tport_list\x18\x0e \x01(\v2\x19.xray.common.net.PortListR\bportList\x124\n" +
|
||||||
0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x47,
|
"\bnetworks\x18\r \x03(\x0e2\x18.xray.common.net.NetworkR\bnetworks\x129\n" +
|
||||||
0x65, 0x6f, 0x49, 0x50, 0x52, 0x05, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x22, 0x5d, 0x0a, 0x07, 0x47,
|
"\fsource_geoip\x18\v \x03(\v2\x16.xray.app.router.GeoIPR\vsourceGeoip\x12C\n" +
|
||||||
0x65, 0x6f, 0x53, 0x69, 0x74, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72,
|
"\x10source_port_list\x18\x10 \x01(\v2\x19.xray.common.net.PortListR\x0esourcePortList\x12\x1d\n" +
|
||||||
0x79, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f,
|
"\n" +
|
||||||
0x75, 0x6e, 0x74, 0x72, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x2f, 0x0a, 0x06, 0x64, 0x6f, 0x6d,
|
"user_email\x18\a \x03(\tR\tuserEmail\x12\x1f\n" +
|
||||||
0x61, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x78, 0x72, 0x61, 0x79,
|
"\vinbound_tag\x18\b \x03(\tR\n" +
|
||||||
0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x44, 0x6f, 0x6d, 0x61,
|
"inboundTag\x12\x1a\n" +
|
||||||
0x69, 0x6e, 0x52, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x22, 0x3d, 0x0a, 0x0b, 0x47, 0x65,
|
"\bprotocol\x18\t \x03(\tR\bprotocol\x12L\n" +
|
||||||
0x6f, 0x53, 0x69, 0x74, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x2e, 0x0a, 0x05, 0x65, 0x6e, 0x74,
|
"\n" +
|
||||||
0x72, 0x79, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e,
|
"attributes\x18\x0f \x03(\v2,.xray.app.router.RoutingRule.AttributesEntryR\n" +
|
||||||
0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x6f, 0x53, 0x69,
|
"attributes\x127\n" +
|
||||||
0x74, 0x65, 0x52, 0x05, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x22, 0x82, 0x07, 0x0a, 0x0b, 0x52, 0x6f,
|
"\vlocal_geoip\x18\x11 \x03(\v2\x16.xray.app.router.GeoIPR\n" +
|
||||||
0x75, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x03, 0x74, 0x61, 0x67,
|
"localGeoip\x12A\n" +
|
||||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x03, 0x74, 0x61, 0x67, 0x12, 0x25, 0x0a,
|
"\x0flocal_port_list\x18\x12 \x01(\v2\x19.xray.common.net.PortListR\rlocalPortList\x12C\n" +
|
||||||
0x0d, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x69, 0x6e, 0x67, 0x5f, 0x74, 0x61, 0x67, 0x18, 0x0c,
|
"\x10vless_route_list\x18\x14 \x01(\v2\x19.xray.common.net.PortListR\x0evlessRouteList\x12\x18\n" +
|
||||||
0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0c, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x69, 0x6e,
|
"\aprocess\x18\x15 \x03(\tR\aprocess\x128\n" +
|
||||||
0x67, 0x54, 0x61, 0x67, 0x12, 0x19, 0x0a, 0x08, 0x72, 0x75, 0x6c, 0x65, 0x5f, 0x74, 0x61, 0x67,
|
"\awebhook\x18\x16 \x01(\v2\x1e.xray.app.router.WebhookConfigR\awebhook\x1a=\n" +
|
||||||
0x18, 0x13, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x72, 0x75, 0x6c, 0x65, 0x54, 0x61, 0x67, 0x12,
|
"\x0fAttributesEntry\x12\x10\n" +
|
||||||
0x2f, 0x0a, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32,
|
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
|
||||||
0x17, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65,
|
"\x05value\x18\x02 \x01(\tR\x05value:\x028\x01B\f\n" +
|
||||||
0x72, 0x2e, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x52, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e,
|
"\n" +
|
||||||
0x12, 0x2c, 0x0a, 0x05, 0x67, 0x65, 0x6f, 0x69, 0x70, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32,
|
"target_tag\"\xca\x01\n" +
|
||||||
0x16, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65,
|
"\rWebhookConfig\x12\x10\n" +
|
||||||
0x72, 0x2e, 0x47, 0x65, 0x6f, 0x49, 0x50, 0x52, 0x05, 0x67, 0x65, 0x6f, 0x69, 0x70, 0x12, 0x36,
|
"\x03url\x18\x01 \x01(\tR\x03url\x12$\n" +
|
||||||
0x0a, 0x09, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x0e, 0x20, 0x01, 0x28,
|
"\rdeduplication\x18\x02 \x01(\rR\rdeduplication\x12E\n" +
|
||||||
0x0b, 0x32, 0x19, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e,
|
"\aheaders\x18\x03 \x03(\v2+.xray.app.router.WebhookConfig.HeadersEntryR\aheaders\x1a:\n" +
|
||||||
0x6e, 0x65, 0x74, 0x2e, 0x50, 0x6f, 0x72, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x08, 0x70, 0x6f,
|
"\fHeadersEntry\x12\x10\n" +
|
||||||
0x72, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x34, 0x0a, 0x08, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72,
|
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
|
||||||
0x6b, 0x73, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e,
|
"\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\xdc\x01\n" +
|
||||||
0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f,
|
"\rBalancingRule\x12\x10\n" +
|
||||||
0x72, 0x6b, 0x52, 0x08, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x12, 0x39, 0x0a, 0x0c,
|
"\x03tag\x18\x01 \x01(\tR\x03tag\x12+\n" +
|
||||||
0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x67, 0x65, 0x6f, 0x69, 0x70, 0x18, 0x0b, 0x20, 0x03,
|
"\x11outbound_selector\x18\x02 \x03(\tR\x10outboundSelector\x12\x1a\n" +
|
||||||
0x28, 0x0b, 0x32, 0x16, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f,
|
"\bstrategy\x18\x03 \x01(\tR\bstrategy\x12M\n" +
|
||||||
0x75, 0x74, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x6f, 0x49, 0x50, 0x52, 0x0b, 0x73, 0x6f, 0x75, 0x72,
|
"\x11strategy_settings\x18\x04 \x01(\v2 .xray.common.serial.TypedMessageR\x10strategySettings\x12!\n" +
|
||||||
0x63, 0x65, 0x47, 0x65, 0x6f, 0x69, 0x70, 0x12, 0x43, 0x0a, 0x10, 0x73, 0x6f, 0x75, 0x72, 0x63,
|
"\ffallback_tag\x18\x05 \x01(\tR\vfallbackTag\"T\n" +
|
||||||
0x65, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x10, 0x20, 0x01, 0x28,
|
"\x0eStrategyWeight\x12\x16\n" +
|
||||||
0x0b, 0x32, 0x19, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e,
|
"\x06regexp\x18\x01 \x01(\bR\x06regexp\x12\x14\n" +
|
||||||
0x6e, 0x65, 0x74, 0x2e, 0x50, 0x6f, 0x72, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x0e, 0x73, 0x6f,
|
"\x05match\x18\x02 \x01(\tR\x05match\x12\x14\n" +
|
||||||
0x75, 0x72, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a,
|
"\x05value\x18\x03 \x01(\x02R\x05value\"\xc0\x01\n" +
|
||||||
0x75, 0x73, 0x65, 0x72, 0x5f, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09,
|
"\x17StrategyLeastLoadConfig\x125\n" +
|
||||||
0x52, 0x09, 0x75, 0x73, 0x65, 0x72, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x1f, 0x0a, 0x0b, 0x69,
|
"\x05costs\x18\x02 \x03(\v2\x1f.xray.app.router.StrategyWeightR\x05costs\x12\x1c\n" +
|
||||||
0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x5f, 0x74, 0x61, 0x67, 0x18, 0x08, 0x20, 0x03, 0x28, 0x09,
|
"\tbaselines\x18\x03 \x03(\x03R\tbaselines\x12\x1a\n" +
|
||||||
0x52, 0x0a, 0x69, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x54, 0x61, 0x67, 0x12, 0x1a, 0x0a, 0x08,
|
"\bexpected\x18\x04 \x01(\x05R\bexpected\x12\x16\n" +
|
||||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x09, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08,
|
"\x06maxRTT\x18\x05 \x01(\x03R\x06maxRTT\x12\x1c\n" +
|
||||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x4c, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72,
|
"\ttolerance\x18\x06 \x01(\x02R\ttolerance\"\x90\x02\n" +
|
||||||
0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x0f, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x78,
|
"\x06Config\x12O\n" +
|
||||||
0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x52,
|
"\x0fdomain_strategy\x18\x01 \x01(\x0e2&.xray.app.router.Config.DomainStrategyR\x0edomainStrategy\x120\n" +
|
||||||
0x6f, 0x75, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x75, 0x6c, 0x65, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69,
|
"\x04rule\x18\x02 \x03(\v2\x1c.xray.app.router.RoutingRuleR\x04rule\x12E\n" +
|
||||||
0x62, 0x75, 0x74, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72,
|
"\x0ebalancing_rule\x18\x03 \x03(\v2\x1e.xray.app.router.BalancingRuleR\rbalancingRule\"<\n" +
|
||||||
0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x37, 0x0a, 0x0b, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f,
|
"\x0eDomainStrategy\x12\b\n" +
|
||||||
0x67, 0x65, 0x6f, 0x69, 0x70, 0x18, 0x11, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x78, 0x72,
|
"\x04AsIs\x10\x00\x12\x10\n" +
|
||||||
0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x47, 0x65,
|
"\fIpIfNonMatch\x10\x02\x12\x0e\n" +
|
||||||
0x6f, 0x49, 0x50, 0x52, 0x0a, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x47, 0x65, 0x6f, 0x69, 0x70, 0x12,
|
"\n" +
|
||||||
0x41, 0x0a, 0x0f, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x6c, 0x69,
|
"IpOnDemand\x10\x03BO\n" +
|
||||||
0x73, 0x74, 0x18, 0x12, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e,
|
"\x13com.xray.app.routerP\x01Z$github.com/xtls/xray-core/app/router\xaa\x02\x0fXray.App.Routerb\x06proto3"
|
||||||
0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x2e, 0x50, 0x6f, 0x72, 0x74, 0x4c,
|
|
||||||
0x69, 0x73, 0x74, 0x52, 0x0d, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x50, 0x6f, 0x72, 0x74, 0x4c, 0x69,
|
|
||||||
0x73, 0x74, 0x12, 0x43, 0x0a, 0x10, 0x76, 0x6c, 0x65, 0x73, 0x73, 0x5f, 0x72, 0x6f, 0x75, 0x74,
|
|
||||||
0x65, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x78,
|
|
||||||
0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x2e, 0x50,
|
|
||||||
0x6f, 0x72, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x0e, 0x76, 0x6c, 0x65, 0x73, 0x73, 0x52, 0x6f,
|
|
||||||
0x75, 0x74, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x63, 0x65,
|
|
||||||
0x73, 0x73, 0x18, 0x15, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73,
|
|
||||||
0x73, 0x1a, 0x3d, 0x0a, 0x0f, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x45,
|
|
||||||
0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28,
|
|
||||||
0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18,
|
|
||||||
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01,
|
|
||||||
0x42, 0x0c, 0x0a, 0x0a, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x74, 0x61, 0x67, 0x22, 0xdc,
|
|
||||||
0x01, 0x0a, 0x0d, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x69, 0x6e, 0x67, 0x52, 0x75, 0x6c, 0x65,
|
|
||||||
0x12, 0x10, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x74,
|
|
||||||
0x61, 0x67, 0x12, 0x2b, 0x0a, 0x11, 0x6f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x5f, 0x73,
|
|
||||||
0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x10, 0x6f,
|
|
||||||
0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x12,
|
|
||||||
0x1a, 0x0a, 0x08, 0x73, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28,
|
|
||||||
0x09, 0x52, 0x08, 0x73, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x12, 0x4d, 0x0a, 0x11, 0x73,
|
|
||||||
0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73,
|
|
||||||
0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f,
|
|
||||||
0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x2e, 0x54, 0x79, 0x70, 0x65,
|
|
||||||
0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x10, 0x73, 0x74, 0x72, 0x61, 0x74, 0x65,
|
|
||||||
0x67, 0x79, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x66, 0x61,
|
|
||||||
0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x5f, 0x74, 0x61, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09,
|
|
||||||
0x52, 0x0b, 0x66, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x54, 0x61, 0x67, 0x22, 0x54, 0x0a,
|
|
||||||
0x0e, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12,
|
|
||||||
0x16, 0x0a, 0x06, 0x72, 0x65, 0x67, 0x65, 0x78, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52,
|
|
||||||
0x06, 0x72, 0x65, 0x67, 0x65, 0x78, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x61, 0x74, 0x63, 0x68,
|
|
||||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x14, 0x0a,
|
|
||||||
0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x02, 0x52, 0x05, 0x76, 0x61,
|
|
||||||
0x6c, 0x75, 0x65, 0x22, 0xc0, 0x01, 0x0a, 0x17, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79,
|
|
||||||
0x4c, 0x65, 0x61, 0x73, 0x74, 0x4c, 0x6f, 0x61, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12,
|
|
||||||
0x35, 0x0a, 0x05, 0x63, 0x6f, 0x73, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f,
|
|
||||||
0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72,
|
|
||||||
0x2e, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x52,
|
|
||||||
0x05, 0x63, 0x6f, 0x73, 0x74, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x62, 0x61, 0x73, 0x65, 0x6c, 0x69,
|
|
||||||
0x6e, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x03, 0x52, 0x09, 0x62, 0x61, 0x73, 0x65, 0x6c,
|
|
||||||
0x69, 0x6e, 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64,
|
|
||||||
0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64,
|
|
||||||
0x12, 0x16, 0x0a, 0x06, 0x6d, 0x61, 0x78, 0x52, 0x54, 0x54, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03,
|
|
||||||
0x52, 0x06, 0x6d, 0x61, 0x78, 0x52, 0x54, 0x54, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x6f, 0x6c, 0x65,
|
|
||||||
0x72, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x02, 0x52, 0x09, 0x74, 0x6f, 0x6c,
|
|
||||||
0x65, 0x72, 0x61, 0x6e, 0x63, 0x65, 0x22, 0x90, 0x02, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, 0x69,
|
|
||||||
0x67, 0x12, 0x4f, 0x0a, 0x0f, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x5f, 0x73, 0x74, 0x72, 0x61,
|
|
||||||
0x74, 0x65, 0x67, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x26, 0x2e, 0x78, 0x72, 0x61,
|
|
||||||
0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x6e,
|
|
||||||
0x66, 0x69, 0x67, 0x2e, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65,
|
|
||||||
0x67, 0x79, 0x52, 0x0e, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65,
|
|
||||||
0x67, 0x79, 0x12, 0x30, 0x0a, 0x04, 0x72, 0x75, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b,
|
|
||||||
0x32, 0x1c, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74,
|
|
||||||
0x65, 0x72, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x04,
|
|
||||||
0x72, 0x75, 0x6c, 0x65, 0x12, 0x45, 0x0a, 0x0e, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x69, 0x6e,
|
|
||||||
0x67, 0x5f, 0x72, 0x75, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x78,
|
|
||||||
0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x42,
|
|
||||||
0x61, 0x6c, 0x61, 0x6e, 0x63, 0x69, 0x6e, 0x67, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x0d, 0x62, 0x61,
|
|
||||||
0x6c, 0x61, 0x6e, 0x63, 0x69, 0x6e, 0x67, 0x52, 0x75, 0x6c, 0x65, 0x22, 0x3c, 0x0a, 0x0e, 0x44,
|
|
||||||
0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x12, 0x08, 0x0a,
|
|
||||||
0x04, 0x41, 0x73, 0x49, 0x73, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x49, 0x70, 0x49, 0x66, 0x4e,
|
|
||||||
0x6f, 0x6e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x49, 0x70, 0x4f,
|
|
||||||
0x6e, 0x44, 0x65, 0x6d, 0x61, 0x6e, 0x64, 0x10, 0x03, 0x42, 0x4f, 0x0a, 0x13, 0x63, 0x6f, 0x6d,
|
|
||||||
0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72,
|
|
||||||
0x50, 0x01, 0x5a, 0x24, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78,
|
|
||||||
0x74, 0x6c, 0x73, 0x2f, 0x78, 0x72, 0x61, 0x79, 0x2d, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x61, 0x70,
|
|
||||||
0x70, 0x2f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0xaa, 0x02, 0x0f, 0x58, 0x72, 0x61, 0x79, 0x2e,
|
|
||||||
0x41, 0x70, 0x70, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
|
|
||||||
0x6f, 0x33,
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
file_app_router_config_proto_rawDescOnce sync.Once
|
file_app_router_config_proto_rawDescOnce sync.Once
|
||||||
file_app_router_config_proto_rawDescData = file_app_router_config_proto_rawDesc
|
file_app_router_config_proto_rawDescData []byte
|
||||||
)
|
)
|
||||||
|
|
||||||
func file_app_router_config_proto_rawDescGZIP() []byte {
|
func file_app_router_config_proto_rawDescGZIP() []byte {
|
||||||
file_app_router_config_proto_rawDescOnce.Do(func() {
|
file_app_router_config_proto_rawDescOnce.Do(func() {
|
||||||
file_app_router_config_proto_rawDescData = protoimpl.X.CompressGZIP(file_app_router_config_proto_rawDescData)
|
file_app_router_config_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_app_router_config_proto_rawDesc), len(file_app_router_config_proto_rawDesc)))
|
||||||
})
|
})
|
||||||
return file_app_router_config_proto_rawDescData
|
return file_app_router_config_proto_rawDescData
|
||||||
}
|
}
|
||||||
|
|
||||||
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, 15)
|
||||||
var file_app_router_config_proto_goTypes = []any{
|
var file_app_router_config_proto_goTypes = []any{
|
||||||
(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
|
||||||
@@ -1227,43 +1223,47 @@ var file_app_router_config_proto_goTypes = []any{
|
|||||||
(*GeoSite)(nil), // 6: xray.app.router.GeoSite
|
(*GeoSite)(nil), // 6: xray.app.router.GeoSite
|
||||||
(*GeoSiteList)(nil), // 7: xray.app.router.GeoSiteList
|
(*GeoSiteList)(nil), // 7: xray.app.router.GeoSiteList
|
||||||
(*RoutingRule)(nil), // 8: xray.app.router.RoutingRule
|
(*RoutingRule)(nil), // 8: xray.app.router.RoutingRule
|
||||||
(*BalancingRule)(nil), // 9: xray.app.router.BalancingRule
|
(*WebhookConfig)(nil), // 9: xray.app.router.WebhookConfig
|
||||||
(*StrategyWeight)(nil), // 10: xray.app.router.StrategyWeight
|
(*BalancingRule)(nil), // 10: xray.app.router.BalancingRule
|
||||||
(*StrategyLeastLoadConfig)(nil), // 11: xray.app.router.StrategyLeastLoadConfig
|
(*StrategyWeight)(nil), // 11: xray.app.router.StrategyWeight
|
||||||
(*Config)(nil), // 12: xray.app.router.Config
|
(*StrategyLeastLoadConfig)(nil), // 12: xray.app.router.StrategyLeastLoadConfig
|
||||||
(*Domain_Attribute)(nil), // 13: xray.app.router.Domain.Attribute
|
(*Config)(nil), // 13: xray.app.router.Config
|
||||||
nil, // 14: xray.app.router.RoutingRule.AttributesEntry
|
(*Domain_Attribute)(nil), // 14: xray.app.router.Domain.Attribute
|
||||||
(*net.PortList)(nil), // 15: xray.common.net.PortList
|
nil, // 15: xray.app.router.RoutingRule.AttributesEntry
|
||||||
(net.Network)(0), // 16: xray.common.net.Network
|
nil, // 16: xray.app.router.WebhookConfig.HeadersEntry
|
||||||
(*serial.TypedMessage)(nil), // 17: xray.common.serial.TypedMessage
|
(*net.PortList)(nil), // 17: xray.common.net.PortList
|
||||||
|
(net.Network)(0), // 18: xray.common.net.Network
|
||||||
|
(*serial.TypedMessage)(nil), // 19: xray.common.serial.TypedMessage
|
||||||
}
|
}
|
||||||
var file_app_router_config_proto_depIdxs = []int32{
|
var file_app_router_config_proto_depIdxs = []int32{
|
||||||
0, // 0: xray.app.router.Domain.type:type_name -> xray.app.router.Domain.Type
|
0, // 0: xray.app.router.Domain.type:type_name -> xray.app.router.Domain.Type
|
||||||
13, // 1: xray.app.router.Domain.attribute:type_name -> xray.app.router.Domain.Attribute
|
14, // 1: xray.app.router.Domain.attribute:type_name -> xray.app.router.Domain.Attribute
|
||||||
3, // 2: xray.app.router.GeoIP.cidr:type_name -> xray.app.router.CIDR
|
3, // 2: xray.app.router.GeoIP.cidr:type_name -> xray.app.router.CIDR
|
||||||
4, // 3: xray.app.router.GeoIPList.entry:type_name -> xray.app.router.GeoIP
|
4, // 3: xray.app.router.GeoIPList.entry:type_name -> xray.app.router.GeoIP
|
||||||
2, // 4: xray.app.router.GeoSite.domain:type_name -> xray.app.router.Domain
|
2, // 4: xray.app.router.GeoSite.domain:type_name -> xray.app.router.Domain
|
||||||
6, // 5: xray.app.router.GeoSiteList.entry:type_name -> xray.app.router.GeoSite
|
6, // 5: xray.app.router.GeoSiteList.entry:type_name -> xray.app.router.GeoSite
|
||||||
2, // 6: xray.app.router.RoutingRule.domain:type_name -> xray.app.router.Domain
|
2, // 6: xray.app.router.RoutingRule.domain:type_name -> xray.app.router.Domain
|
||||||
4, // 7: xray.app.router.RoutingRule.geoip:type_name -> xray.app.router.GeoIP
|
4, // 7: xray.app.router.RoutingRule.geoip:type_name -> xray.app.router.GeoIP
|
||||||
15, // 8: xray.app.router.RoutingRule.port_list:type_name -> xray.common.net.PortList
|
17, // 8: xray.app.router.RoutingRule.port_list:type_name -> xray.common.net.PortList
|
||||||
16, // 9: xray.app.router.RoutingRule.networks:type_name -> xray.common.net.Network
|
18, // 9: xray.app.router.RoutingRule.networks:type_name -> xray.common.net.Network
|
||||||
4, // 10: xray.app.router.RoutingRule.source_geoip:type_name -> xray.app.router.GeoIP
|
4, // 10: xray.app.router.RoutingRule.source_geoip:type_name -> xray.app.router.GeoIP
|
||||||
15, // 11: xray.app.router.RoutingRule.source_port_list:type_name -> xray.common.net.PortList
|
17, // 11: xray.app.router.RoutingRule.source_port_list:type_name -> xray.common.net.PortList
|
||||||
14, // 12: xray.app.router.RoutingRule.attributes:type_name -> xray.app.router.RoutingRule.AttributesEntry
|
15, // 12: xray.app.router.RoutingRule.attributes:type_name -> xray.app.router.RoutingRule.AttributesEntry
|
||||||
4, // 13: xray.app.router.RoutingRule.local_geoip:type_name -> xray.app.router.GeoIP
|
4, // 13: xray.app.router.RoutingRule.local_geoip:type_name -> xray.app.router.GeoIP
|
||||||
15, // 14: xray.app.router.RoutingRule.local_port_list:type_name -> xray.common.net.PortList
|
17, // 14: xray.app.router.RoutingRule.local_port_list:type_name -> xray.common.net.PortList
|
||||||
15, // 15: xray.app.router.RoutingRule.vless_route_list:type_name -> xray.common.net.PortList
|
17, // 15: xray.app.router.RoutingRule.vless_route_list:type_name -> xray.common.net.PortList
|
||||||
17, // 16: xray.app.router.BalancingRule.strategy_settings:type_name -> xray.common.serial.TypedMessage
|
9, // 16: xray.app.router.RoutingRule.webhook:type_name -> xray.app.router.WebhookConfig
|
||||||
10, // 17: xray.app.router.StrategyLeastLoadConfig.costs:type_name -> xray.app.router.StrategyWeight
|
16, // 17: xray.app.router.WebhookConfig.headers:type_name -> xray.app.router.WebhookConfig.HeadersEntry
|
||||||
1, // 18: xray.app.router.Config.domain_strategy:type_name -> xray.app.router.Config.DomainStrategy
|
19, // 18: xray.app.router.BalancingRule.strategy_settings:type_name -> xray.common.serial.TypedMessage
|
||||||
8, // 19: xray.app.router.Config.rule:type_name -> xray.app.router.RoutingRule
|
11, // 19: xray.app.router.StrategyLeastLoadConfig.costs:type_name -> xray.app.router.StrategyWeight
|
||||||
9, // 20: xray.app.router.Config.balancing_rule:type_name -> xray.app.router.BalancingRule
|
1, // 20: xray.app.router.Config.domain_strategy:type_name -> xray.app.router.Config.DomainStrategy
|
||||||
21, // [21:21] is the sub-list for method output_type
|
8, // 21: xray.app.router.Config.rule:type_name -> xray.app.router.RoutingRule
|
||||||
21, // [21:21] is the sub-list for method input_type
|
10, // 22: xray.app.router.Config.balancing_rule:type_name -> xray.app.router.BalancingRule
|
||||||
21, // [21:21] is the sub-list for extension type_name
|
23, // [23:23] is the sub-list for method output_type
|
||||||
21, // [21:21] is the sub-list for extension extendee
|
23, // [23:23] is the sub-list for method input_type
|
||||||
0, // [0:21] is the sub-list for field type_name
|
23, // [23:23] is the sub-list for extension type_name
|
||||||
|
23, // [23:23] is the sub-list for extension extendee
|
||||||
|
0, // [0:23] is the sub-list for field type_name
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { file_app_router_config_proto_init() }
|
func init() { file_app_router_config_proto_init() }
|
||||||
@@ -1275,7 +1275,7 @@ func file_app_router_config_proto_init() {
|
|||||||
(*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[12].OneofWrappers = []any{
|
||||||
(*Domain_Attribute_BoolValue)(nil),
|
(*Domain_Attribute_BoolValue)(nil),
|
||||||
(*Domain_Attribute_IntValue)(nil),
|
(*Domain_Attribute_IntValue)(nil),
|
||||||
}
|
}
|
||||||
@@ -1283,9 +1283,9 @@ func file_app_router_config_proto_init() {
|
|||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_app_router_config_proto_rawDesc,
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_app_router_config_proto_rawDesc), len(file_app_router_config_proto_rawDesc)),
|
||||||
NumEnums: 2,
|
NumEnums: 2,
|
||||||
NumMessages: 13,
|
NumMessages: 15,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 0,
|
NumServices: 0,
|
||||||
},
|
},
|
||||||
@@ -1295,7 +1295,6 @@ func file_app_router_config_proto_init() {
|
|||||||
MessageInfos: file_app_router_config_proto_msgTypes,
|
MessageInfos: file_app_router_config_proto_msgTypes,
|
||||||
}.Build()
|
}.Build()
|
||||||
File_app_router_config_proto = out.File
|
File_app_router_config_proto = out.File
|
||||||
file_app_router_config_proto_rawDesc = nil
|
|
||||||
file_app_router_config_proto_goTypes = nil
|
file_app_router_config_proto_goTypes = nil
|
||||||
file_app_router_config_proto_depIdxs = nil
|
file_app_router_config_proto_depIdxs = nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,6 +114,13 @@ message RoutingRule {
|
|||||||
|
|
||||||
xray.common.net.PortList vless_route_list = 20;
|
xray.common.net.PortList vless_route_list = 20;
|
||||||
repeated string process = 21;
|
repeated string process = 21;
|
||||||
|
WebhookConfig webhook = 22;
|
||||||
|
}
|
||||||
|
|
||||||
|
message WebhookConfig {
|
||||||
|
string url = 1;
|
||||||
|
uint32 deduplication = 2;
|
||||||
|
map<string, string> headers = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
message BalancingRule {
|
message BalancingRule {
|
||||||
|
|||||||
@@ -0,0 +1,100 @@
|
|||||||
|
package router
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/gob"
|
||||||
|
"errors"
|
||||||
|
"io"
|
||||||
|
"runtime"
|
||||||
|
|
||||||
|
"github.com/xtls/xray-core/common/strmatcher"
|
||||||
|
)
|
||||||
|
|
||||||
|
type geoSiteListGob struct {
|
||||||
|
Sites map[string][]byte
|
||||||
|
Deps map[string][]string
|
||||||
|
Hosts map[string][]string
|
||||||
|
}
|
||||||
|
|
||||||
|
func SerializeGeoSiteList(sites []*GeoSite, deps map[string][]string, hosts map[string][]string, w io.Writer) error {
|
||||||
|
data := geoSiteListGob{
|
||||||
|
Sites: make(map[string][]byte),
|
||||||
|
Deps: deps,
|
||||||
|
Hosts: hosts,
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, site := range sites {
|
||||||
|
if site == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
var buf bytesWriter
|
||||||
|
if err := SerializeDomainMatcher(site.Domain, &buf); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
data.Sites[site.CountryCode] = buf.Bytes()
|
||||||
|
}
|
||||||
|
|
||||||
|
return gob.NewEncoder(w).Encode(data)
|
||||||
|
}
|
||||||
|
|
||||||
|
type bytesWriter struct {
|
||||||
|
data []byte
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *bytesWriter) Write(p []byte) (n int, err error) {
|
||||||
|
w.data = append(w.data, p...)
|
||||||
|
return len(p), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *bytesWriter) Bytes() []byte {
|
||||||
|
return w.data
|
||||||
|
}
|
||||||
|
|
||||||
|
func LoadGeoSiteMatcher(r io.Reader, countryCode string) (strmatcher.IndexMatcher, error) {
|
||||||
|
var data geoSiteListGob
|
||||||
|
if err := gob.NewDecoder(r).Decode(&data); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return loadWithDeps(&data, countryCode, make(map[string]bool))
|
||||||
|
}
|
||||||
|
|
||||||
|
func loadWithDeps(data *geoSiteListGob, code string, visited map[string]bool) (strmatcher.IndexMatcher, error) {
|
||||||
|
if visited[code] {
|
||||||
|
return nil, errors.New("cyclic dependency")
|
||||||
|
}
|
||||||
|
visited[code] = true
|
||||||
|
|
||||||
|
var matchers []strmatcher.IndexMatcher
|
||||||
|
|
||||||
|
if siteData, ok := data.Sites[code]; ok {
|
||||||
|
m, err := NewDomainMatcherFromBuffer(siteData)
|
||||||
|
if err == nil {
|
||||||
|
matchers = append(matchers, m)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if deps, ok := data.Deps[code]; ok {
|
||||||
|
for _, dep := range deps {
|
||||||
|
m, err := loadWithDeps(data, dep, visited)
|
||||||
|
if err == nil {
|
||||||
|
matchers = append(matchers, m)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(matchers) == 0 {
|
||||||
|
return nil, errors.New("matcher not found for: " + code)
|
||||||
|
}
|
||||||
|
if len(matchers) == 1 {
|
||||||
|
return matchers[0], nil
|
||||||
|
}
|
||||||
|
runtime.GC()
|
||||||
|
return &strmatcher.IndexMatcherGroup{Matchers: matchers}, nil
|
||||||
|
}
|
||||||
|
func LoadGeoSiteHosts(r io.Reader) (map[string][]string, error) {
|
||||||
|
var data geoSiteListGob
|
||||||
|
if err := gob.NewDecoder(r).Decode(&data); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return data.Hosts, nil
|
||||||
|
}
|
||||||
+76
-1
@@ -2,7 +2,7 @@ package router
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
sync "sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/xtls/xray-core/common"
|
"github.com/xtls/xray-core/common"
|
||||||
"github.com/xtls/xray-core/common/errors"
|
"github.com/xtls/xray-core/common/errors"
|
||||||
@@ -57,6 +57,7 @@ func (r *Router) Init(ctx context.Context, config *Config, d dns.Client, ohm out
|
|||||||
for _, rule := range config.Rule {
|
for _, rule := range config.Rule {
|
||||||
cond, err := rule.BuildCondition()
|
cond, err := rule.BuildCondition()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
r.closeWebhooks()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
rr := &Rule{
|
rr := &Rule{
|
||||||
@@ -64,10 +65,22 @@ func (r *Router) Init(ctx context.Context, config *Config, d dns.Client, ohm out
|
|||||||
Tag: rule.GetTag(),
|
Tag: rule.GetTag(),
|
||||||
RuleTag: rule.GetRuleTag(),
|
RuleTag: rule.GetRuleTag(),
|
||||||
}
|
}
|
||||||
|
if wh := rule.GetWebhook(); wh != nil {
|
||||||
|
notifier, err := NewWebhookNotifier(wh)
|
||||||
|
if err != nil {
|
||||||
|
r.closeWebhooks()
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
rr.Webhook = notifier
|
||||||
|
}
|
||||||
btag := rule.GetBalancingTag()
|
btag := rule.GetBalancingTag()
|
||||||
if len(btag) > 0 {
|
if len(btag) > 0 {
|
||||||
brule, found := r.balancers[btag]
|
brule, found := r.balancers[btag]
|
||||||
if !found {
|
if !found {
|
||||||
|
if rr.Webhook != nil {
|
||||||
|
rr.Webhook.Close()
|
||||||
|
}
|
||||||
|
r.closeWebhooks()
|
||||||
return errors.New("balancer ", btag, " not found")
|
return errors.New("balancer ", btag, " not found")
|
||||||
}
|
}
|
||||||
rr.Balancer = brule
|
rr.Balancer = brule
|
||||||
@@ -80,6 +93,7 @@ func (r *Router) Init(ctx context.Context, config *Config, d dns.Client, ohm out
|
|||||||
|
|
||||||
// PickRoute implements routing.Router.
|
// PickRoute implements routing.Router.
|
||||||
func (r *Router) PickRoute(ctx routing.Context) (routing.Route, error) {
|
func (r *Router) PickRoute(ctx routing.Context) (routing.Route, error) {
|
||||||
|
originalCtx := ctx
|
||||||
rule, ctx, err := r.pickRouteInternal(ctx)
|
rule, ctx, err := r.pickRouteInternal(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -88,6 +102,9 @@ func (r *Router) PickRoute(ctx routing.Context) (routing.Route, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
if rule.Webhook != nil {
|
||||||
|
rule.Webhook.Fire(originalCtx, tag)
|
||||||
|
}
|
||||||
return &Route{Context: ctx, outboundTag: tag, ruleTag: rule.RuleTag}, nil
|
return &Route{Context: ctx, outboundTag: tag, ruleTag: rule.RuleTag}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,6 +126,11 @@ func (r *Router) ReloadRules(config *Config, shouldAppend bool) error {
|
|||||||
defer r.mu.Unlock()
|
defer r.mu.Unlock()
|
||||||
|
|
||||||
if !shouldAppend {
|
if !shouldAppend {
|
||||||
|
for _, rule := range r.rules {
|
||||||
|
if rule.Webhook != nil {
|
||||||
|
rule.Webhook.Close()
|
||||||
|
}
|
||||||
|
}
|
||||||
r.balancers = make(map[string]*Balancer, len(config.BalancingRule))
|
r.balancers = make(map[string]*Balancer, len(config.BalancingRule))
|
||||||
r.rules = make([]*Rule, 0, len(config.Rule))
|
r.rules = make([]*Rule, 0, len(config.Rule))
|
||||||
}
|
}
|
||||||
@@ -125,12 +147,24 @@ func (r *Router) ReloadRules(config *Config, shouldAppend bool) error {
|
|||||||
r.balancers[rule.Tag] = balancer
|
r.balancers[rule.Tag] = balancer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
startIdx := len(r.rules)
|
||||||
|
closeNewWebhooks := func() {
|
||||||
|
for i := startIdx; i < len(r.rules); i++ {
|
||||||
|
if r.rules[i].Webhook != nil {
|
||||||
|
r.rules[i].Webhook.Close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
r.rules = r.rules[:startIdx]
|
||||||
|
}
|
||||||
|
|
||||||
for _, rule := range config.Rule {
|
for _, rule := range config.Rule {
|
||||||
if r.RuleExists(rule.GetRuleTag()) {
|
if r.RuleExists(rule.GetRuleTag()) {
|
||||||
|
closeNewWebhooks()
|
||||||
return errors.New("duplicate ruleTag ", rule.GetRuleTag())
|
return errors.New("duplicate ruleTag ", rule.GetRuleTag())
|
||||||
}
|
}
|
||||||
cond, err := rule.BuildCondition()
|
cond, err := rule.BuildCondition()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
closeNewWebhooks()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
rr := &Rule{
|
rr := &Rule{
|
||||||
@@ -138,10 +172,22 @@ func (r *Router) ReloadRules(config *Config, shouldAppend bool) error {
|
|||||||
Tag: rule.GetTag(),
|
Tag: rule.GetTag(),
|
||||||
RuleTag: rule.GetRuleTag(),
|
RuleTag: rule.GetRuleTag(),
|
||||||
}
|
}
|
||||||
|
if wh := rule.GetWebhook(); wh != nil {
|
||||||
|
notifier, err := NewWebhookNotifier(wh)
|
||||||
|
if err != nil {
|
||||||
|
closeNewWebhooks()
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
rr.Webhook = notifier
|
||||||
|
}
|
||||||
btag := rule.GetBalancingTag()
|
btag := rule.GetBalancingTag()
|
||||||
if len(btag) > 0 {
|
if len(btag) > 0 {
|
||||||
brule, found := r.balancers[btag]
|
brule, found := r.balancers[btag]
|
||||||
if !found {
|
if !found {
|
||||||
|
if rr.Webhook != nil {
|
||||||
|
rr.Webhook.Close()
|
||||||
|
}
|
||||||
|
closeNewWebhooks()
|
||||||
return errors.New("balancer ", btag, " not found")
|
return errors.New("balancer ", btag, " not found")
|
||||||
}
|
}
|
||||||
rr.Balancer = brule
|
rr.Balancer = brule
|
||||||
@@ -173,6 +219,8 @@ func (r *Router) RemoveRule(tag string) error {
|
|||||||
for _, rule := range r.rules {
|
for _, rule := range r.rules {
|
||||||
if rule.RuleTag != tag {
|
if rule.RuleTag != tag {
|
||||||
newRules = append(newRules, rule)
|
newRules = append(newRules, rule)
|
||||||
|
} else if rule.Webhook != nil {
|
||||||
|
rule.Webhook.Close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
r.rules = newRules
|
r.rules = newRules
|
||||||
@@ -181,6 +229,21 @@ func (r *Router) RemoveRule(tag string) error {
|
|||||||
return errors.New("empty tag name!")
|
return errors.New("empty tag name!")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ListRule implements routing.Router
|
||||||
|
func (r *Router) ListRule() []routing.Route {
|
||||||
|
r.mu.Lock()
|
||||||
|
defer r.mu.Unlock()
|
||||||
|
ruleList := make([]routing.Route, 0)
|
||||||
|
for _, rule := range r.rules {
|
||||||
|
ruleList = append(ruleList, &Route{
|
||||||
|
outboundTag: rule.Tag,
|
||||||
|
ruleTag: rule.RuleTag,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return ruleList
|
||||||
|
}
|
||||||
|
|
||||||
func (r *Router) pickRouteInternal(ctx routing.Context) (*Rule, routing.Context, error) {
|
func (r *Router) pickRouteInternal(ctx routing.Context) (*Rule, routing.Context, error) {
|
||||||
// SkipDNSResolve is set from DNS module.
|
// SkipDNSResolve is set from DNS module.
|
||||||
// the DOH remote server maybe a domain name,
|
// the DOH remote server maybe a domain name,
|
||||||
@@ -218,8 +281,20 @@ func (r *Router) Start() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// closeWebhooks closes all webhook notifiers in the current rule set.
|
||||||
|
func (r *Router) closeWebhooks() {
|
||||||
|
for _, rule := range r.rules {
|
||||||
|
if rule.Webhook != nil {
|
||||||
|
rule.Webhook.Close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Close implements common.Closable.
|
// Close implements common.Closable.
|
||||||
func (r *Router) Close() error {
|
func (r *Router) Close() error {
|
||||||
|
r.mu.Lock()
|
||||||
|
defer r.mu.Unlock()
|
||||||
|
r.closeWebhooks()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,287 @@
|
|||||||
|
package router
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"io"
|
||||||
|
"net"
|
||||||
|
"net/http"
|
||||||
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
|
"strings"
|
||||||
|
"sync"
|
||||||
|
"syscall"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/xtls/xray-core/common/errors"
|
||||||
|
"github.com/xtls/xray-core/features/routing"
|
||||||
|
routing_session "github.com/xtls/xray-core/features/routing/session"
|
||||||
|
)
|
||||||
|
|
||||||
|
// parseURL splits a webhook URL into an HTTP URL and an optional Unix socket
|
||||||
|
// path. For regular http/https URLs the input is returned unchanged with an
|
||||||
|
// empty socketPath. For Unix sockets the format is:
|
||||||
|
//
|
||||||
|
// /path/to/socket.sock:/http/path
|
||||||
|
// @abstract:/http/path
|
||||||
|
// @@padded:/http/path
|
||||||
|
//
|
||||||
|
// The :/ separator after the socket path delimits the HTTP request path.
|
||||||
|
// If omitted, "/" is used.
|
||||||
|
func parseURL(raw string) (httpURL, socketPath string) {
|
||||||
|
if len(raw) == 0 || (!filepath.IsAbs(raw) && raw[0] != '@') {
|
||||||
|
return raw, ""
|
||||||
|
}
|
||||||
|
if idx := strings.Index(raw, ":/"); idx >= 0 {
|
||||||
|
return "http://localhost" + raw[idx+1:], raw[:idx]
|
||||||
|
}
|
||||||
|
return "http://localhost/", raw
|
||||||
|
}
|
||||||
|
|
||||||
|
// resolveSocketPath applies platform-specific transformations to a Unix
|
||||||
|
// socket path, matching the behaviour of the listen side in
|
||||||
|
// transport/internet/system_listener.go.
|
||||||
|
//
|
||||||
|
// For abstract sockets (prefix @) on Linux/Android:
|
||||||
|
// - single @ — used as-is (lock-free abstract socket)
|
||||||
|
// - double @@ — stripped to single @ and padded to
|
||||||
|
// syscall.RawSockaddrUnix{}.Path length (HAProxy compat)
|
||||||
|
func resolveSocketPath(path string) string {
|
||||||
|
if len(path) == 0 || path[0] != '@' {
|
||||||
|
return path
|
||||||
|
}
|
||||||
|
if runtime.GOOS != "linux" && runtime.GOOS != "android" {
|
||||||
|
return path
|
||||||
|
}
|
||||||
|
if len(path) > 1 && path[1] == '@' {
|
||||||
|
fullAddr := make([]byte, len(syscall.RawSockaddrUnix{}.Path))
|
||||||
|
copy(fullAddr, path[1:])
|
||||||
|
return string(fullAddr)
|
||||||
|
}
|
||||||
|
return path
|
||||||
|
}
|
||||||
|
|
||||||
|
func ptr[T any](v T) *T { return &v }
|
||||||
|
|
||||||
|
type event struct {
|
||||||
|
Email *string `json:"email"`
|
||||||
|
Level *uint32 `json:"level"`
|
||||||
|
Protocol *string `json:"protocol"`
|
||||||
|
Network *string `json:"network"`
|
||||||
|
Source *string `json:"source"`
|
||||||
|
Destination *string `json:"destination"`
|
||||||
|
OriginalTarget *string `json:"originalTarget"`
|
||||||
|
RouteTarget *string `json:"routeTarget"`
|
||||||
|
InboundTag *string `json:"inboundTag"`
|
||||||
|
InboundName *string `json:"inboundName"`
|
||||||
|
InboundLocal *string `json:"inboundLocal"`
|
||||||
|
OutboundTag *string `json:"outboundTag"`
|
||||||
|
Timestamp int64 `json:"ts"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type WebhookNotifier struct {
|
||||||
|
url string
|
||||||
|
headers map[string]string
|
||||||
|
deduplication uint32
|
||||||
|
client *http.Client
|
||||||
|
seen sync.Map
|
||||||
|
done chan struct{}
|
||||||
|
wg sync.WaitGroup
|
||||||
|
closeOnce sync.Once
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewWebhookNotifier(cfg *WebhookConfig) (*WebhookNotifier, error) {
|
||||||
|
if cfg == nil || cfg.Url == "" {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
httpURL, socketPath := parseURL(cfg.Url)
|
||||||
|
h := &WebhookNotifier{
|
||||||
|
url: httpURL,
|
||||||
|
deduplication: cfg.Deduplication,
|
||||||
|
client: &http.Client{
|
||||||
|
Timeout: 5 * time.Second,
|
||||||
|
},
|
||||||
|
done: make(chan struct{}),
|
||||||
|
}
|
||||||
|
|
||||||
|
if socketPath != "" {
|
||||||
|
dialAddr := resolveSocketPath(socketPath)
|
||||||
|
h.client.Transport = &http.Transport{
|
||||||
|
DialContext: func(ctx context.Context, _, _ string) (net.Conn, error) {
|
||||||
|
var d net.Dialer
|
||||||
|
return d.DialContext(ctx, "unix", dialAddr)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(cfg.Headers) > 0 {
|
||||||
|
h.headers = make(map[string]string, len(cfg.Headers))
|
||||||
|
for k, v := range cfg.Headers {
|
||||||
|
h.headers[k] = v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if h.deduplication > 0 {
|
||||||
|
h.wg.Add(1)
|
||||||
|
go h.cleanupLoop()
|
||||||
|
}
|
||||||
|
|
||||||
|
return h, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *WebhookNotifier) Fire(ctx routing.Context, outboundTag string) {
|
||||||
|
ev := buildEvent(ctx, outboundTag)
|
||||||
|
|
||||||
|
email := ""
|
||||||
|
if ev.Email != nil {
|
||||||
|
email = *ev.Email
|
||||||
|
}
|
||||||
|
if h.isDuplicate(email) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
h.wg.Add(1)
|
||||||
|
select {
|
||||||
|
case <-h.done:
|
||||||
|
h.wg.Done()
|
||||||
|
return
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
go func() {
|
||||||
|
defer h.wg.Done()
|
||||||
|
h.post(ev)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
|
func buildEvent(ctx routing.Context, outboundTag string) *event {
|
||||||
|
ev := &event{
|
||||||
|
Timestamp: time.Now().Unix(),
|
||||||
|
OutboundTag: ptr(outboundTag),
|
||||||
|
InboundTag: ptr(ctx.GetInboundTag()),
|
||||||
|
Protocol: ptr(ctx.GetProtocol()),
|
||||||
|
Network: ptr(ctx.GetNetwork().SystemString()),
|
||||||
|
}
|
||||||
|
|
||||||
|
if user := ctx.GetUser(); user != "" {
|
||||||
|
ev.Email = ptr(user)
|
||||||
|
}
|
||||||
|
|
||||||
|
if srcIPs := ctx.GetSourceIPs(); len(srcIPs) > 0 {
|
||||||
|
srcPort := ctx.GetSourcePort()
|
||||||
|
ev.Source = ptr(net.JoinHostPort(srcIPs[0].String(), srcPort.String()))
|
||||||
|
}
|
||||||
|
|
||||||
|
targetPort := ctx.GetTargetPort()
|
||||||
|
if domain := ctx.GetTargetDomain(); domain != "" {
|
||||||
|
ev.Destination = ptr(net.JoinHostPort(domain, targetPort.String()))
|
||||||
|
} else if targetIPs := ctx.GetTargetIPs(); len(targetIPs) > 0 {
|
||||||
|
ev.Destination = ptr(net.JoinHostPort(targetIPs[0].String(), targetPort.String()))
|
||||||
|
}
|
||||||
|
|
||||||
|
if localIPs := ctx.GetLocalIPs(); len(localIPs) > 0 {
|
||||||
|
localPort := ctx.GetLocalPort()
|
||||||
|
ev.InboundLocal = ptr(net.JoinHostPort(localIPs[0].String(), localPort.String()))
|
||||||
|
}
|
||||||
|
|
||||||
|
if sctx, ok := ctx.(*routing_session.Context); ok {
|
||||||
|
enrichFromSession(ev, sctx)
|
||||||
|
}
|
||||||
|
|
||||||
|
return ev
|
||||||
|
}
|
||||||
|
|
||||||
|
func enrichFromSession(ev *event, sctx *routing_session.Context) {
|
||||||
|
if sctx.Inbound != nil {
|
||||||
|
ev.InboundName = ptr(sctx.Inbound.Name)
|
||||||
|
if sctx.Inbound.User != nil {
|
||||||
|
ev.Level = ptr(sctx.Inbound.User.Level)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if sctx.Outbound != nil {
|
||||||
|
if sctx.Outbound.OriginalTarget.Address != nil {
|
||||||
|
ev.OriginalTarget = ptr(sctx.Outbound.OriginalTarget.String())
|
||||||
|
}
|
||||||
|
if sctx.Outbound.RouteTarget.Address != nil {
|
||||||
|
ev.RouteTarget = ptr(sctx.Outbound.RouteTarget.String())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *WebhookNotifier) post(ev *event) {
|
||||||
|
body, err := json.Marshal(ev)
|
||||||
|
if err != nil {
|
||||||
|
errors.LogWarning(context.Background(), "webhook: marshal failed: ", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
req, err := http.NewRequestWithContext(context.Background(), http.MethodPost, h.url, bytes.NewReader(body))
|
||||||
|
if err != nil {
|
||||||
|
errors.LogWarning(context.Background(), "webhook: request build failed: ", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
req.Header.Set("Content-Type", "application/json")
|
||||||
|
|
||||||
|
for k, v := range h.headers {
|
||||||
|
req.Header.Set(k, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := h.client.Do(req)
|
||||||
|
if err != nil {
|
||||||
|
errors.LogInfo(context.Background(), "webhook: POST failed: ", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
defer func() {
|
||||||
|
io.Copy(io.Discard, resp.Body)
|
||||||
|
resp.Body.Close()
|
||||||
|
}()
|
||||||
|
if resp.StatusCode >= 400 {
|
||||||
|
errors.LogWarning(context.Background(), "webhook: POST returned status ", resp.StatusCode)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *WebhookNotifier) isDuplicate(email string) bool {
|
||||||
|
if h.deduplication == 0 || email == "" {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
ttl := time.Duration(h.deduplication) * time.Second
|
||||||
|
now := time.Now()
|
||||||
|
if v, loaded := h.seen.LoadOrStore(email, now); loaded {
|
||||||
|
if now.Sub(v.(time.Time)) < ttl {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
h.seen.Store(email, now)
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *WebhookNotifier) cleanupLoop() {
|
||||||
|
defer h.wg.Done()
|
||||||
|
ttl := time.Duration(h.deduplication) * time.Second
|
||||||
|
ticker := time.NewTicker(ttl)
|
||||||
|
defer ticker.Stop()
|
||||||
|
for {
|
||||||
|
select {
|
||||||
|
case <-h.done:
|
||||||
|
return
|
||||||
|
case <-ticker.C:
|
||||||
|
now := time.Now()
|
||||||
|
h.seen.Range(func(key, value any) bool {
|
||||||
|
if now.Sub(value.(time.Time)) >= ttl {
|
||||||
|
h.seen.Delete(key)
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *WebhookNotifier) Close() error {
|
||||||
|
h.closeOnce.Do(func() {
|
||||||
|
close(h.done)
|
||||||
|
})
|
||||||
|
h.wg.Wait()
|
||||||
|
h.client.CloseIdleConnections()
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@@ -70,7 +70,7 @@ func (s *statsServer) GetStatsOnlineIpList(ctx context.Context, request *GetStat
|
|||||||
}
|
}
|
||||||
|
|
||||||
ips := make(map[string]int64)
|
ips := make(map[string]int64)
|
||||||
for ip, t := range c.IpTimeMap() {
|
for ip, t := range c.IPTimeMap() {
|
||||||
ips[ip] = t.Unix()
|
ips[ip] = t.Unix()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.36.8
|
// protoc-gen-go v1.36.11
|
||||||
// protoc v6.32.0
|
// protoc v6.33.5
|
||||||
// source: command.proto
|
// source: app/stats/command/command.proto
|
||||||
|
|
||||||
package command
|
package command
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ type GetStatsRequest struct {
|
|||||||
|
|
||||||
func (x *GetStatsRequest) Reset() {
|
func (x *GetStatsRequest) Reset() {
|
||||||
*x = GetStatsRequest{}
|
*x = GetStatsRequest{}
|
||||||
mi := &file_command_proto_msgTypes[0]
|
mi := &file_app_stats_command_command_proto_msgTypes[0]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@@ -45,7 +45,7 @@ func (x *GetStatsRequest) String() string {
|
|||||||
func (*GetStatsRequest) ProtoMessage() {}
|
func (*GetStatsRequest) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *GetStatsRequest) ProtoReflect() protoreflect.Message {
|
func (x *GetStatsRequest) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_command_proto_msgTypes[0]
|
mi := &file_app_stats_command_command_proto_msgTypes[0]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@@ -58,7 +58,7 @@ func (x *GetStatsRequest) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use GetStatsRequest.ProtoReflect.Descriptor instead.
|
// Deprecated: Use GetStatsRequest.ProtoReflect.Descriptor instead.
|
||||||
func (*GetStatsRequest) Descriptor() ([]byte, []int) {
|
func (*GetStatsRequest) Descriptor() ([]byte, []int) {
|
||||||
return file_command_proto_rawDescGZIP(), []int{0}
|
return file_app_stats_command_command_proto_rawDescGZIP(), []int{0}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GetStatsRequest) GetName() string {
|
func (x *GetStatsRequest) GetName() string {
|
||||||
@@ -85,7 +85,7 @@ type Stat struct {
|
|||||||
|
|
||||||
func (x *Stat) Reset() {
|
func (x *Stat) Reset() {
|
||||||
*x = Stat{}
|
*x = Stat{}
|
||||||
mi := &file_command_proto_msgTypes[1]
|
mi := &file_app_stats_command_command_proto_msgTypes[1]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@@ -97,7 +97,7 @@ func (x *Stat) String() string {
|
|||||||
func (*Stat) ProtoMessage() {}
|
func (*Stat) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *Stat) ProtoReflect() protoreflect.Message {
|
func (x *Stat) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_command_proto_msgTypes[1]
|
mi := &file_app_stats_command_command_proto_msgTypes[1]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@@ -110,7 +110,7 @@ func (x *Stat) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use Stat.ProtoReflect.Descriptor instead.
|
// Deprecated: Use Stat.ProtoReflect.Descriptor instead.
|
||||||
func (*Stat) Descriptor() ([]byte, []int) {
|
func (*Stat) Descriptor() ([]byte, []int) {
|
||||||
return file_command_proto_rawDescGZIP(), []int{1}
|
return file_app_stats_command_command_proto_rawDescGZIP(), []int{1}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Stat) GetName() string {
|
func (x *Stat) GetName() string {
|
||||||
@@ -136,7 +136,7 @@ type GetStatsResponse struct {
|
|||||||
|
|
||||||
func (x *GetStatsResponse) Reset() {
|
func (x *GetStatsResponse) Reset() {
|
||||||
*x = GetStatsResponse{}
|
*x = GetStatsResponse{}
|
||||||
mi := &file_command_proto_msgTypes[2]
|
mi := &file_app_stats_command_command_proto_msgTypes[2]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@@ -148,7 +148,7 @@ func (x *GetStatsResponse) String() string {
|
|||||||
func (*GetStatsResponse) ProtoMessage() {}
|
func (*GetStatsResponse) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *GetStatsResponse) ProtoReflect() protoreflect.Message {
|
func (x *GetStatsResponse) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_command_proto_msgTypes[2]
|
mi := &file_app_stats_command_command_proto_msgTypes[2]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@@ -161,7 +161,7 @@ func (x *GetStatsResponse) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use GetStatsResponse.ProtoReflect.Descriptor instead.
|
// Deprecated: Use GetStatsResponse.ProtoReflect.Descriptor instead.
|
||||||
func (*GetStatsResponse) Descriptor() ([]byte, []int) {
|
func (*GetStatsResponse) Descriptor() ([]byte, []int) {
|
||||||
return file_command_proto_rawDescGZIP(), []int{2}
|
return file_app_stats_command_command_proto_rawDescGZIP(), []int{2}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GetStatsResponse) GetStat() *Stat {
|
func (x *GetStatsResponse) GetStat() *Stat {
|
||||||
@@ -181,7 +181,7 @@ type QueryStatsRequest struct {
|
|||||||
|
|
||||||
func (x *QueryStatsRequest) Reset() {
|
func (x *QueryStatsRequest) Reset() {
|
||||||
*x = QueryStatsRequest{}
|
*x = QueryStatsRequest{}
|
||||||
mi := &file_command_proto_msgTypes[3]
|
mi := &file_app_stats_command_command_proto_msgTypes[3]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@@ -193,7 +193,7 @@ func (x *QueryStatsRequest) String() string {
|
|||||||
func (*QueryStatsRequest) ProtoMessage() {}
|
func (*QueryStatsRequest) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *QueryStatsRequest) ProtoReflect() protoreflect.Message {
|
func (x *QueryStatsRequest) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_command_proto_msgTypes[3]
|
mi := &file_app_stats_command_command_proto_msgTypes[3]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@@ -206,7 +206,7 @@ func (x *QueryStatsRequest) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use QueryStatsRequest.ProtoReflect.Descriptor instead.
|
// Deprecated: Use QueryStatsRequest.ProtoReflect.Descriptor instead.
|
||||||
func (*QueryStatsRequest) Descriptor() ([]byte, []int) {
|
func (*QueryStatsRequest) Descriptor() ([]byte, []int) {
|
||||||
return file_command_proto_rawDescGZIP(), []int{3}
|
return file_app_stats_command_command_proto_rawDescGZIP(), []int{3}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *QueryStatsRequest) GetPattern() string {
|
func (x *QueryStatsRequest) GetPattern() string {
|
||||||
@@ -232,7 +232,7 @@ type QueryStatsResponse struct {
|
|||||||
|
|
||||||
func (x *QueryStatsResponse) Reset() {
|
func (x *QueryStatsResponse) Reset() {
|
||||||
*x = QueryStatsResponse{}
|
*x = QueryStatsResponse{}
|
||||||
mi := &file_command_proto_msgTypes[4]
|
mi := &file_app_stats_command_command_proto_msgTypes[4]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@@ -244,7 +244,7 @@ func (x *QueryStatsResponse) String() string {
|
|||||||
func (*QueryStatsResponse) ProtoMessage() {}
|
func (*QueryStatsResponse) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *QueryStatsResponse) ProtoReflect() protoreflect.Message {
|
func (x *QueryStatsResponse) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_command_proto_msgTypes[4]
|
mi := &file_app_stats_command_command_proto_msgTypes[4]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@@ -257,7 +257,7 @@ func (x *QueryStatsResponse) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use QueryStatsResponse.ProtoReflect.Descriptor instead.
|
// Deprecated: Use QueryStatsResponse.ProtoReflect.Descriptor instead.
|
||||||
func (*QueryStatsResponse) Descriptor() ([]byte, []int) {
|
func (*QueryStatsResponse) Descriptor() ([]byte, []int) {
|
||||||
return file_command_proto_rawDescGZIP(), []int{4}
|
return file_app_stats_command_command_proto_rawDescGZIP(), []int{4}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *QueryStatsResponse) GetStat() []*Stat {
|
func (x *QueryStatsResponse) GetStat() []*Stat {
|
||||||
@@ -275,7 +275,7 @@ type SysStatsRequest struct {
|
|||||||
|
|
||||||
func (x *SysStatsRequest) Reset() {
|
func (x *SysStatsRequest) Reset() {
|
||||||
*x = SysStatsRequest{}
|
*x = SysStatsRequest{}
|
||||||
mi := &file_command_proto_msgTypes[5]
|
mi := &file_app_stats_command_command_proto_msgTypes[5]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@@ -287,7 +287,7 @@ func (x *SysStatsRequest) String() string {
|
|||||||
func (*SysStatsRequest) ProtoMessage() {}
|
func (*SysStatsRequest) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *SysStatsRequest) ProtoReflect() protoreflect.Message {
|
func (x *SysStatsRequest) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_command_proto_msgTypes[5]
|
mi := &file_app_stats_command_command_proto_msgTypes[5]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@@ -300,7 +300,7 @@ func (x *SysStatsRequest) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use SysStatsRequest.ProtoReflect.Descriptor instead.
|
// Deprecated: Use SysStatsRequest.ProtoReflect.Descriptor instead.
|
||||||
func (*SysStatsRequest) Descriptor() ([]byte, []int) {
|
func (*SysStatsRequest) Descriptor() ([]byte, []int) {
|
||||||
return file_command_proto_rawDescGZIP(), []int{5}
|
return file_app_stats_command_command_proto_rawDescGZIP(), []int{5}
|
||||||
}
|
}
|
||||||
|
|
||||||
type SysStatsResponse struct {
|
type SysStatsResponse struct {
|
||||||
@@ -321,7 +321,7 @@ type SysStatsResponse struct {
|
|||||||
|
|
||||||
func (x *SysStatsResponse) Reset() {
|
func (x *SysStatsResponse) Reset() {
|
||||||
*x = SysStatsResponse{}
|
*x = SysStatsResponse{}
|
||||||
mi := &file_command_proto_msgTypes[6]
|
mi := &file_app_stats_command_command_proto_msgTypes[6]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@@ -333,7 +333,7 @@ func (x *SysStatsResponse) String() string {
|
|||||||
func (*SysStatsResponse) ProtoMessage() {}
|
func (*SysStatsResponse) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *SysStatsResponse) ProtoReflect() protoreflect.Message {
|
func (x *SysStatsResponse) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_command_proto_msgTypes[6]
|
mi := &file_app_stats_command_command_proto_msgTypes[6]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@@ -346,7 +346,7 @@ func (x *SysStatsResponse) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use SysStatsResponse.ProtoReflect.Descriptor instead.
|
// Deprecated: Use SysStatsResponse.ProtoReflect.Descriptor instead.
|
||||||
func (*SysStatsResponse) Descriptor() ([]byte, []int) {
|
func (*SysStatsResponse) Descriptor() ([]byte, []int) {
|
||||||
return file_command_proto_rawDescGZIP(), []int{6}
|
return file_app_stats_command_command_proto_rawDescGZIP(), []int{6}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *SysStatsResponse) GetNumGoroutine() uint32 {
|
func (x *SysStatsResponse) GetNumGoroutine() uint32 {
|
||||||
@@ -429,7 +429,7 @@ type GetStatsOnlineIpListResponse struct {
|
|||||||
|
|
||||||
func (x *GetStatsOnlineIpListResponse) Reset() {
|
func (x *GetStatsOnlineIpListResponse) Reset() {
|
||||||
*x = GetStatsOnlineIpListResponse{}
|
*x = GetStatsOnlineIpListResponse{}
|
||||||
mi := &file_command_proto_msgTypes[7]
|
mi := &file_app_stats_command_command_proto_msgTypes[7]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@@ -441,7 +441,7 @@ func (x *GetStatsOnlineIpListResponse) String() string {
|
|||||||
func (*GetStatsOnlineIpListResponse) ProtoMessage() {}
|
func (*GetStatsOnlineIpListResponse) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *GetStatsOnlineIpListResponse) ProtoReflect() protoreflect.Message {
|
func (x *GetStatsOnlineIpListResponse) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_command_proto_msgTypes[7]
|
mi := &file_app_stats_command_command_proto_msgTypes[7]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@@ -454,7 +454,7 @@ func (x *GetStatsOnlineIpListResponse) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use GetStatsOnlineIpListResponse.ProtoReflect.Descriptor instead.
|
// Deprecated: Use GetStatsOnlineIpListResponse.ProtoReflect.Descriptor instead.
|
||||||
func (*GetStatsOnlineIpListResponse) Descriptor() ([]byte, []int) {
|
func (*GetStatsOnlineIpListResponse) Descriptor() ([]byte, []int) {
|
||||||
return file_command_proto_rawDescGZIP(), []int{7}
|
return file_app_stats_command_command_proto_rawDescGZIP(), []int{7}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GetStatsOnlineIpListResponse) GetName() string {
|
func (x *GetStatsOnlineIpListResponse) GetName() string {
|
||||||
@@ -479,7 +479,7 @@ type GetAllOnlineUsersRequest struct {
|
|||||||
|
|
||||||
func (x *GetAllOnlineUsersRequest) Reset() {
|
func (x *GetAllOnlineUsersRequest) Reset() {
|
||||||
*x = GetAllOnlineUsersRequest{}
|
*x = GetAllOnlineUsersRequest{}
|
||||||
mi := &file_command_proto_msgTypes[8]
|
mi := &file_app_stats_command_command_proto_msgTypes[8]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@@ -491,7 +491,7 @@ func (x *GetAllOnlineUsersRequest) String() string {
|
|||||||
func (*GetAllOnlineUsersRequest) ProtoMessage() {}
|
func (*GetAllOnlineUsersRequest) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *GetAllOnlineUsersRequest) ProtoReflect() protoreflect.Message {
|
func (x *GetAllOnlineUsersRequest) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_command_proto_msgTypes[8]
|
mi := &file_app_stats_command_command_proto_msgTypes[8]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@@ -504,7 +504,7 @@ func (x *GetAllOnlineUsersRequest) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use GetAllOnlineUsersRequest.ProtoReflect.Descriptor instead.
|
// Deprecated: Use GetAllOnlineUsersRequest.ProtoReflect.Descriptor instead.
|
||||||
func (*GetAllOnlineUsersRequest) Descriptor() ([]byte, []int) {
|
func (*GetAllOnlineUsersRequest) Descriptor() ([]byte, []int) {
|
||||||
return file_command_proto_rawDescGZIP(), []int{8}
|
return file_app_stats_command_command_proto_rawDescGZIP(), []int{8}
|
||||||
}
|
}
|
||||||
|
|
||||||
type GetAllOnlineUsersResponse struct {
|
type GetAllOnlineUsersResponse struct {
|
||||||
@@ -516,7 +516,7 @@ type GetAllOnlineUsersResponse struct {
|
|||||||
|
|
||||||
func (x *GetAllOnlineUsersResponse) Reset() {
|
func (x *GetAllOnlineUsersResponse) Reset() {
|
||||||
*x = GetAllOnlineUsersResponse{}
|
*x = GetAllOnlineUsersResponse{}
|
||||||
mi := &file_command_proto_msgTypes[9]
|
mi := &file_app_stats_command_command_proto_msgTypes[9]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@@ -528,7 +528,7 @@ func (x *GetAllOnlineUsersResponse) String() string {
|
|||||||
func (*GetAllOnlineUsersResponse) ProtoMessage() {}
|
func (*GetAllOnlineUsersResponse) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *GetAllOnlineUsersResponse) ProtoReflect() protoreflect.Message {
|
func (x *GetAllOnlineUsersResponse) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_command_proto_msgTypes[9]
|
mi := &file_app_stats_command_command_proto_msgTypes[9]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@@ -541,7 +541,7 @@ func (x *GetAllOnlineUsersResponse) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use GetAllOnlineUsersResponse.ProtoReflect.Descriptor instead.
|
// Deprecated: Use GetAllOnlineUsersResponse.ProtoReflect.Descriptor instead.
|
||||||
func (*GetAllOnlineUsersResponse) Descriptor() ([]byte, []int) {
|
func (*GetAllOnlineUsersResponse) Descriptor() ([]byte, []int) {
|
||||||
return file_command_proto_rawDescGZIP(), []int{9}
|
return file_app_stats_command_command_proto_rawDescGZIP(), []int{9}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GetAllOnlineUsersResponse) GetUsers() []string {
|
func (x *GetAllOnlineUsersResponse) GetUsers() []string {
|
||||||
@@ -559,7 +559,7 @@ type Config struct {
|
|||||||
|
|
||||||
func (x *Config) Reset() {
|
func (x *Config) Reset() {
|
||||||
*x = Config{}
|
*x = Config{}
|
||||||
mi := &file_command_proto_msgTypes[10]
|
mi := &file_app_stats_command_command_proto_msgTypes[10]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@@ -571,7 +571,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_command_proto_msgTypes[10]
|
mi := &file_app_stats_command_command_proto_msgTypes[10]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@@ -584,14 +584,14 @@ 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_command_proto_rawDescGZIP(), []int{10}
|
return file_app_stats_command_command_proto_rawDescGZIP(), []int{10}
|
||||||
}
|
}
|
||||||
|
|
||||||
var File_command_proto protoreflect.FileDescriptor
|
var File_app_stats_command_command_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
const file_command_proto_rawDesc = "" +
|
const file_app_stats_command_command_proto_rawDesc = "" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"\rcommand.proto\x12\x16xray.app.stats.command\";\n" +
|
"\x1fapp/stats/command/command.proto\x12\x16xray.app.stats.command\";\n" +
|
||||||
"\x0fGetStatsRequest\x12\x12\n" +
|
"\x0fGetStatsRequest\x12\x12\n" +
|
||||||
"\x04name\x18\x01 \x01(\tR\x04name\x12\x14\n" +
|
"\x04name\x18\x01 \x01(\tR\x04name\x12\x14\n" +
|
||||||
"\x05reset\x18\x02 \x01(\bR\x05reset\"0\n" +
|
"\x05reset\x18\x02 \x01(\bR\x05reset\"0\n" +
|
||||||
@@ -641,19 +641,19 @@ const file_command_proto_rawDesc = "" +
|
|||||||
"\x1acom.xray.app.stats.commandP\x01Z+github.com/xtls/xray-core/app/stats/command\xaa\x02\x16Xray.App.Stats.Commandb\x06proto3"
|
"\x1acom.xray.app.stats.commandP\x01Z+github.com/xtls/xray-core/app/stats/command\xaa\x02\x16Xray.App.Stats.Commandb\x06proto3"
|
||||||
|
|
||||||
var (
|
var (
|
||||||
file_command_proto_rawDescOnce sync.Once
|
file_app_stats_command_command_proto_rawDescOnce sync.Once
|
||||||
file_command_proto_rawDescData []byte
|
file_app_stats_command_command_proto_rawDescData []byte
|
||||||
)
|
)
|
||||||
|
|
||||||
func file_command_proto_rawDescGZIP() []byte {
|
func file_app_stats_command_command_proto_rawDescGZIP() []byte {
|
||||||
file_command_proto_rawDescOnce.Do(func() {
|
file_app_stats_command_command_proto_rawDescOnce.Do(func() {
|
||||||
file_command_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_command_proto_rawDesc), len(file_command_proto_rawDesc)))
|
file_app_stats_command_command_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_app_stats_command_command_proto_rawDesc), len(file_app_stats_command_command_proto_rawDesc)))
|
||||||
})
|
})
|
||||||
return file_command_proto_rawDescData
|
return file_app_stats_command_command_proto_rawDescData
|
||||||
}
|
}
|
||||||
|
|
||||||
var file_command_proto_msgTypes = make([]protoimpl.MessageInfo, 12)
|
var file_app_stats_command_command_proto_msgTypes = make([]protoimpl.MessageInfo, 12)
|
||||||
var file_command_proto_goTypes = []any{
|
var file_app_stats_command_command_proto_goTypes = []any{
|
||||||
(*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
|
||||||
@@ -667,7 +667,7 @@ var file_command_proto_goTypes = []any{
|
|||||||
(*Config)(nil), // 10: xray.app.stats.command.Config
|
(*Config)(nil), // 10: xray.app.stats.command.Config
|
||||||
nil, // 11: xray.app.stats.command.GetStatsOnlineIpListResponse.IpsEntry
|
nil, // 11: xray.app.stats.command.GetStatsOnlineIpListResponse.IpsEntry
|
||||||
}
|
}
|
||||||
var file_command_proto_depIdxs = []int32{
|
var file_app_stats_command_command_proto_depIdxs = []int32{
|
||||||
1, // 0: xray.app.stats.command.GetStatsResponse.stat:type_name -> xray.app.stats.command.Stat
|
1, // 0: xray.app.stats.command.GetStatsResponse.stat:type_name -> xray.app.stats.command.Stat
|
||||||
1, // 1: xray.app.stats.command.QueryStatsResponse.stat:type_name -> xray.app.stats.command.Stat
|
1, // 1: xray.app.stats.command.QueryStatsResponse.stat:type_name -> xray.app.stats.command.Stat
|
||||||
11, // 2: xray.app.stats.command.GetStatsOnlineIpListResponse.ips:type_name -> xray.app.stats.command.GetStatsOnlineIpListResponse.IpsEntry
|
11, // 2: xray.app.stats.command.GetStatsOnlineIpListResponse.ips:type_name -> xray.app.stats.command.GetStatsOnlineIpListResponse.IpsEntry
|
||||||
@@ -690,26 +690,26 @@ var file_command_proto_depIdxs = []int32{
|
|||||||
0, // [0:3] is the sub-list for field type_name
|
0, // [0:3] is the sub-list for field type_name
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { file_command_proto_init() }
|
func init() { file_app_stats_command_command_proto_init() }
|
||||||
func file_command_proto_init() {
|
func file_app_stats_command_command_proto_init() {
|
||||||
if File_command_proto != nil {
|
if File_app_stats_command_command_proto != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
type x struct{}
|
type x struct{}
|
||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_command_proto_rawDesc), len(file_command_proto_rawDesc)),
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_app_stats_command_command_proto_rawDesc), len(file_app_stats_command_command_proto_rawDesc)),
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 12,
|
NumMessages: 12,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 1,
|
NumServices: 1,
|
||||||
},
|
},
|
||||||
GoTypes: file_command_proto_goTypes,
|
GoTypes: file_app_stats_command_command_proto_goTypes,
|
||||||
DependencyIndexes: file_command_proto_depIdxs,
|
DependencyIndexes: file_app_stats_command_command_proto_depIdxs,
|
||||||
MessageInfos: file_command_proto_msgTypes,
|
MessageInfos: file_app_stats_command_command_proto_msgTypes,
|
||||||
}.Build()
|
}.Build()
|
||||||
File_command_proto = out.File
|
File_app_stats_command_command_proto = out.File
|
||||||
file_command_proto_goTypes = nil
|
file_app_stats_command_command_proto_goTypes = nil
|
||||||
file_command_proto_depIdxs = nil
|
file_app_stats_command_command_proto_depIdxs = nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
// 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.6.0
|
||||||
// - protoc v6.32.0
|
// - protoc v6.33.5
|
||||||
// source: command.proto
|
// source: app/stats/command/command.proto
|
||||||
|
|
||||||
package command
|
package command
|
||||||
|
|
||||||
@@ -128,22 +128,22 @@ type StatsServiceServer interface {
|
|||||||
type UnimplementedStatsServiceServer struct{}
|
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.Error(codes.Unimplemented, "method GetStats not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedStatsServiceServer) GetStatsOnline(context.Context, *GetStatsRequest) (*GetStatsResponse, error) {
|
func (UnimplementedStatsServiceServer) GetStatsOnline(context.Context, *GetStatsRequest) (*GetStatsResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method GetStatsOnline not implemented")
|
return nil, status.Error(codes.Unimplemented, "method GetStatsOnline not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedStatsServiceServer) QueryStats(context.Context, *QueryStatsRequest) (*QueryStatsResponse, error) {
|
func (UnimplementedStatsServiceServer) QueryStats(context.Context, *QueryStatsRequest) (*QueryStatsResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method QueryStats not implemented")
|
return nil, status.Error(codes.Unimplemented, "method QueryStats not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedStatsServiceServer) GetSysStats(context.Context, *SysStatsRequest) (*SysStatsResponse, error) {
|
func (UnimplementedStatsServiceServer) GetSysStats(context.Context, *SysStatsRequest) (*SysStatsResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method GetSysStats not implemented")
|
return nil, status.Error(codes.Unimplemented, "method GetSysStats not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedStatsServiceServer) GetStatsOnlineIpList(context.Context, *GetStatsRequest) (*GetStatsOnlineIpListResponse, error) {
|
func (UnimplementedStatsServiceServer) GetStatsOnlineIpList(context.Context, *GetStatsRequest) (*GetStatsOnlineIpListResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method GetStatsOnlineIpList not implemented")
|
return nil, status.Error(codes.Unimplemented, "method GetStatsOnlineIpList not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedStatsServiceServer) GetAllOnlineUsers(context.Context, *GetAllOnlineUsersRequest) (*GetAllOnlineUsersResponse, error) {
|
func (UnimplementedStatsServiceServer) GetAllOnlineUsers(context.Context, *GetAllOnlineUsersRequest) (*GetAllOnlineUsersResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method GetAllOnlineUsers not implemented")
|
return nil, status.Error(codes.Unimplemented, "method GetAllOnlineUsers not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedStatsServiceServer) mustEmbedUnimplementedStatsServiceServer() {}
|
func (UnimplementedStatsServiceServer) mustEmbedUnimplementedStatsServiceServer() {}
|
||||||
func (UnimplementedStatsServiceServer) testEmbeddedByValue() {}
|
func (UnimplementedStatsServiceServer) testEmbeddedByValue() {}
|
||||||
@@ -156,7 +156,7 @@ 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
|
// If the following call panics, it indicates UnimplementedStatsServiceServer was
|
||||||
// embedded by pointer and is nil. This will cause panics if an
|
// embedded by pointer and is nil. This will cause panics if an
|
||||||
// unimplemented method is ever invoked, so we test this at initialization
|
// unimplemented method is ever invoked, so we test this at initialization
|
||||||
// time to prevent it from happening at runtime later due to I/O.
|
// time to prevent it from happening at runtime later due to I/O.
|
||||||
@@ -307,5 +307,5 @@ var StatsService_ServiceDesc = grpc.ServiceDesc{
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
Streams: []grpc.StreamDesc{},
|
Streams: []grpc.StreamDesc{},
|
||||||
Metadata: "command.proto",
|
Metadata: "app/stats/command/command.proto",
|
||||||
}
|
}
|
||||||
|
|||||||
+25
-33
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.35.1
|
// protoc-gen-go v1.36.11
|
||||||
// protoc v5.28.2
|
// protoc v6.33.5
|
||||||
// source: app/stats/config.proto
|
// source: app/stats/config.proto
|
||||||
|
|
||||||
package stats
|
package stats
|
||||||
@@ -11,6 +11,7 @@ import (
|
|||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
sync "sync"
|
sync "sync"
|
||||||
|
unsafe "unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -21,9 +22,9 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Config) Reset() {
|
func (x *Config) Reset() {
|
||||||
@@ -57,13 +58,12 @@ func (*Config) Descriptor() ([]byte, []int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ChannelConfig struct {
|
type ChannelConfig struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Blocking bool `protobuf:"varint,1,opt,name=Blocking,proto3" json:"Blocking,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
SubscriberLimit int32 `protobuf:"varint,2,opt,name=SubscriberLimit,proto3" json:"SubscriberLimit,omitempty"`
|
||||||
|
BufferSize int32 `protobuf:"varint,3,opt,name=BufferSize,proto3" json:"BufferSize,omitempty"`
|
||||||
Blocking bool `protobuf:"varint,1,opt,name=Blocking,proto3" json:"Blocking,omitempty"`
|
unknownFields protoimpl.UnknownFields
|
||||||
SubscriberLimit int32 `protobuf:"varint,2,opt,name=SubscriberLimit,proto3" json:"SubscriberLimit,omitempty"`
|
sizeCache protoimpl.SizeCache
|
||||||
BufferSize int32 `protobuf:"varint,3,opt,name=BufferSize,proto3" json:"BufferSize,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ChannelConfig) Reset() {
|
func (x *ChannelConfig) Reset() {
|
||||||
@@ -119,33 +119,26 @@ func (x *ChannelConfig) GetBufferSize() int32 {
|
|||||||
|
|
||||||
var File_app_stats_config_proto protoreflect.FileDescriptor
|
var File_app_stats_config_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_app_stats_config_proto_rawDesc = []byte{
|
const file_app_stats_config_proto_rawDesc = "" +
|
||||||
0x0a, 0x16, 0x61, 0x70, 0x70, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x73, 0x2f, 0x63, 0x6f, 0x6e, 0x66,
|
"\n" +
|
||||||
0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61,
|
"\x16app/stats/config.proto\x12\x0exray.app.stats\"\b\n" +
|
||||||
0x70, 0x70, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x73, 0x22, 0x08, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66,
|
"\x06Config\"u\n" +
|
||||||
0x69, 0x67, 0x22, 0x75, 0x0a, 0x0d, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x43, 0x6f, 0x6e,
|
"\rChannelConfig\x12\x1a\n" +
|
||||||
0x66, 0x69, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x69, 0x6e, 0x67, 0x18,
|
"\bBlocking\x18\x01 \x01(\bR\bBlocking\x12(\n" +
|
||||||
0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x69, 0x6e, 0x67, 0x12,
|
"\x0fSubscriberLimit\x18\x02 \x01(\x05R\x0fSubscriberLimit\x12\x1e\n" +
|
||||||
0x28, 0x0a, 0x0f, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x72, 0x4c, 0x69, 0x6d,
|
"\n" +
|
||||||
0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0f, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72,
|
"BufferSize\x18\x03 \x01(\x05R\n" +
|
||||||
0x69, 0x62, 0x65, 0x72, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x42, 0x75, 0x66,
|
"BufferSizeBL\n" +
|
||||||
0x66, 0x65, 0x72, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x42,
|
"\x12com.xray.app.statsP\x01Z#github.com/xtls/xray-core/app/stats\xaa\x02\x0eXray.App.Statsb\x06proto3"
|
||||||
0x75, 0x66, 0x66, 0x65, 0x72, 0x53, 0x69, 0x7a, 0x65, 0x42, 0x4c, 0x0a, 0x12, 0x63, 0x6f, 0x6d,
|
|
||||||
0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x73, 0x50,
|
|
||||||
0x01, 0x5a, 0x23, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x74,
|
|
||||||
0x6c, 0x73, 0x2f, 0x78, 0x72, 0x61, 0x79, 0x2d, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x61, 0x70, 0x70,
|
|
||||||
0x2f, 0x73, 0x74, 0x61, 0x74, 0x73, 0xaa, 0x02, 0x0e, 0x58, 0x72, 0x61, 0x79, 0x2e, 0x41, 0x70,
|
|
||||||
0x70, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
file_app_stats_config_proto_rawDescOnce sync.Once
|
file_app_stats_config_proto_rawDescOnce sync.Once
|
||||||
file_app_stats_config_proto_rawDescData = file_app_stats_config_proto_rawDesc
|
file_app_stats_config_proto_rawDescData []byte
|
||||||
)
|
)
|
||||||
|
|
||||||
func file_app_stats_config_proto_rawDescGZIP() []byte {
|
func file_app_stats_config_proto_rawDescGZIP() []byte {
|
||||||
file_app_stats_config_proto_rawDescOnce.Do(func() {
|
file_app_stats_config_proto_rawDescOnce.Do(func() {
|
||||||
file_app_stats_config_proto_rawDescData = protoimpl.X.CompressGZIP(file_app_stats_config_proto_rawDescData)
|
file_app_stats_config_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_app_stats_config_proto_rawDesc), len(file_app_stats_config_proto_rawDesc)))
|
||||||
})
|
})
|
||||||
return file_app_stats_config_proto_rawDescData
|
return file_app_stats_config_proto_rawDescData
|
||||||
}
|
}
|
||||||
@@ -172,7 +165,7 @@ func file_app_stats_config_proto_init() {
|
|||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_app_stats_config_proto_rawDesc,
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_app_stats_config_proto_rawDesc), len(file_app_stats_config_proto_rawDesc)),
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 2,
|
NumMessages: 2,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
@@ -183,7 +176,6 @@ func file_app_stats_config_proto_init() {
|
|||||||
MessageInfos: file_app_stats_config_proto_msgTypes,
|
MessageInfos: file_app_stats_config_proto_msgTypes,
|
||||||
}.Build()
|
}.Build()
|
||||||
File_app_stats_config_proto = out.File
|
File_app_stats_config_proto = out.File
|
||||||
file_app_stats_config_proto_rawDesc = nil
|
|
||||||
file_app_stats_config_proto_goTypes = nil
|
file_app_stats_config_proto_goTypes = nil
|
||||||
file_app_stats_config_proto_depIdxs = nil
|
file_app_stats_config_proto_depIdxs = nil
|
||||||
}
|
}
|
||||||
|
|||||||
+73
-59
@@ -2,84 +2,98 @@ package stats
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"sync"
|
"sync"
|
||||||
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
// OnlineMap is an implementation of stats.OnlineMap.
|
const (
|
||||||
type OnlineMap struct {
|
localhostIPv4 = "127.0.0.1"
|
||||||
ipList map[string]time.Time
|
localhostIPv6 = "[::1]"
|
||||||
access sync.RWMutex
|
)
|
||||||
lastCleanup time.Time
|
|
||||||
cleanupPeriod time.Duration
|
type ipEntry struct {
|
||||||
|
refCount int
|
||||||
|
lastSeen time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewOnlineMap creates a new instance of OnlineMap.
|
// OnlineMap is a refcount-based implementation of stats.OnlineMap.
|
||||||
|
// IPs are tracked by reference counting: AddIP increments, RemoveIP decrements.
|
||||||
|
// An IP is removed from the map when its reference count reaches zero.
|
||||||
|
type OnlineMap struct {
|
||||||
|
entries map[string]*ipEntry
|
||||||
|
access sync.Mutex
|
||||||
|
count atomic.Int64
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewOnlineMap creates a new OnlineMap instance.
|
||||||
func NewOnlineMap() *OnlineMap {
|
func NewOnlineMap() *OnlineMap {
|
||||||
return &OnlineMap{
|
return &OnlineMap{
|
||||||
ipList: make(map[string]time.Time),
|
entries: make(map[string]*ipEntry),
|
||||||
lastCleanup: time.Now(),
|
}
|
||||||
cleanupPeriod: 10 * time.Second,
|
}
|
||||||
|
|
||||||
|
// AddIP implements stats.OnlineMap.
|
||||||
|
func (om *OnlineMap) AddIP(ip string) {
|
||||||
|
if ip == localhostIPv4 || ip == localhostIPv6 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
om.access.Lock()
|
||||||
|
defer om.access.Unlock()
|
||||||
|
|
||||||
|
if e, ok := om.entries[ip]; ok {
|
||||||
|
e.refCount++
|
||||||
|
e.lastSeen = time.Now()
|
||||||
|
} else {
|
||||||
|
om.entries[ip] = &ipEntry{
|
||||||
|
refCount: 1,
|
||||||
|
lastSeen: time.Now(),
|
||||||
|
}
|
||||||
|
om.count.Add(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// RemoveIP implements stats.OnlineMap.
|
||||||
|
func (om *OnlineMap) RemoveIP(ip string) {
|
||||||
|
om.access.Lock()
|
||||||
|
defer om.access.Unlock()
|
||||||
|
|
||||||
|
e, ok := om.entries[ip]
|
||||||
|
if !ok {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
e.refCount--
|
||||||
|
if e.refCount <= 0 {
|
||||||
|
delete(om.entries, ip)
|
||||||
|
om.count.Add(-1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Count implements stats.OnlineMap.
|
// Count implements stats.OnlineMap.
|
||||||
func (c *OnlineMap) Count() int {
|
func (om *OnlineMap) Count() int {
|
||||||
c.access.RLock()
|
return int(om.count.Load())
|
||||||
defer c.access.RUnlock()
|
|
||||||
|
|
||||||
return len(c.ipList)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// List implements stats.OnlineMap.
|
// List implements stats.OnlineMap.
|
||||||
func (c *OnlineMap) List() []string {
|
func (om *OnlineMap) List() []string {
|
||||||
return c.GetKeys()
|
om.access.Lock()
|
||||||
}
|
defer om.access.Unlock()
|
||||||
|
|
||||||
// AddIP implements stats.OnlineMap.
|
keys := make([]string, 0, len(om.entries))
|
||||||
func (c *OnlineMap) AddIP(ip string) {
|
for ip := range om.entries {
|
||||||
if ip == "127.0.0.1" {
|
keys = append(keys, ip)
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
c.access.Lock()
|
|
||||||
c.ipList[ip] = time.Now()
|
|
||||||
c.access.Unlock()
|
|
||||||
|
|
||||||
if time.Since(c.lastCleanup) > c.cleanupPeriod {
|
|
||||||
c.RemoveExpiredIPs()
|
|
||||||
c.lastCleanup = time.Now()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *OnlineMap) GetKeys() []string {
|
|
||||||
c.access.RLock()
|
|
||||||
defer c.access.RUnlock()
|
|
||||||
|
|
||||||
keys := []string{}
|
|
||||||
for k := range c.ipList {
|
|
||||||
keys = append(keys, k)
|
|
||||||
}
|
}
|
||||||
return keys
|
return keys
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *OnlineMap) RemoveExpiredIPs() {
|
// IPTimeMap implements stats.OnlineMap.
|
||||||
c.access.Lock()
|
func (om *OnlineMap) IPTimeMap() map[string]time.Time {
|
||||||
defer c.access.Unlock()
|
om.access.Lock()
|
||||||
|
defer om.access.Unlock()
|
||||||
|
|
||||||
now := time.Now()
|
result := make(map[string]time.Time, len(om.entries))
|
||||||
for k, t := range c.ipList {
|
for ip, e := range om.entries {
|
||||||
diff := now.Sub(t)
|
result[ip] = e.lastSeen
|
||||||
if diff.Seconds() > 20 {
|
|
||||||
delete(c.ipList, k)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
return result
|
||||||
|
|
||||||
func (c *OnlineMap) IpTimeMap() map[string]time.Time {
|
|
||||||
if time.Since(c.lastCleanup) > c.cleanupPeriod {
|
|
||||||
c.RemoveExpiredIPs()
|
|
||||||
c.lastCleanup = time.Now()
|
|
||||||
}
|
|
||||||
|
|
||||||
return c.ipList
|
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -163,12 +163,12 @@ func (m *Manager) GetChannel(name string) stats.Channel {
|
|||||||
|
|
||||||
// GetAllOnlineUsers implements stats.Manager.
|
// GetAllOnlineUsers implements stats.Manager.
|
||||||
func (m *Manager) GetAllOnlineUsers() []string {
|
func (m *Manager) GetAllOnlineUsers() []string {
|
||||||
m.access.Lock()
|
m.access.RLock()
|
||||||
defer m.access.Unlock()
|
defer m.access.RUnlock()
|
||||||
|
|
||||||
usersOnline := make([]string, 0, len(m.onlineMap))
|
usersOnline := make([]string, 0, len(m.onlineMap))
|
||||||
for user, onlineMap := range m.onlineMap {
|
for user, onlineMap := range m.onlineMap {
|
||||||
if len(onlineMap.IpTimeMap()) > 0 {
|
if onlineMap.Count() > 0 {
|
||||||
usersOnline = append(usersOnline, user)
|
usersOnline = append(usersOnline, user)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+21
-30
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.35.1
|
// protoc-gen-go v1.36.11
|
||||||
// protoc v5.28.2
|
// protoc v6.33.5
|
||||||
// source: app/version/config.proto
|
// source: app/version/config.proto
|
||||||
|
|
||||||
package version
|
package version
|
||||||
@@ -11,6 +11,7 @@ import (
|
|||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
sync "sync"
|
sync "sync"
|
||||||
|
unsafe "unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -21,13 +22,12 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
CoreVersion string `protobuf:"bytes,1,opt,name=core_version,json=coreVersion,proto3" json:"core_version,omitempty"`
|
||||||
|
MinVersion string `protobuf:"bytes,2,opt,name=min_version,json=minVersion,proto3" json:"min_version,omitempty"`
|
||||||
|
MaxVersion string `protobuf:"bytes,3,opt,name=max_version,json=maxVersion,proto3" json:"max_version,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
CoreVersion string `protobuf:"bytes,1,opt,name=core_version,json=coreVersion,proto3" json:"core_version,omitempty"`
|
|
||||||
MinVersion string `protobuf:"bytes,2,opt,name=min_version,json=minVersion,proto3" json:"min_version,omitempty"`
|
|
||||||
MaxVersion string `protobuf:"bytes,3,opt,name=max_version,json=maxVersion,proto3" json:"max_version,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Config) Reset() {
|
func (x *Config) Reset() {
|
||||||
@@ -83,33 +83,25 @@ func (x *Config) GetMaxVersion() string {
|
|||||||
|
|
||||||
var File_app_version_config_proto protoreflect.FileDescriptor
|
var File_app_version_config_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_app_version_config_proto_rawDesc = []byte{
|
const file_app_version_config_proto_rawDesc = "" +
|
||||||
0x0a, 0x18, 0x61, 0x70, 0x70, 0x2f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x2f, 0x63, 0x6f,
|
"\n" +
|
||||||
0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x78, 0x72, 0x61, 0x79,
|
"\x18app/version/config.proto\x12\x10xray.app.version\"m\n" +
|
||||||
0x2e, 0x61, 0x70, 0x70, 0x2e, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x6d, 0x0a, 0x06,
|
"\x06Config\x12!\n" +
|
||||||
0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x72, 0x65, 0x5f, 0x76,
|
"\fcore_version\x18\x01 \x01(\tR\vcoreVersion\x12\x1f\n" +
|
||||||
0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f,
|
"\vmin_version\x18\x02 \x01(\tR\n" +
|
||||||
0x72, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x69, 0x6e,
|
"minVersion\x12\x1f\n" +
|
||||||
0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a,
|
"\vmax_version\x18\x03 \x01(\tR\n" +
|
||||||
0x6d, 0x69, 0x6e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x61,
|
"maxVersionBR\n" +
|
||||||
0x78, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
|
"\x14com.xray.app.versionP\x01Z%github.com/xtls/xray-core/app/version\xaa\x02\x10Xray.App.Versionb\x06proto3"
|
||||||
0x0a, 0x6d, 0x61, 0x78, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x52, 0x0a, 0x14, 0x63,
|
|
||||||
0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x76, 0x65, 0x72, 0x73,
|
|
||||||
0x69, 0x6f, 0x6e, 0x50, 0x01, 0x5a, 0x25, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f,
|
|
||||||
0x6d, 0x2f, 0x78, 0x74, 0x6c, 0x73, 0x2f, 0x78, 0x72, 0x61, 0x79, 0x2d, 0x63, 0x6f, 0x72, 0x65,
|
|
||||||
0x2f, 0x61, 0x70, 0x70, 0x2f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0xaa, 0x02, 0x10, 0x58,
|
|
||||||
0x72, 0x61, 0x79, 0x2e, 0x41, 0x70, 0x70, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x62,
|
|
||||||
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
file_app_version_config_proto_rawDescOnce sync.Once
|
file_app_version_config_proto_rawDescOnce sync.Once
|
||||||
file_app_version_config_proto_rawDescData = file_app_version_config_proto_rawDesc
|
file_app_version_config_proto_rawDescData []byte
|
||||||
)
|
)
|
||||||
|
|
||||||
func file_app_version_config_proto_rawDescGZIP() []byte {
|
func file_app_version_config_proto_rawDescGZIP() []byte {
|
||||||
file_app_version_config_proto_rawDescOnce.Do(func() {
|
file_app_version_config_proto_rawDescOnce.Do(func() {
|
||||||
file_app_version_config_proto_rawDescData = protoimpl.X.CompressGZIP(file_app_version_config_proto_rawDescData)
|
file_app_version_config_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_app_version_config_proto_rawDesc), len(file_app_version_config_proto_rawDesc)))
|
||||||
})
|
})
|
||||||
return file_app_version_config_proto_rawDescData
|
return file_app_version_config_proto_rawDescData
|
||||||
}
|
}
|
||||||
@@ -135,7 +127,7 @@ func file_app_version_config_proto_init() {
|
|||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_app_version_config_proto_rawDesc,
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_app_version_config_proto_rawDesc), len(file_app_version_config_proto_rawDesc)),
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 1,
|
NumMessages: 1,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
@@ -146,7 +138,6 @@ func file_app_version_config_proto_init() {
|
|||||||
MessageInfos: file_app_version_config_proto_msgTypes,
|
MessageInfos: file_app_version_config_proto_msgTypes,
|
||||||
}.Build()
|
}.Build()
|
||||||
File_app_version_config_proto = out.File
|
File_app_version_config_proto = out.File
|
||||||
file_app_version_config_proto_rawDesc = nil
|
|
||||||
file_app_version_config_proto_goTypes = nil
|
file_app_version_config_proto_goTypes = nil
|
||||||
file_app_version_config_proto_depIdxs = nil
|
file_app_version_config_proto_depIdxs = nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
package antireplay
|
|
||||||
|
|
||||||
type GeneralizedReplayFilter interface {
|
|
||||||
Interval() int64
|
|
||||||
Check(sum []byte) bool
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package antireplay
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bufio"
|
||||||
|
"crypto/rand"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func BenchmarkMapFilter(b *testing.B) {
|
||||||
|
filter := NewMapFilter[[16]byte](120)
|
||||||
|
var sample [16]byte
|
||||||
|
reader := bufio.NewReader(rand.Reader)
|
||||||
|
reader.Read(sample[:])
|
||||||
|
b.ResetTimer()
|
||||||
|
for range b.N {
|
||||||
|
reader.Read(sample[:])
|
||||||
|
filter.Check(sample)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestMapFilter(t *testing.T) {
|
||||||
|
filter := NewMapFilter[[16]byte](120)
|
||||||
|
var sample [16]byte
|
||||||
|
rand.Read(sample[:])
|
||||||
|
filter.Check(sample)
|
||||||
|
if filter.Check(sample) {
|
||||||
|
t.Error("Unexpected true negative")
|
||||||
|
}
|
||||||
|
sample[0]++
|
||||||
|
if !filter.Check(sample) {
|
||||||
|
t.Error("Unexpected false positive")
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
package antireplay
|
|
||||||
|
|
||||||
import (
|
|
||||||
"sync"
|
|
||||||
|
|
||||||
ss_bloomring "github.com/v2fly/ss-bloomring"
|
|
||||||
)
|
|
||||||
|
|
||||||
type BloomRing struct {
|
|
||||||
*ss_bloomring.BloomRing
|
|
||||||
lock *sync.Mutex
|
|
||||||
}
|
|
||||||
|
|
||||||
func (b BloomRing) Interval() int64 {
|
|
||||||
return 9999999
|
|
||||||
}
|
|
||||||
|
|
||||||
func (b BloomRing) Check(sum []byte) bool {
|
|
||||||
b.lock.Lock()
|
|
||||||
defer b.lock.Unlock()
|
|
||||||
if b.Test(sum) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
b.Add(sum)
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewBloomRing() BloomRing {
|
|
||||||
const (
|
|
||||||
DefaultSFCapacity = 1e6
|
|
||||||
// FalsePositiveRate
|
|
||||||
DefaultSFFPR = 1e-6
|
|
||||||
DefaultSFSlot = 10
|
|
||||||
)
|
|
||||||
return BloomRing{ss_bloomring.NewBloomRing(DefaultSFSlot, DefaultSFCapacity, DefaultSFFPR), &sync.Mutex{}}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package antireplay
|
||||||
|
|
||||||
|
import (
|
||||||
|
"sync"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ReplayFilter checks for replay attacks.
|
||||||
|
type ReplayFilter[T comparable] struct {
|
||||||
|
lock sync.Mutex
|
||||||
|
poolA map[T]struct{}
|
||||||
|
poolB map[T]struct{}
|
||||||
|
interval time.Duration
|
||||||
|
lastClean time.Time
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewMapFilter create a new filter with specifying the expiration time interval in seconds.
|
||||||
|
func NewMapFilter[T comparable](interval int64) *ReplayFilter[T] {
|
||||||
|
filter := &ReplayFilter[T]{
|
||||||
|
poolA: make(map[T]struct{}),
|
||||||
|
poolB: make(map[T]struct{}),
|
||||||
|
interval: time.Duration(interval) * time.Second,
|
||||||
|
lastClean: time.Now(),
|
||||||
|
}
|
||||||
|
return filter
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check determines if there are duplicate records.
|
||||||
|
func (filter *ReplayFilter[T]) Check(sum T) bool {
|
||||||
|
filter.lock.Lock()
|
||||||
|
defer filter.lock.Unlock()
|
||||||
|
|
||||||
|
now := time.Now()
|
||||||
|
if now.Sub(filter.lastClean) >= filter.interval {
|
||||||
|
filter.poolB = filter.poolA
|
||||||
|
filter.poolA = make(map[T]struct{})
|
||||||
|
filter.lastClean = now
|
||||||
|
}
|
||||||
|
|
||||||
|
_, existsA := filter.poolA[sum]
|
||||||
|
_, existsB := filter.poolB[sum]
|
||||||
|
if !existsA && !existsB {
|
||||||
|
filter.poolA[sum] = struct{}{}
|
||||||
|
}
|
||||||
|
return !(existsA || existsB)
|
||||||
|
}
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
package antireplay
|
|
||||||
|
|
||||||
import (
|
|
||||||
"sync"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
cuckoo "github.com/seiflotfy/cuckoofilter"
|
|
||||||
)
|
|
||||||
|
|
||||||
const replayFilterCapacity = 100000
|
|
||||||
|
|
||||||
// ReplayFilter checks for replay attacks.
|
|
||||||
type ReplayFilter struct {
|
|
||||||
lock sync.Mutex
|
|
||||||
poolA *cuckoo.Filter
|
|
||||||
poolB *cuckoo.Filter
|
|
||||||
poolSwap bool
|
|
||||||
lastSwap int64
|
|
||||||
interval int64
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewReplayFilter create a new filter with specifying the expiration time interval in seconds.
|
|
||||||
func NewReplayFilter(interval int64) *ReplayFilter {
|
|
||||||
filter := &ReplayFilter{}
|
|
||||||
filter.interval = interval
|
|
||||||
return filter
|
|
||||||
}
|
|
||||||
|
|
||||||
// Interval in second for expiration time for duplicate records.
|
|
||||||
func (filter *ReplayFilter) Interval() int64 {
|
|
||||||
return filter.interval
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check determines if there are duplicate records.
|
|
||||||
func (filter *ReplayFilter) Check(sum []byte) bool {
|
|
||||||
filter.lock.Lock()
|
|
||||||
defer filter.lock.Unlock()
|
|
||||||
|
|
||||||
now := time.Now().Unix()
|
|
||||||
if filter.lastSwap == 0 {
|
|
||||||
filter.lastSwap = now
|
|
||||||
filter.poolA = cuckoo.NewFilter(replayFilterCapacity)
|
|
||||||
filter.poolB = cuckoo.NewFilter(replayFilterCapacity)
|
|
||||||
}
|
|
||||||
|
|
||||||
elapsed := now - filter.lastSwap
|
|
||||||
if elapsed >= filter.Interval() {
|
|
||||||
if filter.poolSwap {
|
|
||||||
filter.poolA.Reset()
|
|
||||||
} else {
|
|
||||||
filter.poolB.Reset()
|
|
||||||
}
|
|
||||||
filter.poolSwap = !filter.poolSwap
|
|
||||||
filter.lastSwap = now
|
|
||||||
}
|
|
||||||
|
|
||||||
return filter.poolA.InsertUnique(sum) && filter.poolB.InsertUnique(sum)
|
|
||||||
}
|
|
||||||
@@ -4,8 +4,11 @@ package crypto // import "github.com/xtls/xray-core/common/crypto"
|
|||||||
import (
|
import (
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
||||||
|
"github.com/xtls/xray-core/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// [,)
|
||||||
func RandBetween(from int64, to int64) int64 {
|
func RandBetween(from int64, to int64) int64 {
|
||||||
if from == to {
|
if from == to {
|
||||||
return from
|
return from
|
||||||
@@ -16,3 +19,20 @@ func RandBetween(from int64, to int64) int64 {
|
|||||||
bigInt, _ := rand.Int(rand.Reader, big.NewInt(to-from))
|
bigInt, _ := rand.Int(rand.Reader, big.NewInt(to-from))
|
||||||
return from + bigInt.Int64()
|
return from + bigInt.Int64()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// [,]
|
||||||
|
func RandBytesBetween(b []byte, from, to byte) {
|
||||||
|
common.Must2(rand.Read(b))
|
||||||
|
|
||||||
|
if from > to {
|
||||||
|
from, to = to, from
|
||||||
|
}
|
||||||
|
|
||||||
|
if to-from == 255 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := range b {
|
||||||
|
b[i] = from + b[i]%(to-from+1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,22 +4,19 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PrintMigrateFeatureInfo prints a notice of the upcoming feature migration.
|
// PrintNonRemovalDeprecatedFeatureWarning prints a warning of the deprecated feature that won't be removed in the near future.
|
||||||
// Place it after the source feature related config file pharser code.
|
|
||||||
// Important note: Only use this when the target migrating feature is under construction.
|
|
||||||
// Important note: Even when the target migrating feature has finished its construction, this notice can still be used yet before announcing deprecation of the old feature.
|
|
||||||
// Do not remove this function even there is no reference to it.
|
// Do not remove this function even there is no reference to it.
|
||||||
func PrintMigrateFeatureInfo(sourceFeature string, targetFeature string) {
|
func PrintNonRemovalDeprecatedFeatureWarning(sourceFeature string, targetFeature string) {
|
||||||
LogInfo(context.Background(), "The feature "+sourceFeature+" will be migrated to "+targetFeature+" in the future.")
|
LogWarning(context.Background(), "The feature "+sourceFeature+" is deprecated, not recommended for using and might be removed. Please migrate to "+targetFeature+" as soon as possible.")
|
||||||
}
|
}
|
||||||
|
|
||||||
// PrintDeprecatedFeatureWarning prints a warning for deprecated and going to be removed feature.
|
// PrintDeprecatedFeatureWarning prints a warning for deprecated and going to be removed feature.
|
||||||
// Do not remove this function even there is no reference to it.
|
// Do not remove this function even there is no reference to it.
|
||||||
func PrintDeprecatedFeatureWarning(feature string, migrateFeature string) {
|
func PrintDeprecatedFeatureWarning(feature string, migrateFeature string) {
|
||||||
if len(migrateFeature) > 0 {
|
if len(migrateFeature) > 0 {
|
||||||
LogWarning(context.Background(), "This feature "+feature+" is deprecated and being migrated to "+migrateFeature+". Please update your config(s) according to release note and documentation before removal.")
|
LogWarning(context.Background(), "This feature "+feature+" is deprecated, will be removed soon and being migrated to "+migrateFeature+". Please update your config(s) according to release note and documentation before removal.")
|
||||||
} else {
|
} else {
|
||||||
LogWarning(context.Background(), "This feature "+feature+" is deprecated. Please update your config(s) according to release note and documentation before removal.")
|
LogWarning(context.Background(), "This feature "+feature+" is deprecated and will be removed soon. Please update your config(s) according to release note and documentation before removal.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+16
-21
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.35.1
|
// protoc-gen-go v1.36.11
|
||||||
// protoc v5.28.2
|
// protoc v6.33.5
|
||||||
// source: common/log/log.proto
|
// source: common/log/log.proto
|
||||||
|
|
||||||
package log
|
package log
|
||||||
@@ -11,6 +11,7 @@ import (
|
|||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
sync "sync"
|
sync "sync"
|
||||||
|
unsafe "unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -77,30 +78,25 @@ func (Severity) EnumDescriptor() ([]byte, []int) {
|
|||||||
|
|
||||||
var File_common_log_log_proto protoreflect.FileDescriptor
|
var File_common_log_log_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_common_log_log_proto_rawDesc = []byte{
|
const file_common_log_log_proto_rawDesc = "" +
|
||||||
0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x6c, 0x6f, 0x67, 0x2f, 0x6c, 0x6f, 0x67,
|
"\n" +
|
||||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d,
|
"\x14common/log/log.proto\x12\x0fxray.common.log*D\n" +
|
||||||
0x6d, 0x6f, 0x6e, 0x2e, 0x6c, 0x6f, 0x67, 0x2a, 0x44, 0x0a, 0x08, 0x53, 0x65, 0x76, 0x65, 0x72,
|
"\bSeverity\x12\v\n" +
|
||||||
0x69, 0x74, 0x79, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00,
|
"\aUnknown\x10\x00\x12\t\n" +
|
||||||
0x12, 0x09, 0x0a, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x57,
|
"\x05Error\x10\x01\x12\v\n" +
|
||||||
0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x49, 0x6e, 0x66, 0x6f,
|
"\aWarning\x10\x02\x12\b\n" +
|
||||||
0x10, 0x03, 0x12, 0x09, 0x0a, 0x05, 0x44, 0x65, 0x62, 0x75, 0x67, 0x10, 0x04, 0x42, 0x4f, 0x0a,
|
"\x04Info\x10\x03\x12\t\n" +
|
||||||
0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
|
"\x05Debug\x10\x04BO\n" +
|
||||||
0x2e, 0x6c, 0x6f, 0x67, 0x50, 0x01, 0x5a, 0x24, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63,
|
"\x13com.xray.common.logP\x01Z$github.com/xtls/xray-core/common/log\xaa\x02\x0fXray.Common.Logb\x06proto3"
|
||||||
0x6f, 0x6d, 0x2f, 0x78, 0x74, 0x6c, 0x73, 0x2f, 0x78, 0x72, 0x61, 0x79, 0x2d, 0x63, 0x6f, 0x72,
|
|
||||||
0x65, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x6c, 0x6f, 0x67, 0xaa, 0x02, 0x0f, 0x58,
|
|
||||||
0x72, 0x61, 0x79, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4c, 0x6f, 0x67, 0x62, 0x06,
|
|
||||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
file_common_log_log_proto_rawDescOnce sync.Once
|
file_common_log_log_proto_rawDescOnce sync.Once
|
||||||
file_common_log_log_proto_rawDescData = file_common_log_log_proto_rawDesc
|
file_common_log_log_proto_rawDescData []byte
|
||||||
)
|
)
|
||||||
|
|
||||||
func file_common_log_log_proto_rawDescGZIP() []byte {
|
func file_common_log_log_proto_rawDescGZIP() []byte {
|
||||||
file_common_log_log_proto_rawDescOnce.Do(func() {
|
file_common_log_log_proto_rawDescOnce.Do(func() {
|
||||||
file_common_log_log_proto_rawDescData = protoimpl.X.CompressGZIP(file_common_log_log_proto_rawDescData)
|
file_common_log_log_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_common_log_log_proto_rawDesc), len(file_common_log_log_proto_rawDesc)))
|
||||||
})
|
})
|
||||||
return file_common_log_log_proto_rawDescData
|
return file_common_log_log_proto_rawDescData
|
||||||
}
|
}
|
||||||
@@ -126,7 +122,7 @@ func file_common_log_log_proto_init() {
|
|||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_common_log_log_proto_rawDesc,
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_common_log_log_proto_rawDesc), len(file_common_log_log_proto_rawDesc)),
|
||||||
NumEnums: 1,
|
NumEnums: 1,
|
||||||
NumMessages: 0,
|
NumMessages: 0,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
@@ -137,7 +133,6 @@ func file_common_log_log_proto_init() {
|
|||||||
EnumInfos: file_common_log_log_proto_enumTypes,
|
EnumInfos: file_common_log_log_proto_enumTypes,
|
||||||
}.Build()
|
}.Build()
|
||||||
File_common_log_log_proto = out.File
|
File_common_log_log_proto = out.File
|
||||||
file_common_log_log_proto_rawDesc = nil
|
|
||||||
file_common_log_log_proto_goTypes = nil
|
file_common_log_log_proto_goTypes = nil
|
||||||
file_common_log_log_proto_depIdxs = nil
|
file_common_log_log_proto_depIdxs = nil
|
||||||
}
|
}
|
||||||
|
|||||||
+31
-34
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.35.1
|
// protoc-gen-go v1.36.11
|
||||||
// protoc v5.28.2
|
// protoc v6.33.5
|
||||||
// source: common/net/address.proto
|
// source: common/net/address.proto
|
||||||
|
|
||||||
package net
|
package net
|
||||||
@@ -11,6 +11,7 @@ import (
|
|||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
sync "sync"
|
sync "sync"
|
||||||
|
unsafe "unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -23,15 +24,14 @@ const (
|
|||||||
// Address of a network host. It may be either an IP address or a domain
|
// Address of a network host. It may be either an IP address or a domain
|
||||||
// address.
|
// address.
|
||||||
type IPOrDomain struct {
|
type IPOrDomain struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
// Types that are valid to be assigned to Address:
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
// Types that are assignable to Address:
|
|
||||||
//
|
//
|
||||||
// *IPOrDomain_Ip
|
// *IPOrDomain_Ip
|
||||||
// *IPOrDomain_Domain
|
// *IPOrDomain_Domain
|
||||||
Address isIPOrDomain_Address `protobuf_oneof:"address"`
|
Address isIPOrDomain_Address `protobuf_oneof:"address"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *IPOrDomain) Reset() {
|
func (x *IPOrDomain) Reset() {
|
||||||
@@ -64,23 +64,27 @@ func (*IPOrDomain) Descriptor() ([]byte, []int) {
|
|||||||
return file_common_net_address_proto_rawDescGZIP(), []int{0}
|
return file_common_net_address_proto_rawDescGZIP(), []int{0}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *IPOrDomain) GetAddress() isIPOrDomain_Address {
|
func (x *IPOrDomain) GetAddress() isIPOrDomain_Address {
|
||||||
if m != nil {
|
if x != nil {
|
||||||
return m.Address
|
return x.Address
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *IPOrDomain) GetIp() []byte {
|
func (x *IPOrDomain) GetIp() []byte {
|
||||||
if x, ok := x.GetAddress().(*IPOrDomain_Ip); ok {
|
if x != nil {
|
||||||
return x.Ip
|
if x, ok := x.Address.(*IPOrDomain_Ip); ok {
|
||||||
|
return x.Ip
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *IPOrDomain) GetDomain() string {
|
func (x *IPOrDomain) GetDomain() string {
|
||||||
if x, ok := x.GetAddress().(*IPOrDomain_Domain); ok {
|
if x != nil {
|
||||||
return x.Domain
|
if x, ok := x.Address.(*IPOrDomain_Domain); ok {
|
||||||
|
return x.Domain
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
@@ -105,30 +109,24 @@ func (*IPOrDomain_Domain) isIPOrDomain_Address() {}
|
|||||||
|
|
||||||
var File_common_net_address_proto protoreflect.FileDescriptor
|
var File_common_net_address_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_common_net_address_proto_rawDesc = []byte{
|
const file_common_net_address_proto_rawDesc = "" +
|
||||||
0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x6e, 0x65, 0x74, 0x2f, 0x61, 0x64, 0x64,
|
"\n" +
|
||||||
0x72, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x78, 0x72, 0x61, 0x79,
|
"\x18common/net/address.proto\x12\x0fxray.common.net\"C\n" +
|
||||||
0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x22, 0x43, 0x0a, 0x0a, 0x49,
|
"\n" +
|
||||||
0x50, 0x4f, 0x72, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x12, 0x10, 0x0a, 0x02, 0x69, 0x70, 0x18,
|
"IPOrDomain\x12\x10\n" +
|
||||||
0x01, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x02, 0x69, 0x70, 0x12, 0x18, 0x0a, 0x06, 0x64,
|
"\x02ip\x18\x01 \x01(\fH\x00R\x02ip\x12\x18\n" +
|
||||||
0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x06, 0x64,
|
"\x06domain\x18\x02 \x01(\tH\x00R\x06domainB\t\n" +
|
||||||
0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x42, 0x09, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73,
|
"\aaddressBO\n" +
|
||||||
0x42, 0x4f, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d,
|
"\x13com.xray.common.netP\x01Z$github.com/xtls/xray-core/common/net\xaa\x02\x0fXray.Common.Netb\x06proto3"
|
||||||
0x6d, 0x6f, 0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x50, 0x01, 0x5a, 0x24, 0x67, 0x69, 0x74, 0x68, 0x75,
|
|
||||||
0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x74, 0x6c, 0x73, 0x2f, 0x78, 0x72, 0x61, 0x79, 0x2d,
|
|
||||||
0x63, 0x6f, 0x72, 0x65, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x6e, 0x65, 0x74, 0xaa,
|
|
||||||
0x02, 0x0f, 0x58, 0x72, 0x61, 0x79, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4e, 0x65,
|
|
||||||
0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
file_common_net_address_proto_rawDescOnce sync.Once
|
file_common_net_address_proto_rawDescOnce sync.Once
|
||||||
file_common_net_address_proto_rawDescData = file_common_net_address_proto_rawDesc
|
file_common_net_address_proto_rawDescData []byte
|
||||||
)
|
)
|
||||||
|
|
||||||
func file_common_net_address_proto_rawDescGZIP() []byte {
|
func file_common_net_address_proto_rawDescGZIP() []byte {
|
||||||
file_common_net_address_proto_rawDescOnce.Do(func() {
|
file_common_net_address_proto_rawDescOnce.Do(func() {
|
||||||
file_common_net_address_proto_rawDescData = protoimpl.X.CompressGZIP(file_common_net_address_proto_rawDescData)
|
file_common_net_address_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_common_net_address_proto_rawDesc), len(file_common_net_address_proto_rawDesc)))
|
||||||
})
|
})
|
||||||
return file_common_net_address_proto_rawDescData
|
return file_common_net_address_proto_rawDescData
|
||||||
}
|
}
|
||||||
@@ -158,7 +156,7 @@ func file_common_net_address_proto_init() {
|
|||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_common_net_address_proto_rawDesc,
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_common_net_address_proto_rawDesc), len(file_common_net_address_proto_rawDesc)),
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 1,
|
NumMessages: 1,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
@@ -169,7 +167,6 @@ func file_common_net_address_proto_init() {
|
|||||||
MessageInfos: file_common_net_address_proto_msgTypes,
|
MessageInfos: file_common_net_address_proto_msgTypes,
|
||||||
}.Build()
|
}.Build()
|
||||||
File_common_net_address_proto = out.File
|
File_common_net_address_proto = out.File
|
||||||
file_common_net_address_proto_rawDesc = nil
|
|
||||||
file_common_net_address_proto_goTypes = nil
|
file_common_net_address_proto_goTypes = nil
|
||||||
file_common_net_address_proto_depIdxs = nil
|
file_common_net_address_proto_depIdxs = nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,46 +10,46 @@ import (
|
|||||||
"github.com/xtls/xray-core/common/signal/done"
|
"github.com/xtls/xray-core/common/signal/done"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ConnectionOption func(*connection)
|
type ConnectionOption func(*Connection)
|
||||||
|
|
||||||
func ConnectionLocalAddr(a net.Addr) ConnectionOption {
|
func ConnectionLocalAddr(a net.Addr) ConnectionOption {
|
||||||
return func(c *connection) {
|
return func(c *Connection) {
|
||||||
c.local = a
|
c.local = a
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func ConnectionRemoteAddr(a net.Addr) ConnectionOption {
|
func ConnectionRemoteAddr(a net.Addr) ConnectionOption {
|
||||||
return func(c *connection) {
|
return func(c *Connection) {
|
||||||
c.remote = a
|
c.remote = a
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func ConnectionInput(writer io.Writer) ConnectionOption {
|
func ConnectionInput(writer io.Writer) ConnectionOption {
|
||||||
return func(c *connection) {
|
return func(c *Connection) {
|
||||||
c.writer = buf.NewWriter(writer)
|
c.writer = buf.NewWriter(writer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func ConnectionInputMulti(writer buf.Writer) ConnectionOption {
|
func ConnectionInputMulti(writer buf.Writer) ConnectionOption {
|
||||||
return func(c *connection) {
|
return func(c *Connection) {
|
||||||
c.writer = writer
|
c.writer = writer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func ConnectionOutput(reader io.Reader) ConnectionOption {
|
func ConnectionOutput(reader io.Reader) ConnectionOption {
|
||||||
return func(c *connection) {
|
return func(c *Connection) {
|
||||||
c.reader = &buf.BufferedReader{Reader: buf.NewReader(reader)}
|
c.reader = &buf.BufferedReader{Reader: buf.NewReader(reader)}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func ConnectionOutputMulti(reader buf.Reader) ConnectionOption {
|
func ConnectionOutputMulti(reader buf.Reader) ConnectionOption {
|
||||||
return func(c *connection) {
|
return func(c *Connection) {
|
||||||
c.reader = &buf.BufferedReader{Reader: reader}
|
c.reader = &buf.BufferedReader{Reader: reader}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func ConnectionOutputMultiUDP(reader buf.Reader) ConnectionOption {
|
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,
|
Splitter: buf.SplitFirstBytes,
|
||||||
@@ -58,13 +58,13 @@ func ConnectionOutputMultiUDP(reader buf.Reader) ConnectionOption {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ConnectionOnClose(n io.Closer) ConnectionOption {
|
func ConnectionOnClose(n io.Closer) ConnectionOption {
|
||||||
return func(c *connection) {
|
return func(c *Connection) {
|
||||||
c.onClose = n
|
c.onClose = n
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewConnection(opts ...ConnectionOption) net.Conn {
|
func NewConnection(opts ...ConnectionOption) net.Conn {
|
||||||
c := &connection{
|
c := &Connection{
|
||||||
done: done.New(),
|
done: done.New(),
|
||||||
local: &net.TCPAddr{
|
local: &net.TCPAddr{
|
||||||
IP: []byte{0, 0, 0, 0},
|
IP: []byte{0, 0, 0, 0},
|
||||||
@@ -83,7 +83,7 @@ func NewConnection(opts ...ConnectionOption) net.Conn {
|
|||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
type connection struct {
|
type Connection struct {
|
||||||
reader *buf.BufferedReader
|
reader *buf.BufferedReader
|
||||||
writer buf.Writer
|
writer buf.Writer
|
||||||
done *done.Instance
|
done *done.Instance
|
||||||
@@ -92,17 +92,17 @@ type connection struct {
|
|||||||
remote net.Addr
|
remote net.Addr
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *connection) Read(b []byte) (int, error) {
|
func (c *Connection) Read(b []byte) (int, error) {
|
||||||
return c.reader.Read(b)
|
return c.reader.Read(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReadMultiBuffer implements buf.Reader.
|
// ReadMultiBuffer implements buf.Reader.
|
||||||
func (c *connection) ReadMultiBuffer() (buf.MultiBuffer, error) {
|
func (c *Connection) ReadMultiBuffer() (buf.MultiBuffer, error) {
|
||||||
return c.reader.ReadMultiBuffer()
|
return c.reader.ReadMultiBuffer()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write implements net.Conn.Write().
|
// Write implements net.Conn.Write().
|
||||||
func (c *connection) Write(b []byte) (int, error) {
|
func (c *Connection) Write(b []byte) (int, error) {
|
||||||
if c.done.Done() {
|
if c.done.Done() {
|
||||||
return 0, io.ErrClosedPipe
|
return 0, io.ErrClosedPipe
|
||||||
}
|
}
|
||||||
@@ -113,7 +113,7 @@ func (c *connection) Write(b []byte) (int, error) {
|
|||||||
return l, c.writer.WriteMultiBuffer(mb)
|
return l, c.writer.WriteMultiBuffer(mb)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *connection) WriteMultiBuffer(mb buf.MultiBuffer) error {
|
func (c *Connection) WriteMultiBuffer(mb buf.MultiBuffer) error {
|
||||||
if c.done.Done() {
|
if c.done.Done() {
|
||||||
buf.ReleaseMulti(mb)
|
buf.ReleaseMulti(mb)
|
||||||
return io.ErrClosedPipe
|
return io.ErrClosedPipe
|
||||||
@@ -123,7 +123,7 @@ func (c *connection) WriteMultiBuffer(mb buf.MultiBuffer) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Close implements net.Conn.Close().
|
// Close implements net.Conn.Close().
|
||||||
func (c *connection) Close() error {
|
func (c *Connection) Close() error {
|
||||||
common.Must(c.done.Close())
|
common.Must(c.done.Close())
|
||||||
common.Interrupt(c.reader)
|
common.Interrupt(c.reader)
|
||||||
common.Close(c.writer)
|
common.Close(c.writer)
|
||||||
@@ -135,26 +135,26 @@ func (c *connection) Close() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// LocalAddr implements net.Conn.LocalAddr().
|
// LocalAddr implements net.Conn.LocalAddr().
|
||||||
func (c *connection) LocalAddr() net.Addr {
|
func (c *Connection) LocalAddr() net.Addr {
|
||||||
return c.local
|
return c.local
|
||||||
}
|
}
|
||||||
|
|
||||||
// RemoteAddr implements net.Conn.RemoteAddr().
|
// RemoteAddr implements net.Conn.RemoteAddr().
|
||||||
func (c *connection) RemoteAddr() net.Addr {
|
func (c *Connection) RemoteAddr() net.Addr {
|
||||||
return c.remote
|
return c.remote
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetDeadline implements net.Conn.SetDeadline().
|
// SetDeadline implements net.Conn.SetDeadline().
|
||||||
func (c *connection) SetDeadline(t time.Time) error {
|
func (c *Connection) SetDeadline(t time.Time) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetReadDeadline implements net.Conn.SetReadDeadline().
|
// SetReadDeadline implements net.Conn.SetReadDeadline().
|
||||||
func (c *connection) SetReadDeadline(t time.Time) error {
|
func (c *Connection) SetReadDeadline(t time.Time) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetWriteDeadline implements net.Conn.SetWriteDeadline().
|
// SetWriteDeadline implements net.Conn.SetWriteDeadline().
|
||||||
func (c *connection) SetWriteDeadline(t time.Time) error {
|
func (c *Connection) SetWriteDeadline(t time.Time) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.35.1
|
// protoc-gen-go v1.36.11
|
||||||
// protoc v5.28.2
|
// protoc v6.33.5
|
||||||
// source: common/net/destination.proto
|
// source: common/net/destination.proto
|
||||||
|
|
||||||
package net
|
package net
|
||||||
@@ -11,6 +11,7 @@ import (
|
|||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
sync "sync"
|
sync "sync"
|
||||||
|
unsafe "unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -22,13 +23,12 @@ const (
|
|||||||
|
|
||||||
// Endpoint of a network connection.
|
// Endpoint of a network connection.
|
||||||
type Endpoint struct {
|
type Endpoint struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Network Network `protobuf:"varint,1,opt,name=network,proto3,enum=xray.common.net.Network" json:"network,omitempty"`
|
||||||
|
Address *IPOrDomain `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"`
|
||||||
|
Port uint32 `protobuf:"varint,3,opt,name=port,proto3" json:"port,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
Network Network `protobuf:"varint,1,opt,name=network,proto3,enum=xray.common.net.Network" json:"network,omitempty"`
|
|
||||||
Address *IPOrDomain `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"`
|
|
||||||
Port uint32 `protobuf:"varint,3,opt,name=port,proto3" json:"port,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Endpoint) Reset() {
|
func (x *Endpoint) Reset() {
|
||||||
@@ -84,38 +84,23 @@ func (x *Endpoint) GetPort() uint32 {
|
|||||||
|
|
||||||
var File_common_net_destination_proto protoreflect.FileDescriptor
|
var File_common_net_destination_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_common_net_destination_proto_rawDesc = []byte{
|
const file_common_net_destination_proto_rawDesc = "" +
|
||||||
0x0a, 0x1c, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x6e, 0x65, 0x74, 0x2f, 0x64, 0x65, 0x73,
|
"\n" +
|
||||||
0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f,
|
"\x1ccommon/net/destination.proto\x12\x0fxray.common.net\x1a\x18common/net/network.proto\x1a\x18common/net/address.proto\"\x89\x01\n" +
|
||||||
0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x1a,
|
"\bEndpoint\x122\n" +
|
||||||
0x18, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x6e, 0x65, 0x74, 0x2f, 0x6e, 0x65, 0x74, 0x77,
|
"\anetwork\x18\x01 \x01(\x0e2\x18.xray.common.net.NetworkR\anetwork\x125\n" +
|
||||||
0x6f, 0x72, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 0x63, 0x6f, 0x6d, 0x6d, 0x6f,
|
"\aaddress\x18\x02 \x01(\v2\x1b.xray.common.net.IPOrDomainR\aaddress\x12\x12\n" +
|
||||||
0x6e, 0x2f, 0x6e, 0x65, 0x74, 0x2f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x72,
|
"\x04port\x18\x03 \x01(\rR\x04portBO\n" +
|
||||||
0x6f, 0x74, 0x6f, 0x22, 0x89, 0x01, 0x0a, 0x08, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74,
|
"\x13com.xray.common.netP\x01Z$github.com/xtls/xray-core/common/net\xaa\x02\x0fXray.Common.Netb\x06proto3"
|
||||||
0x12, 0x32, 0x0a, 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28,
|
|
||||||
0x0e, 0x32, 0x18, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e,
|
|
||||||
0x6e, 0x65, 0x74, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x52, 0x07, 0x6e, 0x65, 0x74,
|
|
||||||
0x77, 0x6f, 0x72, 0x6b, 0x12, 0x35, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18,
|
|
||||||
0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d,
|
|
||||||
0x6d, 0x6f, 0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x2e, 0x49, 0x50, 0x4f, 0x72, 0x44, 0x6f, 0x6d, 0x61,
|
|
||||||
0x69, 0x6e, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x70,
|
|
||||||
0x6f, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x42,
|
|
||||||
0x4f, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d,
|
|
||||||
0x6f, 0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x50, 0x01, 0x5a, 0x24, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62,
|
|
||||||
0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x74, 0x6c, 0x73, 0x2f, 0x78, 0x72, 0x61, 0x79, 0x2d, 0x63,
|
|
||||||
0x6f, 0x72, 0x65, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x6e, 0x65, 0x74, 0xaa, 0x02,
|
|
||||||
0x0f, 0x58, 0x72, 0x61, 0x79, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4e, 0x65, 0x74,
|
|
||||||
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
file_common_net_destination_proto_rawDescOnce sync.Once
|
file_common_net_destination_proto_rawDescOnce sync.Once
|
||||||
file_common_net_destination_proto_rawDescData = file_common_net_destination_proto_rawDesc
|
file_common_net_destination_proto_rawDescData []byte
|
||||||
)
|
)
|
||||||
|
|
||||||
func file_common_net_destination_proto_rawDescGZIP() []byte {
|
func file_common_net_destination_proto_rawDescGZIP() []byte {
|
||||||
file_common_net_destination_proto_rawDescOnce.Do(func() {
|
file_common_net_destination_proto_rawDescOnce.Do(func() {
|
||||||
file_common_net_destination_proto_rawDescData = protoimpl.X.CompressGZIP(file_common_net_destination_proto_rawDescData)
|
file_common_net_destination_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_common_net_destination_proto_rawDesc), len(file_common_net_destination_proto_rawDesc)))
|
||||||
})
|
})
|
||||||
return file_common_net_destination_proto_rawDescData
|
return file_common_net_destination_proto_rawDescData
|
||||||
}
|
}
|
||||||
@@ -147,7 +132,7 @@ func file_common_net_destination_proto_init() {
|
|||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_common_net_destination_proto_rawDesc,
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_common_net_destination_proto_rawDesc), len(file_common_net_destination_proto_rawDesc)),
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 1,
|
NumMessages: 1,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
@@ -158,7 +143,6 @@ func file_common_net_destination_proto_init() {
|
|||||||
MessageInfos: file_common_net_destination_proto_msgTypes,
|
MessageInfos: file_common_net_destination_proto_msgTypes,
|
||||||
}.Build()
|
}.Build()
|
||||||
File_common_net_destination_proto = out.File
|
File_common_net_destination_proto = out.File
|
||||||
file_common_net_destination_proto_rawDesc = nil
|
|
||||||
file_common_net_destination_proto_goTypes = nil
|
file_common_net_destination_proto_goTypes = nil
|
||||||
file_common_net_destination_proto_depIdxs = nil
|
file_common_net_destination_proto_depIdxs = nil
|
||||||
}
|
}
|
||||||
|
|||||||
+20
-28
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.35.1
|
// protoc-gen-go v1.36.11
|
||||||
// protoc v5.28.2
|
// protoc v6.33.5
|
||||||
// source: common/net/network.proto
|
// source: common/net/network.proto
|
||||||
|
|
||||||
package net
|
package net
|
||||||
@@ -11,6 +11,7 @@ import (
|
|||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
sync "sync"
|
sync "sync"
|
||||||
|
unsafe "unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -74,11 +75,10 @@ func (Network) EnumDescriptor() ([]byte, []int) {
|
|||||||
|
|
||||||
// NetworkList is a list of Networks.
|
// NetworkList is a list of Networks.
|
||||||
type NetworkList struct {
|
type NetworkList struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Network []Network `protobuf:"varint,1,rep,packed,name=network,proto3,enum=xray.common.net.Network" json:"network,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
Network []Network `protobuf:"varint,1,rep,packed,name=network,proto3,enum=xray.common.net.Network" json:"network,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *NetworkList) Reset() {
|
func (x *NetworkList) Reset() {
|
||||||
@@ -120,33 +120,26 @@ func (x *NetworkList) GetNetwork() []Network {
|
|||||||
|
|
||||||
var File_common_net_network_proto protoreflect.FileDescriptor
|
var File_common_net_network_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_common_net_network_proto_rawDesc = []byte{
|
const file_common_net_network_proto_rawDesc = "" +
|
||||||
0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x6e, 0x65, 0x74, 0x2f, 0x6e, 0x65, 0x74,
|
"\n" +
|
||||||
0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x78, 0x72, 0x61, 0x79,
|
"\x18common/net/network.proto\x12\x0fxray.common.net\"A\n" +
|
||||||
0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x22, 0x41, 0x0a, 0x0b, 0x4e,
|
"\vNetworkList\x122\n" +
|
||||||
0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x32, 0x0a, 0x07, 0x6e, 0x65,
|
"\anetwork\x18\x01 \x03(\x0e2\x18.xray.common.net.NetworkR\anetwork*2\n" +
|
||||||
0x74, 0x77, 0x6f, 0x72, 0x6b, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x78, 0x72,
|
"\aNetwork\x12\v\n" +
|
||||||
0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x2e, 0x4e, 0x65,
|
"\aUnknown\x10\x00\x12\a\n" +
|
||||||
0x74, 0x77, 0x6f, 0x72, 0x6b, 0x52, 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2a, 0x32,
|
"\x03TCP\x10\x02\x12\a\n" +
|
||||||
0x0a, 0x07, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x6e, 0x6b,
|
"\x03UDP\x10\x03\x12\b\n" +
|
||||||
0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x54, 0x43, 0x50, 0x10, 0x02, 0x12,
|
"\x04UNIX\x10\x04BO\n" +
|
||||||
0x07, 0x0a, 0x03, 0x55, 0x44, 0x50, 0x10, 0x03, 0x12, 0x08, 0x0a, 0x04, 0x55, 0x4e, 0x49, 0x58,
|
"\x13com.xray.common.netP\x01Z$github.com/xtls/xray-core/common/net\xaa\x02\x0fXray.Common.Netb\x06proto3"
|
||||||
0x10, 0x04, 0x42, 0x4f, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63,
|
|
||||||
0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x50, 0x01, 0x5a, 0x24, 0x67, 0x69, 0x74,
|
|
||||||
0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x74, 0x6c, 0x73, 0x2f, 0x78, 0x72, 0x61,
|
|
||||||
0x79, 0x2d, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x6e, 0x65,
|
|
||||||
0x74, 0xaa, 0x02, 0x0f, 0x58, 0x72, 0x61, 0x79, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e,
|
|
||||||
0x4e, 0x65, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
file_common_net_network_proto_rawDescOnce sync.Once
|
file_common_net_network_proto_rawDescOnce sync.Once
|
||||||
file_common_net_network_proto_rawDescData = file_common_net_network_proto_rawDesc
|
file_common_net_network_proto_rawDescData []byte
|
||||||
)
|
)
|
||||||
|
|
||||||
func file_common_net_network_proto_rawDescGZIP() []byte {
|
func file_common_net_network_proto_rawDescGZIP() []byte {
|
||||||
file_common_net_network_proto_rawDescOnce.Do(func() {
|
file_common_net_network_proto_rawDescOnce.Do(func() {
|
||||||
file_common_net_network_proto_rawDescData = protoimpl.X.CompressGZIP(file_common_net_network_proto_rawDescData)
|
file_common_net_network_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_common_net_network_proto_rawDesc), len(file_common_net_network_proto_rawDesc)))
|
||||||
})
|
})
|
||||||
return file_common_net_network_proto_rawDescData
|
return file_common_net_network_proto_rawDescData
|
||||||
}
|
}
|
||||||
@@ -175,7 +168,7 @@ func file_common_net_network_proto_init() {
|
|||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_common_net_network_proto_rawDesc,
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_common_net_network_proto_rawDesc), len(file_common_net_network_proto_rawDesc)),
|
||||||
NumEnums: 1,
|
NumEnums: 1,
|
||||||
NumMessages: 1,
|
NumMessages: 1,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
@@ -187,7 +180,6 @@ func file_common_net_network_proto_init() {
|
|||||||
MessageInfos: file_common_net_network_proto_msgTypes,
|
MessageInfos: file_common_net_network_proto_msgTypes,
|
||||||
}.Build()
|
}.Build()
|
||||||
File_common_net_network_proto = out.File
|
File_common_net_network_proto = out.File
|
||||||
file_common_net_network_proto_rawDesc = nil
|
|
||||||
file_common_net_network_proto_goTypes = nil
|
file_common_net_network_proto_goTypes = nil
|
||||||
file_common_net_network_proto_depIdxs = nil
|
file_common_net_network_proto_depIdxs = nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,6 +87,16 @@ func PortListFromProto(l *PortList) MemoryPortList {
|
|||||||
return mpl
|
return mpl
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (l *PortList) Ports() []uint32 {
|
||||||
|
var ports []uint32
|
||||||
|
for _, r := range l.Range {
|
||||||
|
for i := uint32(r.From); i <= uint32(r.To); i++ {
|
||||||
|
ports = append(ports, i)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ports
|
||||||
|
}
|
||||||
|
|
||||||
func (mpl MemoryPortList) Contains(port Port) bool {
|
func (mpl MemoryPortList) Contains(port Port) bool {
|
||||||
for _, pr := range mpl {
|
for _, pr := range mpl {
|
||||||
if pr.Contains(port) {
|
if pr.Contains(port) {
|
||||||
|
|||||||
+22
-32
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.35.1
|
// protoc-gen-go v1.36.11
|
||||||
// protoc v5.28.2
|
// protoc v6.33.5
|
||||||
// source: common/net/port.proto
|
// source: common/net/port.proto
|
||||||
|
|
||||||
package net
|
package net
|
||||||
@@ -11,6 +11,7 @@ import (
|
|||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
sync "sync"
|
sync "sync"
|
||||||
|
unsafe "unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -22,14 +23,13 @@ const (
|
|||||||
|
|
||||||
// PortRange represents a range of ports.
|
// PortRange represents a range of ports.
|
||||||
type PortRange struct {
|
type PortRange struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
// The port that this range starts from.
|
// The port that this range starts from.
|
||||||
From uint32 `protobuf:"varint,1,opt,name=From,proto3" json:"From,omitempty"`
|
From uint32 `protobuf:"varint,1,opt,name=From,proto3" json:"From,omitempty"`
|
||||||
// The port that this range ends with (inclusive).
|
// The port that this range ends with (inclusive).
|
||||||
To uint32 `protobuf:"varint,2,opt,name=To,proto3" json:"To,omitempty"`
|
To uint32 `protobuf:"varint,2,opt,name=To,proto3" json:"To,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *PortRange) Reset() {
|
func (x *PortRange) Reset() {
|
||||||
@@ -78,11 +78,10 @@ func (x *PortRange) GetTo() uint32 {
|
|||||||
|
|
||||||
// PortList is a list of ports.
|
// PortList is a list of ports.
|
||||||
type PortList struct {
|
type PortList struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Range []*PortRange `protobuf:"bytes,1,rep,name=range,proto3" json:"range,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
Range []*PortRange `protobuf:"bytes,1,rep,name=range,proto3" json:"range,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *PortList) Reset() {
|
func (x *PortList) Reset() {
|
||||||
@@ -124,32 +123,24 @@ func (x *PortList) GetRange() []*PortRange {
|
|||||||
|
|
||||||
var File_common_net_port_proto protoreflect.FileDescriptor
|
var File_common_net_port_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_common_net_port_proto_rawDesc = []byte{
|
const file_common_net_port_proto_rawDesc = "" +
|
||||||
0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x6e, 0x65, 0x74, 0x2f, 0x70, 0x6f, 0x72,
|
"\n" +
|
||||||
0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f,
|
"\x15common/net/port.proto\x12\x0fxray.common.net\"/\n" +
|
||||||
0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x22, 0x2f, 0x0a, 0x09, 0x50, 0x6f, 0x72, 0x74,
|
"\tPortRange\x12\x12\n" +
|
||||||
0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x46, 0x72, 0x6f, 0x6d, 0x18, 0x01, 0x20,
|
"\x04From\x18\x01 \x01(\rR\x04From\x12\x0e\n" +
|
||||||
0x01, 0x28, 0x0d, 0x52, 0x04, 0x46, 0x72, 0x6f, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x54, 0x6f, 0x18,
|
"\x02To\x18\x02 \x01(\rR\x02To\"<\n" +
|
||||||
0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x54, 0x6f, 0x22, 0x3c, 0x0a, 0x08, 0x50, 0x6f, 0x72,
|
"\bPortList\x120\n" +
|
||||||
0x74, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x30, 0x0a, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x01,
|
"\x05range\x18\x01 \x03(\v2\x1a.xray.common.net.PortRangeR\x05rangeBO\n" +
|
||||||
0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d,
|
"\x13com.xray.common.netP\x01Z$github.com/xtls/xray-core/common/net\xaa\x02\x0fXray.Common.Netb\x06proto3"
|
||||||
0x6f, 0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x2e, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65,
|
|
||||||
0x52, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x42, 0x4f, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x78,
|
|
||||||
0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x50, 0x01,
|
|
||||||
0x5a, 0x24, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x74, 0x6c,
|
|
||||||
0x73, 0x2f, 0x78, 0x72, 0x61, 0x79, 0x2d, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x63, 0x6f, 0x6d, 0x6d,
|
|
||||||
0x6f, 0x6e, 0x2f, 0x6e, 0x65, 0x74, 0xaa, 0x02, 0x0f, 0x58, 0x72, 0x61, 0x79, 0x2e, 0x43, 0x6f,
|
|
||||||
0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4e, 0x65, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
file_common_net_port_proto_rawDescOnce sync.Once
|
file_common_net_port_proto_rawDescOnce sync.Once
|
||||||
file_common_net_port_proto_rawDescData = file_common_net_port_proto_rawDesc
|
file_common_net_port_proto_rawDescData []byte
|
||||||
)
|
)
|
||||||
|
|
||||||
func file_common_net_port_proto_rawDescGZIP() []byte {
|
func file_common_net_port_proto_rawDescGZIP() []byte {
|
||||||
file_common_net_port_proto_rawDescOnce.Do(func() {
|
file_common_net_port_proto_rawDescOnce.Do(func() {
|
||||||
file_common_net_port_proto_rawDescData = protoimpl.X.CompressGZIP(file_common_net_port_proto_rawDescData)
|
file_common_net_port_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_common_net_port_proto_rawDesc), len(file_common_net_port_proto_rawDesc)))
|
||||||
})
|
})
|
||||||
return file_common_net_port_proto_rawDescData
|
return file_common_net_port_proto_rawDescData
|
||||||
}
|
}
|
||||||
@@ -177,7 +168,7 @@ func file_common_net_port_proto_init() {
|
|||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_common_net_port_proto_rawDesc,
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_common_net_port_proto_rawDesc), len(file_common_net_port_proto_rawDesc)),
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 2,
|
NumMessages: 2,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
@@ -188,7 +179,6 @@ func file_common_net_port_proto_init() {
|
|||||||
MessageInfos: file_common_net_port_proto_msgTypes,
|
MessageInfos: file_common_net_port_proto_msgTypes,
|
||||||
}.Build()
|
}.Build()
|
||||||
File_common_net_port_proto = out.File
|
File_common_net_port_proto = out.File
|
||||||
file_common_net_port_proto_rawDesc = nil
|
|
||||||
file_common_net_port_proto_goTypes = nil
|
file_common_net_port_proto_goTypes = nil
|
||||||
file_common_net_port_proto_depIdxs = nil
|
file_common_net_port_proto_depIdxs = nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,52 +0,0 @@
|
|||||||
package filesystem
|
|
||||||
|
|
||||||
func DecodeVarint(buf []byte) (x uint64, n int) {
|
|
||||||
for shift := uint(0); shift < 64; shift += 7 {
|
|
||||||
if n >= len(buf) {
|
|
||||||
return 0, 0
|
|
||||||
}
|
|
||||||
b := uint64(buf[n])
|
|
||||||
n++
|
|
||||||
x |= (b & 0x7F) << shift
|
|
||||||
if (b & 0x80) == 0 {
|
|
||||||
return x, n
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// The number is too large to represent in a 64-bit value.
|
|
||||||
return 0, 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func Find(data, code []byte) []byte {
|
|
||||||
codeL := len(code)
|
|
||||||
if codeL == 0 {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
for {
|
|
||||||
dataL := len(data)
|
|
||||||
if dataL < 2 {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
x, y := DecodeVarint(data[1:])
|
|
||||||
if x == 0 && y == 0 {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
headL, bodyL := 1+y, int(x)
|
|
||||||
dataL -= headL
|
|
||||||
if dataL < bodyL {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
data = data[headL:]
|
|
||||||
if int(data[1]) == codeL {
|
|
||||||
for i := 0; i < codeL && data[2+i] == code[i]; i++ {
|
|
||||||
if i+1 == codeL {
|
|
||||||
return data[:bodyL]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if dataL == bodyL {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
data = data[bodyL:]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +1,9 @@
|
|||||||
//go:build !windows && !wasm
|
|
||||||
|
|
||||||
package filesystem
|
package filesystem
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"syscall"
|
|
||||||
|
|
||||||
"github.com/xtls/xray-core/common/buf"
|
"github.com/xtls/xray-core/common/buf"
|
||||||
"github.com/xtls/xray-core/common/platform"
|
"github.com/xtls/xray-core/common/platform"
|
||||||
@@ -19,29 +16,6 @@ var NewFileReader FileReaderFunc = func(path string) (io.ReadCloser, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ReadFile(path string) ([]byte, error) {
|
func ReadFile(path string) ([]byte, error) {
|
||||||
file, err := os.Open(path)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
defer file.Close()
|
|
||||||
|
|
||||||
stat, err := file.Stat()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
size := stat.Size()
|
|
||||||
if size == 0 {
|
|
||||||
return []byte{}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// use mmap to save RAM
|
|
||||||
bs, err := syscall.Mmap(int(file.Fd()), 0, int(size), syscall.PROT_READ, syscall.MAP_SHARED)
|
|
||||||
if err == nil {
|
|
||||||
return bs, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// fallback
|
|
||||||
reader, err := NewFileReader(path)
|
reader, err := NewFileReader(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -55,6 +29,10 @@ func ReadAsset(file string) ([]byte, error) {
|
|||||||
return ReadFile(platform.GetAssetLocation(file))
|
return ReadFile(platform.GetAssetLocation(file))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func OpenAsset(file string) (io.ReadCloser, error) {
|
||||||
|
return NewFileReader(platform.GetAssetLocation(file))
|
||||||
|
}
|
||||||
|
|
||||||
func ReadCert(file string) ([]byte, error) {
|
func ReadCert(file string) ([]byte, error) {
|
||||||
if filepath.IsAbs(file) {
|
if filepath.IsAbs(file) {
|
||||||
return ReadFile(file)
|
return ReadFile(file)
|
||||||
|
|||||||
@@ -1,54 +0,0 @@
|
|||||||
//go:build windows || wasm
|
|
||||||
|
|
||||||
package filesystem
|
|
||||||
|
|
||||||
import (
|
|
||||||
"io"
|
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
|
|
||||||
"github.com/xtls/xray-core/common/buf"
|
|
||||||
"github.com/xtls/xray-core/common/platform"
|
|
||||||
)
|
|
||||||
|
|
||||||
type FileReaderFunc func(path string) (io.ReadCloser, error)
|
|
||||||
|
|
||||||
var NewFileReader FileReaderFunc = func(path string) (io.ReadCloser, error) {
|
|
||||||
return os.Open(path)
|
|
||||||
}
|
|
||||||
|
|
||||||
func ReadFile(path string) ([]byte, error) {
|
|
||||||
reader, err := NewFileReader(path)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
defer reader.Close()
|
|
||||||
|
|
||||||
return buf.ReadAllToBytes(reader)
|
|
||||||
}
|
|
||||||
|
|
||||||
func ReadAsset(file string) ([]byte, error) {
|
|
||||||
return ReadFile(platform.GetAssetLocation(file))
|
|
||||||
}
|
|
||||||
|
|
||||||
func ReadCert(file string) ([]byte, error) {
|
|
||||||
if filepath.IsAbs(file) {
|
|
||||||
return ReadFile(file)
|
|
||||||
}
|
|
||||||
return ReadFile(platform.GetCertLocation(file))
|
|
||||||
}
|
|
||||||
|
|
||||||
func CopyFile(dst string, src string) error {
|
|
||||||
bytes, err := ReadFile(src)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
f, err := os.OpenFile(dst, os.O_CREATE|os.O_WRONLY, 0o644)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
defer f.Close()
|
|
||||||
|
|
||||||
_, err = f.Write(bytes)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
@@ -24,6 +24,8 @@ const (
|
|||||||
XUDPBaseKey = "xray.xudp.basekey"
|
XUDPBaseKey = "xray.xudp.basekey"
|
||||||
|
|
||||||
TunFdKey = "xray.tun.fd"
|
TunFdKey = "xray.tun.fd"
|
||||||
|
|
||||||
|
MphCachePath = "xray.mph.cache"
|
||||||
)
|
)
|
||||||
|
|
||||||
type EnvFlag struct {
|
type EnvFlag struct {
|
||||||
|
|||||||
@@ -3,9 +3,7 @@
|
|||||||
|
|
||||||
package platform
|
package platform
|
||||||
|
|
||||||
import (
|
import "path/filepath"
|
||||||
"path/filepath"
|
|
||||||
)
|
|
||||||
|
|
||||||
func LineSeparator() string {
|
func LineSeparator() string {
|
||||||
return "\r\n"
|
return "\r\n"
|
||||||
@@ -14,7 +12,6 @@ func LineSeparator() string {
|
|||||||
// GetAssetLocation searches for `file` in the env dir and the executable dir
|
// GetAssetLocation searches for `file` in the env dir and the executable 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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.35.1
|
// protoc-gen-go v1.36.11
|
||||||
// protoc v5.28.2
|
// protoc v6.33.5
|
||||||
// source: common/protocol/headers.proto
|
// source: common/protocol/headers.proto
|
||||||
|
|
||||||
package protocol
|
package protocol
|
||||||
@@ -11,6 +11,7 @@ import (
|
|||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
sync "sync"
|
sync "sync"
|
||||||
|
unsafe "unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -79,11 +80,10 @@ func (SecurityType) EnumDescriptor() ([]byte, []int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type SecurityConfig struct {
|
type SecurityConfig struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Type SecurityType `protobuf:"varint,1,opt,name=type,proto3,enum=xray.common.protocol.SecurityType" json:"type,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
Type SecurityType `protobuf:"varint,1,opt,name=type,proto3,enum=xray.common.protocol.SecurityType" json:"type,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *SecurityConfig) Reset() {
|
func (x *SecurityConfig) Reset() {
|
||||||
@@ -125,38 +125,29 @@ func (x *SecurityConfig) GetType() SecurityType {
|
|||||||
|
|
||||||
var File_common_protocol_headers_proto protoreflect.FileDescriptor
|
var File_common_protocol_headers_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_common_protocol_headers_proto_rawDesc = []byte{
|
const file_common_protocol_headers_proto_rawDesc = "" +
|
||||||
0x0a, 0x1d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f,
|
"\n" +
|
||||||
0x6c, 0x2f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
|
"\x1dcommon/protocol/headers.proto\x12\x14xray.common.protocol\"H\n" +
|
||||||
0x14, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f,
|
"\x0eSecurityConfig\x126\n" +
|
||||||
0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x22, 0x48, 0x0a, 0x0e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74,
|
"\x04type\x18\x01 \x01(\x0e2\".xray.common.protocol.SecurityTypeR\x04type*`\n" +
|
||||||
0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x36, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18,
|
"\fSecurityType\x12\v\n" +
|
||||||
0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x22, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d,
|
"\aUNKNOWN\x10\x00\x12\b\n" +
|
||||||
0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x53, 0x65, 0x63,
|
"\x04AUTO\x10\x02\x12\x0e\n" +
|
||||||
0x75, 0x72, 0x69, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x2a,
|
"\n" +
|
||||||
0x60, 0x0a, 0x0c, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12,
|
"AES128_GCM\x10\x03\x12\x15\n" +
|
||||||
0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04,
|
"\x11CHACHA20_POLY1305\x10\x04\x12\b\n" +
|
||||||
0x41, 0x55, 0x54, 0x4f, 0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x41, 0x45, 0x53, 0x31, 0x32, 0x38,
|
"\x04NONE\x10\x05\x12\b\n" +
|
||||||
0x5f, 0x47, 0x43, 0x4d, 0x10, 0x03, 0x12, 0x15, 0x0a, 0x11, 0x43, 0x48, 0x41, 0x43, 0x48, 0x41,
|
"\x04ZERO\x10\x06B^\n" +
|
||||||
0x32, 0x30, 0x5f, 0x50, 0x4f, 0x4c, 0x59, 0x31, 0x33, 0x30, 0x35, 0x10, 0x04, 0x12, 0x08, 0x0a,
|
"\x18com.xray.common.protocolP\x01Z)github.com/xtls/xray-core/common/protocol\xaa\x02\x14Xray.Common.Protocolb\x06proto3"
|
||||||
0x04, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x05, 0x12, 0x08, 0x0a, 0x04, 0x5a, 0x45, 0x52, 0x4f, 0x10,
|
|
||||||
0x06, 0x42, 0x5e, 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f,
|
|
||||||
0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x50, 0x01, 0x5a,
|
|
||||||
0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x74, 0x6c, 0x73,
|
|
||||||
0x2f, 0x78, 0x72, 0x61, 0x79, 0x2d, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f,
|
|
||||||
0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0xaa, 0x02, 0x14, 0x58, 0x72, 0x61,
|
|
||||||
0x79, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f,
|
|
||||||
0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
file_common_protocol_headers_proto_rawDescOnce sync.Once
|
file_common_protocol_headers_proto_rawDescOnce sync.Once
|
||||||
file_common_protocol_headers_proto_rawDescData = file_common_protocol_headers_proto_rawDesc
|
file_common_protocol_headers_proto_rawDescData []byte
|
||||||
)
|
)
|
||||||
|
|
||||||
func file_common_protocol_headers_proto_rawDescGZIP() []byte {
|
func file_common_protocol_headers_proto_rawDescGZIP() []byte {
|
||||||
file_common_protocol_headers_proto_rawDescOnce.Do(func() {
|
file_common_protocol_headers_proto_rawDescOnce.Do(func() {
|
||||||
file_common_protocol_headers_proto_rawDescData = protoimpl.X.CompressGZIP(file_common_protocol_headers_proto_rawDescData)
|
file_common_protocol_headers_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_common_protocol_headers_proto_rawDesc), len(file_common_protocol_headers_proto_rawDesc)))
|
||||||
})
|
})
|
||||||
return file_common_protocol_headers_proto_rawDescData
|
return file_common_protocol_headers_proto_rawDescData
|
||||||
}
|
}
|
||||||
@@ -185,7 +176,7 @@ func file_common_protocol_headers_proto_init() {
|
|||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_common_protocol_headers_proto_rawDesc,
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_common_protocol_headers_proto_rawDesc), len(file_common_protocol_headers_proto_rawDesc)),
|
||||||
NumEnums: 1,
|
NumEnums: 1,
|
||||||
NumMessages: 1,
|
NumMessages: 1,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
@@ -197,7 +188,6 @@ func file_common_protocol_headers_proto_init() {
|
|||||||
MessageInfos: file_common_protocol_headers_proto_msgTypes,
|
MessageInfos: file_common_protocol_headers_proto_msgTypes,
|
||||||
}.Build()
|
}.Build()
|
||||||
File_common_protocol_headers_proto = out.File
|
File_common_protocol_headers_proto = out.File
|
||||||
file_common_protocol_headers_proto_rawDesc = nil
|
|
||||||
file_common_protocol_headers_proto_goTypes = nil
|
file_common_protocol_headers_proto_goTypes = nil
|
||||||
file_common_protocol_headers_proto_depIdxs = nil
|
file_common_protocol_headers_proto_depIdxs = nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
"github.com/quic-go/quic-go/quicvarint"
|
"github.com/apernet/quic-go/quicvarint"
|
||||||
"github.com/xtls/xray-core/common"
|
"github.com/xtls/xray-core/common"
|
||||||
"github.com/xtls/xray-core/common/buf"
|
"github.com/xtls/xray-core/common/buf"
|
||||||
"github.com/xtls/xray-core/common/errors"
|
"github.com/xtls/xray-core/common/errors"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.35.1
|
// protoc-gen-go v1.36.11
|
||||||
// protoc v5.28.2
|
// protoc v6.33.5
|
||||||
// source: common/protocol/server_spec.proto
|
// source: common/protocol/server_spec.proto
|
||||||
|
|
||||||
package protocol
|
package protocol
|
||||||
@@ -12,6 +12,7 @@ import (
|
|||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
sync "sync"
|
sync "sync"
|
||||||
|
unsafe "unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -22,13 +23,12 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type ServerEndpoint struct {
|
type ServerEndpoint struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Address *net.IPOrDomain `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
|
||||||
|
Port uint32 `protobuf:"varint,2,opt,name=port,proto3" json:"port,omitempty"`
|
||||||
|
User *User `protobuf:"bytes,3,opt,name=user,proto3" json:"user,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
Address *net.IPOrDomain `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
|
|
||||||
Port uint32 `protobuf:"varint,2,opt,name=port,proto3" json:"port,omitempty"`
|
|
||||||
User *User `protobuf:"bytes,3,opt,name=user,proto3" json:"user,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ServerEndpoint) Reset() {
|
func (x *ServerEndpoint) Reset() {
|
||||||
@@ -84,40 +84,23 @@ func (x *ServerEndpoint) GetUser() *User {
|
|||||||
|
|
||||||
var File_common_protocol_server_spec_proto protoreflect.FileDescriptor
|
var File_common_protocol_server_spec_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_common_protocol_server_spec_proto_rawDesc = []byte{
|
const file_common_protocol_server_spec_proto_rawDesc = "" +
|
||||||
0x0a, 0x21, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f,
|
"\n" +
|
||||||
0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x2e, 0x70, 0x72,
|
"!common/protocol/server_spec.proto\x12\x14xray.common.protocol\x1a\x18common/net/address.proto\x1a\x1acommon/protocol/user.proto\"\x8b\x01\n" +
|
||||||
0x6f, 0x74, 0x6f, 0x12, 0x14, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
|
"\x0eServerEndpoint\x125\n" +
|
||||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x1a, 0x18, 0x63, 0x6f, 0x6d, 0x6d, 0x6f,
|
"\aaddress\x18\x01 \x01(\v2\x1b.xray.common.net.IPOrDomainR\aaddress\x12\x12\n" +
|
||||||
0x6e, 0x2f, 0x6e, 0x65, 0x74, 0x2f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x72,
|
"\x04port\x18\x02 \x01(\rR\x04port\x12.\n" +
|
||||||
0x6f, 0x74, 0x6f, 0x1a, 0x1a, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74,
|
"\x04user\x18\x03 \x01(\v2\x1a.xray.common.protocol.UserR\x04userB^\n" +
|
||||||
0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22,
|
"\x18com.xray.common.protocolP\x01Z)github.com/xtls/xray-core/common/protocol\xaa\x02\x14Xray.Common.Protocolb\x06proto3"
|
||||||
0x8b, 0x01, 0x0a, 0x0e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69,
|
|
||||||
0x6e, 0x74, 0x12, 0x35, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20,
|
|
||||||
0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f,
|
|
||||||
0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x2e, 0x49, 0x50, 0x4f, 0x72, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e,
|
|
||||||
0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72,
|
|
||||||
0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x2e, 0x0a,
|
|
||||||
0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x78, 0x72,
|
|
||||||
0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63,
|
|
||||||
0x6f, 0x6c, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x42, 0x5e, 0x0a,
|
|
||||||
0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
|
|
||||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x50, 0x01, 0x5a, 0x29, 0x67, 0x69, 0x74,
|
|
||||||
0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x74, 0x6c, 0x73, 0x2f, 0x78, 0x72, 0x61,
|
|
||||||
0x79, 0x2d, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72,
|
|
||||||
0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0xaa, 0x02, 0x14, 0x58, 0x72, 0x61, 0x79, 0x2e, 0x43, 0x6f,
|
|
||||||
0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x62, 0x06, 0x70,
|
|
||||||
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
file_common_protocol_server_spec_proto_rawDescOnce sync.Once
|
file_common_protocol_server_spec_proto_rawDescOnce sync.Once
|
||||||
file_common_protocol_server_spec_proto_rawDescData = file_common_protocol_server_spec_proto_rawDesc
|
file_common_protocol_server_spec_proto_rawDescData []byte
|
||||||
)
|
)
|
||||||
|
|
||||||
func file_common_protocol_server_spec_proto_rawDescGZIP() []byte {
|
func file_common_protocol_server_spec_proto_rawDescGZIP() []byte {
|
||||||
file_common_protocol_server_spec_proto_rawDescOnce.Do(func() {
|
file_common_protocol_server_spec_proto_rawDescOnce.Do(func() {
|
||||||
file_common_protocol_server_spec_proto_rawDescData = protoimpl.X.CompressGZIP(file_common_protocol_server_spec_proto_rawDescData)
|
file_common_protocol_server_spec_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_common_protocol_server_spec_proto_rawDesc), len(file_common_protocol_server_spec_proto_rawDesc)))
|
||||||
})
|
})
|
||||||
return file_common_protocol_server_spec_proto_rawDescData
|
return file_common_protocol_server_spec_proto_rawDescData
|
||||||
}
|
}
|
||||||
@@ -148,7 +131,7 @@ func file_common_protocol_server_spec_proto_init() {
|
|||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_common_protocol_server_spec_proto_rawDesc,
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_common_protocol_server_spec_proto_rawDesc), len(file_common_protocol_server_spec_proto_rawDesc)),
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 1,
|
NumMessages: 1,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
@@ -159,7 +142,6 @@ func file_common_protocol_server_spec_proto_init() {
|
|||||||
MessageInfos: file_common_protocol_server_spec_proto_msgTypes,
|
MessageInfos: file_common_protocol_server_spec_proto_msgTypes,
|
||||||
}.Build()
|
}.Build()
|
||||||
File_common_protocol_server_spec_proto = out.File
|
File_common_protocol_server_spec_proto = out.File
|
||||||
file_common_protocol_server_spec_proto_rawDesc = nil
|
|
||||||
file_common_protocol_server_spec_proto_goTypes = nil
|
file_common_protocol_server_spec_proto_goTypes = nil
|
||||||
file_common_protocol_server_spec_proto_depIdxs = nil
|
file_common_protocol_server_spec_proto_depIdxs = nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
"crypto/elliptic"
|
"crypto/elliptic"
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"crypto/rsa"
|
"crypto/rsa"
|
||||||
|
"crypto/sha256"
|
||||||
"crypto/x509"
|
"crypto/x509"
|
||||||
"encoding/asn1"
|
"encoding/asn1"
|
||||||
"encoding/pem"
|
"encoding/pem"
|
||||||
@@ -87,10 +88,10 @@ func Organization(org string) Option {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func MustGenerate(parent *Certificate, opts ...Option) *Certificate {
|
func MustGenerate(parent *Certificate, opts ...Option) (*Certificate, [32]byte) {
|
||||||
cert, err := Generate(parent, opts...)
|
cert, err := Generate(parent, opts...)
|
||||||
common.Must(err)
|
common.Must(err)
|
||||||
return cert
|
return cert, sha256.Sum256(cert.Certificate)
|
||||||
}
|
}
|
||||||
|
|
||||||
func publicKey(priv interface{}) interface{} {
|
func publicKey(priv interface{}) interface{} {
|
||||||
|
|||||||
+20
-34
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.35.1
|
// protoc-gen-go v1.36.11
|
||||||
// protoc v5.28.2
|
// protoc v6.33.5
|
||||||
// source: common/protocol/user.proto
|
// source: common/protocol/user.proto
|
||||||
|
|
||||||
package protocol
|
package protocol
|
||||||
@@ -12,6 +12,7 @@ import (
|
|||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
sync "sync"
|
sync "sync"
|
||||||
|
unsafe "unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -23,15 +24,14 @@ const (
|
|||||||
|
|
||||||
// User is a generic user for all protocols.
|
// User is a generic user for all protocols.
|
||||||
type User struct {
|
type User struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Level uint32 `protobuf:"varint,1,opt,name=level,proto3" json:"level,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
Email string `protobuf:"bytes,2,opt,name=email,proto3" json:"email,omitempty"`
|
||||||
|
|
||||||
Level uint32 `protobuf:"varint,1,opt,name=level,proto3" json:"level,omitempty"`
|
|
||||||
Email string `protobuf:"bytes,2,opt,name=email,proto3" json:"email,omitempty"`
|
|
||||||
// Protocol specific account information. Must be the account proto in one of
|
// Protocol specific account information. Must be the account proto in one of
|
||||||
// the proxies.
|
// the proxies.
|
||||||
Account *serial.TypedMessage `protobuf:"bytes,3,opt,name=account,proto3" json:"account,omitempty"`
|
Account *serial.TypedMessage `protobuf:"bytes,3,opt,name=account,proto3" json:"account,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *User) Reset() {
|
func (x *User) Reset() {
|
||||||
@@ -87,36 +87,23 @@ func (x *User) GetAccount() *serial.TypedMessage {
|
|||||||
|
|
||||||
var File_common_protocol_user_proto protoreflect.FileDescriptor
|
var File_common_protocol_user_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_common_protocol_user_proto_rawDesc = []byte{
|
const file_common_protocol_user_proto_rawDesc = "" +
|
||||||
0x0a, 0x1a, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f,
|
"\n" +
|
||||||
0x6c, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x78, 0x72,
|
"\x1acommon/protocol/user.proto\x12\x14xray.common.protocol\x1a!common/serial/typed_message.proto\"n\n" +
|
||||||
0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63,
|
"\x04User\x12\x14\n" +
|
||||||
0x6f, 0x6c, 0x1a, 0x21, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x73, 0x65, 0x72, 0x69, 0x61,
|
"\x05level\x18\x01 \x01(\rR\x05level\x12\x14\n" +
|
||||||
0x6c, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x64, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e,
|
"\x05email\x18\x02 \x01(\tR\x05email\x12:\n" +
|
||||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x6e, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x14, 0x0a,
|
"\aaccount\x18\x03 \x01(\v2 .xray.common.serial.TypedMessageR\aaccountB^\n" +
|
||||||
0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x6c, 0x65,
|
"\x18com.xray.common.protocolP\x01Z)github.com/xtls/xray-core/common/protocol\xaa\x02\x14Xray.Common.Protocolb\x06proto3"
|
||||||
0x76, 0x65, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x02, 0x20, 0x01,
|
|
||||||
0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x3a, 0x0a, 0x07, 0x61, 0x63, 0x63,
|
|
||||||
0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x78, 0x72, 0x61,
|
|
||||||
0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x2e,
|
|
||||||
0x54, 0x79, 0x70, 0x65, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x07, 0x61, 0x63,
|
|
||||||
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x5e, 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61,
|
|
||||||
0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f,
|
|
||||||
0x6c, 0x50, 0x01, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
|
|
||||||
0x78, 0x74, 0x6c, 0x73, 0x2f, 0x78, 0x72, 0x61, 0x79, 0x2d, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x63,
|
|
||||||
0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0xaa, 0x02,
|
|
||||||
0x14, 0x58, 0x72, 0x61, 0x79, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x72, 0x6f,
|
|
||||||
0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
file_common_protocol_user_proto_rawDescOnce sync.Once
|
file_common_protocol_user_proto_rawDescOnce sync.Once
|
||||||
file_common_protocol_user_proto_rawDescData = file_common_protocol_user_proto_rawDesc
|
file_common_protocol_user_proto_rawDescData []byte
|
||||||
)
|
)
|
||||||
|
|
||||||
func file_common_protocol_user_proto_rawDescGZIP() []byte {
|
func file_common_protocol_user_proto_rawDescGZIP() []byte {
|
||||||
file_common_protocol_user_proto_rawDescOnce.Do(func() {
|
file_common_protocol_user_proto_rawDescOnce.Do(func() {
|
||||||
file_common_protocol_user_proto_rawDescData = protoimpl.X.CompressGZIP(file_common_protocol_user_proto_rawDescData)
|
file_common_protocol_user_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_common_protocol_user_proto_rawDesc), len(file_common_protocol_user_proto_rawDesc)))
|
||||||
})
|
})
|
||||||
return file_common_protocol_user_proto_rawDescData
|
return file_common_protocol_user_proto_rawDescData
|
||||||
}
|
}
|
||||||
@@ -144,7 +131,7 @@ func file_common_protocol_user_proto_init() {
|
|||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_common_protocol_user_proto_rawDesc,
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_common_protocol_user_proto_rawDesc), len(file_common_protocol_user_proto_rawDesc)),
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 1,
|
NumMessages: 1,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
@@ -155,7 +142,6 @@ func file_common_protocol_user_proto_init() {
|
|||||||
MessageInfos: file_common_protocol_user_proto_msgTypes,
|
MessageInfos: file_common_protocol_user_proto_msgTypes,
|
||||||
}.Build()
|
}.Build()
|
||||||
File_common_protocol_user_proto = out.File
|
File_common_protocol_user_proto = out.File
|
||||||
file_common_protocol_user_proto_rawDesc = nil
|
|
||||||
file_common_protocol_user_proto_goTypes = nil
|
file_common_protocol_user_proto_goTypes = nil
|
||||||
file_common_protocol_user_proto_depIdxs = nil
|
file_common_protocol_user_proto_depIdxs = nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.35.1
|
// protoc-gen-go v1.36.11
|
||||||
// protoc v5.28.2
|
// protoc v6.33.5
|
||||||
// source: common/serial/typed_message.proto
|
// source: common/serial/typed_message.proto
|
||||||
|
|
||||||
package serial
|
package serial
|
||||||
@@ -11,6 +11,7 @@ import (
|
|||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
sync "sync"
|
sync "sync"
|
||||||
|
unsafe "unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -22,14 +23,13 @@ const (
|
|||||||
|
|
||||||
// TypedMessage is a serialized proto message along with its type name.
|
// TypedMessage is a serialized proto message along with its type name.
|
||||||
type TypedMessage struct {
|
type TypedMessage struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
// The name of the message type, retrieved from protobuf API.
|
// The name of the message type, retrieved from protobuf API.
|
||||||
Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
|
Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
|
||||||
// Serialized proto message.
|
// Serialized proto message.
|
||||||
Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
|
Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *TypedMessage) Reset() {
|
func (x *TypedMessage) Reset() {
|
||||||
@@ -78,31 +78,22 @@ func (x *TypedMessage) GetValue() []byte {
|
|||||||
|
|
||||||
var File_common_serial_typed_message_proto protoreflect.FileDescriptor
|
var File_common_serial_typed_message_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_common_serial_typed_message_proto_rawDesc = []byte{
|
const file_common_serial_typed_message_proto_rawDesc = "" +
|
||||||
0x0a, 0x21, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x2f,
|
"\n" +
|
||||||
0x74, 0x79, 0x70, 0x65, 0x64, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72,
|
"!common/serial/typed_message.proto\x12\x12xray.common.serial\"8\n" +
|
||||||
0x6f, 0x74, 0x6f, 0x12, 0x12, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
|
"\fTypedMessage\x12\x12\n" +
|
||||||
0x2e, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x22, 0x38, 0x0a, 0x0c, 0x54, 0x79, 0x70, 0x65, 0x64,
|
"\x04type\x18\x01 \x01(\tR\x04type\x12\x14\n" +
|
||||||
0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18,
|
"\x05value\x18\x02 \x01(\fR\x05valueBX\n" +
|
||||||
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76,
|
"\x16com.xray.common.serialP\x01Z'github.com/xtls/xray-core/common/serial\xaa\x02\x12Xray.Common.Serialb\x06proto3"
|
||||||
0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75,
|
|
||||||
0x65, 0x42, 0x58, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f,
|
|
||||||
0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x50, 0x01, 0x5a, 0x27, 0x67,
|
|
||||||
0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x74, 0x6c, 0x73, 0x2f, 0x78,
|
|
||||||
0x72, 0x61, 0x79, 0x2d, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f,
|
|
||||||
0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0xaa, 0x02, 0x12, 0x58, 0x72, 0x61, 0x79, 0x2e, 0x43, 0x6f,
|
|
||||||
0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
|
||||||
0x74, 0x6f, 0x33,
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
file_common_serial_typed_message_proto_rawDescOnce sync.Once
|
file_common_serial_typed_message_proto_rawDescOnce sync.Once
|
||||||
file_common_serial_typed_message_proto_rawDescData = file_common_serial_typed_message_proto_rawDesc
|
file_common_serial_typed_message_proto_rawDescData []byte
|
||||||
)
|
)
|
||||||
|
|
||||||
func file_common_serial_typed_message_proto_rawDescGZIP() []byte {
|
func file_common_serial_typed_message_proto_rawDescGZIP() []byte {
|
||||||
file_common_serial_typed_message_proto_rawDescOnce.Do(func() {
|
file_common_serial_typed_message_proto_rawDescOnce.Do(func() {
|
||||||
file_common_serial_typed_message_proto_rawDescData = protoimpl.X.CompressGZIP(file_common_serial_typed_message_proto_rawDescData)
|
file_common_serial_typed_message_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_common_serial_typed_message_proto_rawDesc), len(file_common_serial_typed_message_proto_rawDesc)))
|
||||||
})
|
})
|
||||||
return file_common_serial_typed_message_proto_rawDescData
|
return file_common_serial_typed_message_proto_rawDescData
|
||||||
}
|
}
|
||||||
@@ -128,7 +119,7 @@ func file_common_serial_typed_message_proto_init() {
|
|||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_common_serial_typed_message_proto_rawDesc,
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_common_serial_typed_message_proto_rawDesc), len(file_common_serial_typed_message_proto_rawDesc)),
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 1,
|
NumMessages: 1,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
@@ -139,7 +130,6 @@ func file_common_serial_typed_message_proto_init() {
|
|||||||
MessageInfos: file_common_serial_typed_message_proto_msgTypes,
|
MessageInfos: file_common_serial_typed_message_proto_msgTypes,
|
||||||
}.Build()
|
}.Build()
|
||||||
File_common_serial_typed_message_proto = out.File
|
File_common_serial_typed_message_proto = out.File
|
||||||
file_common_serial_typed_message_proto_rawDesc = nil
|
|
||||||
file_common_serial_typed_message_proto_goTypes = nil
|
file_common_serial_typed_message_proto_goTypes = nil
|
||||||
file_common_serial_typed_message_proto_depIdxs = nil
|
file_common_serial_typed_message_proto_depIdxs = nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,12 @@ package singbridge
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"time"
|
||||||
|
|
||||||
B "github.com/sagernet/sing/common/buf"
|
B "github.com/sagernet/sing/common/buf"
|
||||||
"github.com/sagernet/sing/common/bufio"
|
"github.com/sagernet/sing/common/bufio"
|
||||||
M "github.com/sagernet/sing/common/metadata"
|
M "github.com/sagernet/sing/common/metadata"
|
||||||
|
"github.com/xtls/xray-core/common"
|
||||||
"github.com/xtls/xray-core/common/buf"
|
"github.com/xtls/xray-core/common/buf"
|
||||||
"github.com/xtls/xray-core/common/net"
|
"github.com/xtls/xray-core/common/net"
|
||||||
"github.com/xtls/xray-core/transport"
|
"github.com/xtls/xray-core/transport"
|
||||||
@@ -29,6 +31,8 @@ type PacketConnWrapper struct {
|
|||||||
cached buf.MultiBuffer
|
cached buf.MultiBuffer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This ReadPacket implemented a timeout to avoid goroutine leak like PipeConnWrapper.Read()
|
||||||
|
// as a temporarily solution
|
||||||
func (w *PacketConnWrapper) ReadPacket(buffer *B.Buffer) (M.Socksaddr, error) {
|
func (w *PacketConnWrapper) ReadPacket(buffer *B.Buffer) (M.Socksaddr, error) {
|
||||||
if w.cached != nil {
|
if w.cached != nil {
|
||||||
mb, bb := buf.SplitFirst(w.cached)
|
mb, bb := buf.SplitFirst(w.cached)
|
||||||
@@ -47,10 +51,30 @@ func (w *PacketConnWrapper) ReadPacket(buffer *B.Buffer) (M.Socksaddr, error) {
|
|||||||
return ToSocksaddr(destination), nil
|
return ToSocksaddr(destination), nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mb, err := w.ReadMultiBuffer()
|
|
||||||
if err != nil {
|
// timeout
|
||||||
return M.Socksaddr{}, err
|
type readResult struct {
|
||||||
|
mb buf.MultiBuffer
|
||||||
|
err error
|
||||||
}
|
}
|
||||||
|
c := make(chan readResult, 1)
|
||||||
|
go func() {
|
||||||
|
mb, err := w.ReadMultiBuffer()
|
||||||
|
c <- readResult{mb: mb, err: err}
|
||||||
|
}()
|
||||||
|
var mb buf.MultiBuffer
|
||||||
|
select {
|
||||||
|
case <-time.After(60 * time.Second):
|
||||||
|
common.Close(w.Reader)
|
||||||
|
common.Interrupt(w.Reader)
|
||||||
|
return M.Socksaddr{}, buf.ErrReadTimeout
|
||||||
|
case result := <-c:
|
||||||
|
if result.err != nil {
|
||||||
|
return M.Socksaddr{}, result.err
|
||||||
|
}
|
||||||
|
mb = result.mb
|
||||||
|
}
|
||||||
|
|
||||||
nb, bb := buf.SplitFirst(mb)
|
nb, bb := buf.SplitFirst(mb)
|
||||||
if bb == nil {
|
if bb == nil {
|
||||||
return M.Socksaddr{}, nil
|
return M.Socksaddr{}, nil
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import (
|
|||||||
const validCharCount = 53
|
const validCharCount = 53
|
||||||
|
|
||||||
type MatchType struct {
|
type MatchType struct {
|
||||||
matchType Type
|
Type Type
|
||||||
exist bool
|
Exist bool
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -17,23 +17,23 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Edge struct {
|
type Edge struct {
|
||||||
edgeType bool
|
Type bool
|
||||||
nextNode int
|
NextNode int
|
||||||
}
|
}
|
||||||
|
|
||||||
type ACAutomaton struct {
|
type ACAutomaton struct {
|
||||||
trie [][validCharCount]Edge
|
Trie [][validCharCount]Edge
|
||||||
fail []int
|
Fail []int
|
||||||
exists []MatchType
|
Exists []MatchType
|
||||||
count int
|
Count int
|
||||||
}
|
}
|
||||||
|
|
||||||
func newNode() [validCharCount]Edge {
|
func newNode() [validCharCount]Edge {
|
||||||
var s [validCharCount]Edge
|
var s [validCharCount]Edge
|
||||||
for i := range s {
|
for i := range s {
|
||||||
s[i] = Edge{
|
s[i] = Edge{
|
||||||
edgeType: FailEdge,
|
Type: FailEdge,
|
||||||
nextNode: 0,
|
NextNode: 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return s
|
return s
|
||||||
@@ -123,11 +123,11 @@ var char2Index = []int{
|
|||||||
|
|
||||||
func NewACAutomaton() *ACAutomaton {
|
func NewACAutomaton() *ACAutomaton {
|
||||||
ac := new(ACAutomaton)
|
ac := new(ACAutomaton)
|
||||||
ac.trie = append(ac.trie, newNode())
|
ac.Trie = append(ac.Trie, newNode())
|
||||||
ac.fail = append(ac.fail, 0)
|
ac.Fail = append(ac.Fail, 0)
|
||||||
ac.exists = append(ac.exists, MatchType{
|
ac.Exists = append(ac.Exists, MatchType{
|
||||||
matchType: Full,
|
Type: Full,
|
||||||
exist: false,
|
Exist: false,
|
||||||
})
|
})
|
||||||
return ac
|
return ac
|
||||||
}
|
}
|
||||||
@@ -136,53 +136,53 @@ func (ac *ACAutomaton) Add(domain string, t Type) {
|
|||||||
node := 0
|
node := 0
|
||||||
for i := len(domain) - 1; i >= 0; i-- {
|
for i := len(domain) - 1; i >= 0; i-- {
|
||||||
idx := char2Index[domain[i]]
|
idx := char2Index[domain[i]]
|
||||||
if ac.trie[node][idx].nextNode == 0 {
|
if ac.Trie[node][idx].NextNode == 0 {
|
||||||
ac.count++
|
ac.Count++
|
||||||
if len(ac.trie) < ac.count+1 {
|
if len(ac.Trie) < ac.Count+1 {
|
||||||
ac.trie = append(ac.trie, newNode())
|
ac.Trie = append(ac.Trie, newNode())
|
||||||
ac.fail = append(ac.fail, 0)
|
ac.Fail = append(ac.Fail, 0)
|
||||||
ac.exists = append(ac.exists, MatchType{
|
ac.Exists = append(ac.Exists, MatchType{
|
||||||
matchType: Full,
|
Type: Full,
|
||||||
exist: false,
|
Exist: false,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
ac.trie[node][idx] = Edge{
|
ac.Trie[node][idx] = Edge{
|
||||||
edgeType: TrieEdge,
|
Type: TrieEdge,
|
||||||
nextNode: ac.count,
|
NextNode: ac.Count,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
node = ac.trie[node][idx].nextNode
|
node = ac.Trie[node][idx].NextNode
|
||||||
}
|
}
|
||||||
ac.exists[node] = MatchType{
|
ac.Exists[node] = MatchType{
|
||||||
matchType: t,
|
Type: t,
|
||||||
exist: true,
|
Exist: true,
|
||||||
}
|
}
|
||||||
switch t {
|
switch t {
|
||||||
case Domain:
|
case Domain:
|
||||||
ac.exists[node] = MatchType{
|
ac.Exists[node] = MatchType{
|
||||||
matchType: Full,
|
Type: Full,
|
||||||
exist: true,
|
Exist: true,
|
||||||
}
|
}
|
||||||
idx := char2Index['.']
|
idx := char2Index['.']
|
||||||
if ac.trie[node][idx].nextNode == 0 {
|
if ac.Trie[node][idx].NextNode == 0 {
|
||||||
ac.count++
|
ac.Count++
|
||||||
if len(ac.trie) < ac.count+1 {
|
if len(ac.Trie) < ac.Count+1 {
|
||||||
ac.trie = append(ac.trie, newNode())
|
ac.Trie = append(ac.Trie, newNode())
|
||||||
ac.fail = append(ac.fail, 0)
|
ac.Fail = append(ac.Fail, 0)
|
||||||
ac.exists = append(ac.exists, MatchType{
|
ac.Exists = append(ac.Exists, MatchType{
|
||||||
matchType: Full,
|
Type: Full,
|
||||||
exist: false,
|
Exist: false,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
ac.trie[node][idx] = Edge{
|
ac.Trie[node][idx] = Edge{
|
||||||
edgeType: TrieEdge,
|
Type: TrieEdge,
|
||||||
nextNode: ac.count,
|
NextNode: ac.Count,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
node = ac.trie[node][idx].nextNode
|
node = ac.Trie[node][idx].NextNode
|
||||||
ac.exists[node] = MatchType{
|
ac.Exists[node] = MatchType{
|
||||||
matchType: t,
|
Type: t,
|
||||||
exist: true,
|
Exist: true,
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
@@ -192,8 +192,8 @@ func (ac *ACAutomaton) Add(domain string, t Type) {
|
|||||||
func (ac *ACAutomaton) Build() {
|
func (ac *ACAutomaton) Build() {
|
||||||
queue := list.New()
|
queue := list.New()
|
||||||
for i := 0; i < validCharCount; i++ {
|
for i := 0; i < validCharCount; i++ {
|
||||||
if ac.trie[0][i].nextNode != 0 {
|
if ac.Trie[0][i].NextNode != 0 {
|
||||||
queue.PushBack(ac.trie[0][i])
|
queue.PushBack(ac.Trie[0][i])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for {
|
for {
|
||||||
@@ -201,16 +201,16 @@ func (ac *ACAutomaton) Build() {
|
|||||||
if front == nil {
|
if front == nil {
|
||||||
break
|
break
|
||||||
} else {
|
} else {
|
||||||
node := front.Value.(Edge).nextNode
|
node := front.Value.(Edge).NextNode
|
||||||
queue.Remove(front)
|
queue.Remove(front)
|
||||||
for i := 0; i < validCharCount; i++ {
|
for i := 0; i < validCharCount; i++ {
|
||||||
if ac.trie[node][i].nextNode != 0 {
|
if ac.Trie[node][i].NextNode != 0 {
|
||||||
ac.fail[ac.trie[node][i].nextNode] = ac.trie[ac.fail[node]][i].nextNode
|
ac.Fail[ac.Trie[node][i].NextNode] = ac.Trie[ac.Fail[node]][i].NextNode
|
||||||
queue.PushBack(ac.trie[node][i])
|
queue.PushBack(ac.Trie[node][i])
|
||||||
} else {
|
} else {
|
||||||
ac.trie[node][i] = Edge{
|
ac.Trie[node][i] = Edge{
|
||||||
edgeType: FailEdge,
|
Type: FailEdge,
|
||||||
nextNode: ac.trie[ac.fail[node]][i].nextNode,
|
NextNode: ac.Trie[ac.Fail[node]][i].NextNode,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -230,9 +230,9 @@ func (ac *ACAutomaton) Match(s string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
idx := char2Index[chr]
|
idx := char2Index[chr]
|
||||||
fullMatch = fullMatch && ac.trie[node][idx].edgeType
|
fullMatch = fullMatch && ac.Trie[node][idx].Type
|
||||||
node = ac.trie[node][idx].nextNode
|
node = ac.Trie[node][idx].NextNode
|
||||||
switch ac.exists[node].matchType {
|
switch ac.Exists[node].Type {
|
||||||
case Substr:
|
case Substr:
|
||||||
return true
|
return true
|
||||||
case Domain:
|
case Domain:
|
||||||
@@ -243,5 +243,5 @@ func (ac *ACAutomaton) Match(s string) bool {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return fullMatch && ac.exists[node].exist
|
return fullMatch && ac.Exists[node].Exist
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,14 +39,18 @@ func (m domainMatcher) String() string {
|
|||||||
return "domain:" + string(m)
|
return "domain:" + string(m)
|
||||||
}
|
}
|
||||||
|
|
||||||
type regexMatcher struct {
|
type RegexMatcher struct {
|
||||||
pattern *regexp.Regexp
|
Pattern string
|
||||||
|
reg *regexp.Regexp
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *regexMatcher) Match(s string) bool {
|
func (m *RegexMatcher) Match(s string) bool {
|
||||||
return m.pattern.MatchString(s)
|
if m.reg == nil {
|
||||||
|
m.reg = regexp.MustCompile(m.Pattern)
|
||||||
|
}
|
||||||
|
return m.reg.MatchString(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *regexMatcher) String() string {
|
func (m *RegexMatcher) String() string {
|
||||||
return "regexp:" + m.pattern.String()
|
return "regexp:" + m.Pattern
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,40 +25,40 @@ func RollingHash(s string) uint32 {
|
|||||||
// 2. `substr` patterns are matched by ac automaton;
|
// 2. `substr` patterns are matched by ac automaton;
|
||||||
// 3. `regex` patterns are matched with the regex library.
|
// 3. `regex` patterns are matched with the regex library.
|
||||||
type MphMatcherGroup struct {
|
type MphMatcherGroup struct {
|
||||||
ac *ACAutomaton
|
Ac *ACAutomaton
|
||||||
otherMatchers []matcherEntry
|
OtherMatchers []MatcherEntry
|
||||||
rules []string
|
Rules []string
|
||||||
level0 []uint32
|
Level0 []uint32
|
||||||
level0Mask int
|
Level0Mask int
|
||||||
level1 []uint32
|
Level1 []uint32
|
||||||
level1Mask int
|
Level1Mask int
|
||||||
count uint32
|
Count uint32
|
||||||
ruleMap *map[string]uint32
|
RuleMap *map[string]uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *MphMatcherGroup) AddFullOrDomainPattern(pattern string, t Type) {
|
func (g *MphMatcherGroup) AddFullOrDomainPattern(pattern string, t Type) {
|
||||||
h := RollingHash(pattern)
|
h := RollingHash(pattern)
|
||||||
switch t {
|
switch t {
|
||||||
case Domain:
|
case Domain:
|
||||||
(*g.ruleMap)["."+pattern] = h*PrimeRK + uint32('.')
|
(*g.RuleMap)["."+pattern] = h*PrimeRK + uint32('.')
|
||||||
fallthrough
|
fallthrough
|
||||||
case Full:
|
case Full:
|
||||||
(*g.ruleMap)[pattern] = h
|
(*g.RuleMap)[pattern] = h
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewMphMatcherGroup() *MphMatcherGroup {
|
func NewMphMatcherGroup() *MphMatcherGroup {
|
||||||
return &MphMatcherGroup{
|
return &MphMatcherGroup{
|
||||||
ac: nil,
|
Ac: nil,
|
||||||
otherMatchers: nil,
|
OtherMatchers: nil,
|
||||||
rules: nil,
|
Rules: nil,
|
||||||
level0: nil,
|
Level0: nil,
|
||||||
level0Mask: 0,
|
Level0Mask: 0,
|
||||||
level1: nil,
|
Level1: nil,
|
||||||
level1Mask: 0,
|
Level1Mask: 0,
|
||||||
count: 1,
|
Count: 1,
|
||||||
ruleMap: &map[string]uint32{},
|
RuleMap: &map[string]uint32{},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,10 +66,10 @@ func NewMphMatcherGroup() *MphMatcherGroup {
|
|||||||
func (g *MphMatcherGroup) AddPattern(pattern string, t Type) (uint32, error) {
|
func (g *MphMatcherGroup) AddPattern(pattern string, t Type) (uint32, error) {
|
||||||
switch t {
|
switch t {
|
||||||
case Substr:
|
case Substr:
|
||||||
if g.ac == nil {
|
if g.Ac == nil {
|
||||||
g.ac = NewACAutomaton()
|
g.Ac = NewACAutomaton()
|
||||||
}
|
}
|
||||||
g.ac.Add(pattern, t)
|
g.Ac.Add(pattern, t)
|
||||||
case Full, Domain:
|
case Full, Domain:
|
||||||
pattern = strings.ToLower(pattern)
|
pattern = strings.ToLower(pattern)
|
||||||
g.AddFullOrDomainPattern(pattern, t)
|
g.AddFullOrDomainPattern(pattern, t)
|
||||||
@@ -78,39 +78,39 @@ func (g *MphMatcherGroup) AddPattern(pattern string, t Type) (uint32, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
g.otherMatchers = append(g.otherMatchers, matcherEntry{
|
g.OtherMatchers = append(g.OtherMatchers, MatcherEntry{
|
||||||
m: ®exMatcher{pattern: r},
|
M: &RegexMatcher{Pattern: pattern, reg: r},
|
||||||
id: g.count,
|
Id: g.Count,
|
||||||
})
|
})
|
||||||
default:
|
default:
|
||||||
panic("Unknown type")
|
panic("Unknown type")
|
||||||
}
|
}
|
||||||
return g.count, nil
|
return g.Count, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build builds a minimal perfect hash table and ac automaton from insert rules
|
// Build builds a minimal perfect hash table and ac automaton from insert rules
|
||||||
func (g *MphMatcherGroup) Build() {
|
func (g *MphMatcherGroup) Build() {
|
||||||
if g.ac != nil {
|
if g.Ac != nil {
|
||||||
g.ac.Build()
|
g.Ac.Build()
|
||||||
}
|
}
|
||||||
keyLen := len(*g.ruleMap)
|
keyLen := len(*g.RuleMap)
|
||||||
if keyLen == 0 {
|
if keyLen == 0 {
|
||||||
keyLen = 1
|
keyLen = 1
|
||||||
(*g.ruleMap)["empty___"] = RollingHash("empty___")
|
(*g.RuleMap)["empty___"] = RollingHash("empty___")
|
||||||
}
|
}
|
||||||
g.level0 = make([]uint32, nextPow2(keyLen/4))
|
g.Level0 = make([]uint32, nextPow2(keyLen/4))
|
||||||
g.level0Mask = len(g.level0) - 1
|
g.Level0Mask = len(g.Level0) - 1
|
||||||
g.level1 = make([]uint32, nextPow2(keyLen))
|
g.Level1 = make([]uint32, nextPow2(keyLen))
|
||||||
g.level1Mask = len(g.level1) - 1
|
g.Level1Mask = len(g.Level1) - 1
|
||||||
sparseBuckets := make([][]int, len(g.level0))
|
sparseBuckets := make([][]int, len(g.Level0))
|
||||||
var ruleIdx int
|
var ruleIdx int
|
||||||
for rule, hash := range *g.ruleMap {
|
for rule, hash := range *g.RuleMap {
|
||||||
n := int(hash) & g.level0Mask
|
n := int(hash) & g.Level0Mask
|
||||||
g.rules = append(g.rules, rule)
|
g.Rules = append(g.Rules, rule)
|
||||||
sparseBuckets[n] = append(sparseBuckets[n], ruleIdx)
|
sparseBuckets[n] = append(sparseBuckets[n], ruleIdx)
|
||||||
ruleIdx++
|
ruleIdx++
|
||||||
}
|
}
|
||||||
g.ruleMap = nil
|
g.RuleMap = nil
|
||||||
var buckets []indexBucket
|
var buckets []indexBucket
|
||||||
for n, vals := range sparseBuckets {
|
for n, vals := range sparseBuckets {
|
||||||
if len(vals) > 0 {
|
if len(vals) > 0 {
|
||||||
@@ -119,7 +119,7 @@ func (g *MphMatcherGroup) Build() {
|
|||||||
}
|
}
|
||||||
sort.Sort(bySize(buckets))
|
sort.Sort(bySize(buckets))
|
||||||
|
|
||||||
occ := make([]bool, len(g.level1))
|
occ := make([]bool, len(g.Level1))
|
||||||
var tmpOcc []int
|
var tmpOcc []int
|
||||||
for _, bucket := range buckets {
|
for _, bucket := range buckets {
|
||||||
seed := uint32(0)
|
seed := uint32(0)
|
||||||
@@ -127,7 +127,7 @@ func (g *MphMatcherGroup) Build() {
|
|||||||
findSeed := true
|
findSeed := true
|
||||||
tmpOcc = tmpOcc[:0]
|
tmpOcc = tmpOcc[:0]
|
||||||
for _, i := range bucket.vals {
|
for _, i := range bucket.vals {
|
||||||
n := int(strhashFallback(unsafe.Pointer(&g.rules[i]), uintptr(seed))) & g.level1Mask
|
n := int(strhashFallback(unsafe.Pointer(&g.Rules[i]), uintptr(seed))) & g.Level1Mask
|
||||||
if occ[n] {
|
if occ[n] {
|
||||||
for _, n := range tmpOcc {
|
for _, n := range tmpOcc {
|
||||||
occ[n] = false
|
occ[n] = false
|
||||||
@@ -138,10 +138,10 @@ func (g *MphMatcherGroup) Build() {
|
|||||||
}
|
}
|
||||||
occ[n] = true
|
occ[n] = true
|
||||||
tmpOcc = append(tmpOcc, n)
|
tmpOcc = append(tmpOcc, n)
|
||||||
g.level1[n] = uint32(i)
|
g.Level1[n] = uint32(i)
|
||||||
}
|
}
|
||||||
if findSeed {
|
if findSeed {
|
||||||
g.level0[bucket.n] = seed
|
g.Level0[bucket.n] = seed
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -159,11 +159,11 @@ func nextPow2(v int) int {
|
|||||||
|
|
||||||
// Lookup searches for s in t and returns its index and whether it was found.
|
// Lookup searches for s in t and returns its index and whether it was found.
|
||||||
func (g *MphMatcherGroup) Lookup(h uint32, s string) bool {
|
func (g *MphMatcherGroup) Lookup(h uint32, s string) bool {
|
||||||
i0 := int(h) & g.level0Mask
|
i0 := int(h) & g.Level0Mask
|
||||||
seed := g.level0[i0]
|
seed := g.Level0[i0]
|
||||||
i1 := int(strhashFallback(unsafe.Pointer(&s), uintptr(seed))) & g.level1Mask
|
i1 := int(strhashFallback(unsafe.Pointer(&s), uintptr(seed))) & g.Level1Mask
|
||||||
n := g.level1[i1]
|
n := g.Level1[i1]
|
||||||
return s == g.rules[int(n)]
|
return s == g.Rules[int(n)]
|
||||||
}
|
}
|
||||||
|
|
||||||
// Match implements IndexMatcher.Match.
|
// Match implements IndexMatcher.Match.
|
||||||
@@ -183,13 +183,13 @@ func (g *MphMatcherGroup) Match(pattern string) []uint32 {
|
|||||||
result = append(result, 1)
|
result = append(result, 1)
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
if g.ac != nil && g.ac.Match(pattern) {
|
if g.Ac != nil && g.Ac.Match(pattern) {
|
||||||
result = append(result, 1)
|
result = append(result, 1)
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
for _, e := range g.otherMatchers {
|
for _, e := range g.OtherMatchers {
|
||||||
if e.m.Match(pattern) {
|
if e.M.Match(pattern) {
|
||||||
result = append(result, e.id)
|
result = append(result, e.Id)
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -302,3 +302,7 @@ func readUnaligned64(p unsafe.Pointer) uint64 {
|
|||||||
q := (*[8]byte)(p)
|
q := (*[8]byte)(p)
|
||||||
return uint64(q[0]) | uint64(q[1])<<8 | uint64(q[2])<<16 | uint64(q[3])<<24 | uint64(q[4])<<32 | uint64(q[5])<<40 | uint64(q[6])<<48 | uint64(q[7])<<56
|
return uint64(q[0]) | uint64(q[1])<<8 | uint64(q[2])<<16 | uint64(q[3])<<24 | uint64(q[4])<<32 | uint64(q[5])<<40 | uint64(q[6])<<48 | uint64(q[7])<<56
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (g *MphMatcherGroup) Size() uint32 {
|
||||||
|
return g.Count
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package strmatcher
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"encoding/gob"
|
||||||
|
"io"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
gob.Register(&RegexMatcher{})
|
||||||
|
gob.Register(fullMatcher(""))
|
||||||
|
gob.Register(substrMatcher(""))
|
||||||
|
gob.Register(domainMatcher(""))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *MphMatcherGroup) Serialize(w io.Writer) error {
|
||||||
|
data := MphMatcherGroup{
|
||||||
|
Ac: g.Ac,
|
||||||
|
OtherMatchers: g.OtherMatchers,
|
||||||
|
Rules: g.Rules,
|
||||||
|
Level0: g.Level0,
|
||||||
|
Level0Mask: g.Level0Mask,
|
||||||
|
Level1: g.Level1,
|
||||||
|
Level1Mask: g.Level1Mask,
|
||||||
|
Count: g.Count,
|
||||||
|
}
|
||||||
|
return gob.NewEncoder(w).Encode(data)
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewMphMatcherGroupFromBuffer(data []byte) (*MphMatcherGroup, error) {
|
||||||
|
var gData MphMatcherGroup
|
||||||
|
if err := gob.NewDecoder(bytes.NewReader(data)).Decode(&gData); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
g := NewMphMatcherGroup()
|
||||||
|
g.Ac = gData.Ac
|
||||||
|
g.OtherMatchers = gData.OtherMatchers
|
||||||
|
g.Rules = gData.Rules
|
||||||
|
g.Level0 = gData.Level0
|
||||||
|
g.Level0Mask = gData.Level0Mask
|
||||||
|
g.Level1 = gData.Level1
|
||||||
|
g.Level1Mask = gData.Level1Mask
|
||||||
|
g.Count = gData.Count
|
||||||
|
|
||||||
|
return g, nil
|
||||||
|
}
|
||||||
@@ -41,8 +41,9 @@ func (t Type) New(pattern string) (Matcher, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return ®exMatcher{
|
return &RegexMatcher{
|
||||||
pattern: r,
|
Pattern: pattern,
|
||||||
|
reg: r,
|
||||||
}, nil
|
}, nil
|
||||||
default:
|
default:
|
||||||
return nil, errors.New("unk type")
|
return nil, errors.New("unk type")
|
||||||
@@ -53,11 +54,13 @@ func (t Type) New(pattern string) (Matcher, error) {
|
|||||||
type IndexMatcher interface {
|
type IndexMatcher interface {
|
||||||
// Match returns the index of a matcher that matches the input. It returns empty array if no such matcher exists.
|
// Match returns the index of a matcher that matches the input. It returns empty array if no such matcher exists.
|
||||||
Match(input string) []uint32
|
Match(input string) []uint32
|
||||||
|
// Size returns the number of matchers in the group.
|
||||||
|
Size() uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
type matcherEntry struct {
|
type MatcherEntry struct {
|
||||||
m Matcher
|
M Matcher
|
||||||
id uint32
|
Id uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
// MatcherGroup is an implementation of IndexMatcher.
|
// MatcherGroup is an implementation of IndexMatcher.
|
||||||
@@ -66,7 +69,7 @@ type MatcherGroup struct {
|
|||||||
count uint32
|
count uint32
|
||||||
fullMatcher FullMatcherGroup
|
fullMatcher FullMatcherGroup
|
||||||
domainMatcher DomainMatcherGroup
|
domainMatcher DomainMatcherGroup
|
||||||
otherMatchers []matcherEntry
|
otherMatchers []MatcherEntry
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add adds a new Matcher into the MatcherGroup, and returns its index. The index will never be 0.
|
// Add adds a new Matcher into the MatcherGroup, and returns its index. The index will never be 0.
|
||||||
@@ -80,9 +83,9 @@ func (g *MatcherGroup) Add(m Matcher) uint32 {
|
|||||||
case domainMatcher:
|
case domainMatcher:
|
||||||
g.domainMatcher.addMatcher(tm, c)
|
g.domainMatcher.addMatcher(tm, c)
|
||||||
default:
|
default:
|
||||||
g.otherMatchers = append(g.otherMatchers, matcherEntry{
|
g.otherMatchers = append(g.otherMatchers, MatcherEntry{
|
||||||
m: m,
|
M: m,
|
||||||
id: c,
|
Id: c,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,8 +98,8 @@ func (g *MatcherGroup) Match(pattern string) []uint32 {
|
|||||||
result = append(result, g.fullMatcher.Match(pattern)...)
|
result = append(result, g.fullMatcher.Match(pattern)...)
|
||||||
result = append(result, g.domainMatcher.Match(pattern)...)
|
result = append(result, g.domainMatcher.Match(pattern)...)
|
||||||
for _, e := range g.otherMatchers {
|
for _, e := range g.otherMatchers {
|
||||||
if e.m.Match(pattern) {
|
if e.M.Match(pattern) {
|
||||||
result = append(result, e.id)
|
result = append(result, e.Id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
@@ -106,3 +109,33 @@ func (g *MatcherGroup) Match(pattern string) []uint32 {
|
|||||||
func (g *MatcherGroup) Size() uint32 {
|
func (g *MatcherGroup) Size() uint32 {
|
||||||
return g.count
|
return g.count
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type IndexMatcherGroup struct {
|
||||||
|
Matchers []IndexMatcher
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *IndexMatcherGroup) Match(input string) []uint32 {
|
||||||
|
var offset uint32
|
||||||
|
for _, m := range g.Matchers {
|
||||||
|
if res := m.Match(input); len(res) > 0 {
|
||||||
|
if offset == 0 {
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
shifted := make([]uint32, len(res))
|
||||||
|
for i, id := range res {
|
||||||
|
shifted[i] = id + offset
|
||||||
|
}
|
||||||
|
return shifted
|
||||||
|
}
|
||||||
|
offset += m.Size()
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *IndexMatcherGroup) Size() uint32 {
|
||||||
|
var count uint32
|
||||||
|
for _, m := range g.Matchers {
|
||||||
|
count += m.Size()
|
||||||
|
}
|
||||||
|
return count
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package utils
|
||||||
|
|
||||||
|
import (
|
||||||
|
"reflect"
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
|
// AccessField can used to access unexported field of a struct
|
||||||
|
// valueType must be the exact type of the field or it will panic
|
||||||
|
func AccessField[valueType any](obj any, fieldName string) *valueType {
|
||||||
|
field := reflect.ValueOf(obj).Elem().FieldByName(fieldName)
|
||||||
|
if field.Type() != reflect.TypeOf(*new(valueType)) {
|
||||||
|
panic("field type: " + field.Type().String() + ", valueType: " + reflect.TypeOf(*new(valueType)).String())
|
||||||
|
}
|
||||||
|
v := (*valueType)(unsafe.Pointer(field.UnsafeAddr()))
|
||||||
|
return v
|
||||||
|
}
|
||||||
@@ -0,0 +1,191 @@
|
|||||||
|
package utils
|
||||||
|
|
||||||
|
import (
|
||||||
|
"math/rand"
|
||||||
|
"strconv"
|
||||||
|
"time"
|
||||||
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/klauspost/cpuid/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
func ChromeVersion() int {
|
||||||
|
// Use only CPU info as seed for PRNG
|
||||||
|
seed := int64(cpuid.CPU.Family + cpuid.CPU.Model + cpuid.CPU.PhysicalCores + cpuid.CPU.LogicalCores + cpuid.CPU.CacheLine)
|
||||||
|
rng := rand.New(rand.NewSource(seed))
|
||||||
|
// Start from Chrome 144 released on 2026.1.13
|
||||||
|
releaseDate := time.Date(2026, 1, 13, 0, 0, 0, 0, time.UTC)
|
||||||
|
version := 144
|
||||||
|
now := time.Now()
|
||||||
|
// Each version has random 25-45 day interval
|
||||||
|
for releaseDate.Before(now) {
|
||||||
|
releaseDate = releaseDate.AddDate(0, 0, rng.Intn(21)+25)
|
||||||
|
version++
|
||||||
|
}
|
||||||
|
return version - 1
|
||||||
|
}
|
||||||
|
|
||||||
|
// The full Chromium brand GREASE implementation
|
||||||
|
var clientHintGreaseNA = []string{" ", "(", ":", "-", ".", "/", ")", ";", "=", "?", "_"}
|
||||||
|
var clientHintVersionNA = []string{"8", "99", "24"}
|
||||||
|
var clientHintShuffle3 = [][3]int{{0, 1, 2}, {0, 2, 1}, {1, 0, 2}, {1, 2, 0}, {2, 0, 1}, {2, 1, 0}}
|
||||||
|
var clientHintShuffle4 = [][4]int{
|
||||||
|
{0, 1, 2, 3}, {0, 1, 3, 2}, {0, 2, 1, 3}, {0, 2, 3, 1}, {0, 3, 1, 2}, {0, 3, 2, 1},
|
||||||
|
{1, 0, 2, 3}, {1, 0, 3, 2}, {1, 2, 0, 3}, {1, 2, 3, 0}, {1, 3, 0, 2}, {1, 3, 2, 0},
|
||||||
|
{2, 0, 1, 3}, {2, 0, 3, 1}, {2, 1, 0, 3}, {2, 1, 3, 0}, {2, 3, 0, 1}, {2, 3, 1, 0},
|
||||||
|
{3, 0, 1, 2}, {3, 0, 2, 1}, {3, 1, 0, 2}, {3, 1, 2, 0}, {3, 2, 0, 1}, {3, 2, 1, 0}}
|
||||||
|
func getGreasedChInvalidBrand(seed int) string {
|
||||||
|
return "\"Not" + clientHintGreaseNA[seed % len(clientHintGreaseNA)] + "A" + clientHintGreaseNA[(seed + 1) % len(clientHintGreaseNA)] + "Brand\";v=\"" + clientHintVersionNA[seed % len(clientHintVersionNA)] + "\"";
|
||||||
|
}
|
||||||
|
func getGreasedChOrder(brandLength int, seed int) []int {
|
||||||
|
switch brandLength {
|
||||||
|
case 1:
|
||||||
|
return []int{0}
|
||||||
|
case 2:
|
||||||
|
return []int{seed % brandLength, (seed + 1) % brandLength}
|
||||||
|
case 3:
|
||||||
|
return clientHintShuffle3[seed % len(clientHintShuffle3)][:]
|
||||||
|
default:
|
||||||
|
return clientHintShuffle4[seed % len(clientHintShuffle4)][:]
|
||||||
|
}
|
||||||
|
return []int{}
|
||||||
|
}
|
||||||
|
func getUngreasedChUa(majorVersion int, forkName string) []string {
|
||||||
|
// Set the capacity to 4, the maximum allowed brand size, so Go will never allocate memory twice
|
||||||
|
baseChUa := make([]string, 0, 4)
|
||||||
|
baseChUa = append(baseChUa, getGreasedChInvalidBrand(majorVersion),
|
||||||
|
"\"Chromium\";v=\"" + strconv.Itoa(majorVersion) + "\"")
|
||||||
|
switch forkName {
|
||||||
|
case "chrome":
|
||||||
|
baseChUa = append(baseChUa, "\"Google Chrome\";v=\"" + strconv.Itoa(majorVersion) + "\"")
|
||||||
|
case "edge":
|
||||||
|
baseChUa = append(baseChUa, "\"Microsoft Edge\";v=\"" + strconv.Itoa(majorVersion) + "\"")
|
||||||
|
}
|
||||||
|
return baseChUa
|
||||||
|
}
|
||||||
|
func getGreasedChUa(majorVersion int, forkName string) string {
|
||||||
|
ungreasedCh := getUngreasedChUa(majorVersion, forkName)
|
||||||
|
shuffleMap := getGreasedChOrder(len(ungreasedCh), majorVersion)
|
||||||
|
shuffledCh := make([]string, len(ungreasedCh))
|
||||||
|
for i, e := range shuffleMap {
|
||||||
|
shuffledCh[e] = ungreasedCh[i]
|
||||||
|
}
|
||||||
|
return strings.Join(shuffledCh, ", ")
|
||||||
|
}
|
||||||
|
|
||||||
|
// It's better to pin on Firefox ESR releases, and there could be a Firefox ESR version generator later.
|
||||||
|
// However, if the Firefox fingerprint in uTLS doesn't have its update cadence match that of Firefox ESR, then it's better to update the Firefox version manually instead every time a new major ESR release is available.
|
||||||
|
var FirefoxUA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0"
|
||||||
|
|
||||||
|
// The code below provides a coherent default browser user agent string based on a CPU-seeded PRNG.
|
||||||
|
var AnchoredChromeVersion = ChromeVersion()
|
||||||
|
var ChromeUA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/" + strconv.Itoa(AnchoredChromeVersion) + ".0.0.0 Safari/537.36"
|
||||||
|
var ChromeUACH = getGreasedChUa(AnchoredChromeVersion, "chrome")
|
||||||
|
var MSEdgeUA = ChromeUA + "Edg/" + strconv.Itoa(AnchoredChromeVersion) + ".0.0.0"
|
||||||
|
var MSEdgeUACH = getGreasedChUa(AnchoredChromeVersion, "edge")
|
||||||
|
|
||||||
|
func applyMasqueradedHeaders(header http.Header, browser string, variant string) {
|
||||||
|
// Browser-specific.
|
||||||
|
switch browser {
|
||||||
|
case "chrome":
|
||||||
|
header["Sec-CH-UA"] = []string{ChromeUACH}
|
||||||
|
header["Sec-CH-UA-Mobile"] = []string{"?0"}
|
||||||
|
header["Sec-CH-UA-Platform"] = []string{"\"Windows\""}
|
||||||
|
header["DNT"] = []string{"1"}
|
||||||
|
header.Set("User-Agent", ChromeUA)
|
||||||
|
header.Set("Accept-Language", "en-US,en;q=0.9")
|
||||||
|
case "edge":
|
||||||
|
header["Sec-CH-UA"] = []string{MSEdgeUACH}
|
||||||
|
header["Sec-CH-UA-Mobile"] = []string{"?0"}
|
||||||
|
header["Sec-CH-UA-Platform"] = []string{"\"Windows\""}
|
||||||
|
header["DNT"] = []string{"1"}
|
||||||
|
header.Set("User-Agent", MSEdgeUA)
|
||||||
|
header.Set("Accept-Language", "en-US,en;q=0.9")
|
||||||
|
case "firefox":
|
||||||
|
header.Set("User-Agent", FirefoxUA)
|
||||||
|
header["DNT"] = []string{"1"}
|
||||||
|
header.Set("Accept-Language", "en-US,en;q=0.5")
|
||||||
|
case "golang":
|
||||||
|
// Expose the default net/http header.
|
||||||
|
header.Del("User-Agent")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// Context-specific.
|
||||||
|
switch variant {
|
||||||
|
case "nav":
|
||||||
|
if header.Get("Cache-Control") == "" {
|
||||||
|
switch browser {
|
||||||
|
case "chrome", "edge":
|
||||||
|
header.Set("Cache-Control", "max-age=0")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
header.Set("Upgrade-Insecure-Requests", "1")
|
||||||
|
if header.Get("Accept") == "" {
|
||||||
|
switch browser {
|
||||||
|
case "chrome", "edge":
|
||||||
|
header.Set("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/jxl,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7")
|
||||||
|
case "firefox":
|
||||||
|
header.Set("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
header.Set("Sec-Fetch-Site", "none")
|
||||||
|
header.Set("Sec-Fetch-Mode", "navigate")
|
||||||
|
header.Set("Sec-Fetch-User", "?1")
|
||||||
|
header.Set("Sec-Fetch-Dest", "document")
|
||||||
|
header.Set("Priority", "u=0, i")
|
||||||
|
case "ws":
|
||||||
|
header.Set("Sec-Fetch-Mode", "websocket")
|
||||||
|
header.Set("Sec-Fetch-Dest", "empty")
|
||||||
|
header.Set("Sec-Fetch-Site", "same-origin")
|
||||||
|
if header.Get("Cache-Control") == "" {
|
||||||
|
header.Set("Cache-Control", "no-cache")
|
||||||
|
}
|
||||||
|
if header.Get("Pragma") == "" {
|
||||||
|
header.Set("Pragma", "no-cache")
|
||||||
|
}
|
||||||
|
if header.Get("Accept") == "" {
|
||||||
|
header.Set("Accept", "*/*")
|
||||||
|
}
|
||||||
|
case "fetch":
|
||||||
|
header.Set("Sec-Fetch-Mode", "cors")
|
||||||
|
header.Set("Sec-Fetch-Dest", "empty")
|
||||||
|
header.Set("Sec-Fetch-Site", "same-origin")
|
||||||
|
if header.Get("Priority") == "" {
|
||||||
|
switch browser {
|
||||||
|
case "chrome", "edge":
|
||||||
|
header.Set("Priority", "u=1, i")
|
||||||
|
case "firefox":
|
||||||
|
header.Set("Priority", "u=4")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if header.Get("Cache-Control") == "" {
|
||||||
|
header.Set("Cache-Control", "no-cache")
|
||||||
|
}
|
||||||
|
if header.Get("Pragma") == "" {
|
||||||
|
header.Set("Pragma", "no-cache")
|
||||||
|
}
|
||||||
|
if header.Get("Accept") == "" {
|
||||||
|
header.Set("Accept", "*/*")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TryDefaultHeadersWith(header http.Header, variant string) {
|
||||||
|
// The global UA special value handler for transports. Used to be called HandleTransportUASettings.
|
||||||
|
// Just a FYI to whoever needing to fix this piece of code after some spontaneous event, I tried to make the two methods separate to let the code be cleaner and more organized.
|
||||||
|
if len(header.Values("User-Agent")) < 1 {
|
||||||
|
applyMasqueradedHeaders(header, "chrome", variant)
|
||||||
|
} else {
|
||||||
|
switch header.Get("User-Agent") {
|
||||||
|
case "chrome":
|
||||||
|
applyMasqueradedHeaders(header, "chrome", variant)
|
||||||
|
case "firefox":
|
||||||
|
applyMasqueradedHeaders(header, "firefox", variant)
|
||||||
|
case "edge":
|
||||||
|
applyMasqueradedHeaders(header, "edge", variant)
|
||||||
|
case "golang":
|
||||||
|
applyMasqueradedHeaders(header, "golang", variant)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package utils
|
||||||
|
|
||||||
|
import (
|
||||||
|
"math/rand/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
// 8 ÷ (397/62)
|
||||||
|
h2packCorrectionFactor = 1.2493702770780857
|
||||||
|
base62TotalCharsNum = 62
|
||||||
|
base62Chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
|
||||||
|
)
|
||||||
|
|
||||||
|
// H2Base62Pad generates a base62 padding string for HTTP/2 header
|
||||||
|
// The total len will be slightly longer than the input to match the length after h2(h3 also) header huffman encoding
|
||||||
|
func H2Base62Pad[T int32 | int64 | int](expectedLen T) string {
|
||||||
|
actualLenFloat := float64(expectedLen) * h2packCorrectionFactor
|
||||||
|
actualLen := int(actualLenFloat)
|
||||||
|
result := make([]byte, actualLen)
|
||||||
|
for i := range actualLen {
|
||||||
|
result[i] = base62Chars[rand.N(base62TotalCharsNum)]
|
||||||
|
}
|
||||||
|
return string(result)
|
||||||
|
}
|
||||||
+2
-1
@@ -35,6 +35,7 @@ func init() {
|
|||||||
if strings.ToLower(platform.NewEnvFlag(platform.XUDPLog).GetValue(func() string { return "" })) == "true" {
|
if strings.ToLower(platform.NewEnvFlag(platform.XUDPLog).GetValue(func() string { return "" })) == "true" {
|
||||||
Show = true
|
Show = true
|
||||||
}
|
}
|
||||||
|
BaseKey = make([]byte, 32)
|
||||||
rand.Read(BaseKey)
|
rand.Read(BaseKey)
|
||||||
go func() {
|
go func() {
|
||||||
time.Sleep(100 * time.Millisecond) // this is not nice, but need to give some time for Android to setup ENV
|
time.Sleep(100 * time.Millisecond) // this is not nice, but need to give some time for Android to setup ENV
|
||||||
@@ -52,7 +53,7 @@ func GetGlobalID(ctx context.Context) (globalID [8]byte) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if inbound := session.InboundFromContext(ctx); inbound != nil && inbound.Source.Network == net.Network_UDP &&
|
if inbound := session.InboundFromContext(ctx); inbound != nil && inbound.Source.Network == net.Network_UDP &&
|
||||||
(inbound.Name == "dokodemo-door" || inbound.Name == "socks" || inbound.Name == "shadowsocks") {
|
(inbound.Name == "dokodemo-door" || inbound.Name == "socks" || inbound.Name == "shadowsocks" || inbound.Name == "tun") {
|
||||||
h := blake3.New(8, BaseKey)
|
h := blake3.New(8, BaseKey)
|
||||||
h.Write([]byte(inbound.Source.String()))
|
h.Write([]byte(inbound.Source.String()))
|
||||||
copy(globalID[:], h.Sum(nil))
|
copy(globalID[:], h.Sum(nil))
|
||||||
|
|||||||
+5
-1
@@ -64,7 +64,11 @@ func GetMergedConfig(args cmdarg.Arg) (string, error) {
|
|||||||
var files []*ConfigSource
|
var files []*ConfigSource
|
||||||
supported := []string{"json", "yaml", "toml"}
|
supported := []string{"json", "yaml", "toml"}
|
||||||
for _, file := range args {
|
for _, file := range args {
|
||||||
format := GetFormat(file)
|
format := "json"
|
||||||
|
if file != "stdin:" {
|
||||||
|
format = GetFormat(file)
|
||||||
|
}
|
||||||
|
|
||||||
if slices.Contains(supported, format) {
|
if slices.Contains(supported, format) {
|
||||||
files = append(files, &ConfigSource{
|
files = append(files, &ConfigSource{
|
||||||
Name: file,
|
Name: file,
|
||||||
|
|||||||
+36
-74
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.35.1
|
// protoc-gen-go v1.36.11
|
||||||
// protoc v5.28.2
|
// protoc v6.33.5
|
||||||
// source: core/config.proto
|
// source: core/config.proto
|
||||||
|
|
||||||
package core
|
package core
|
||||||
@@ -12,6 +12,7 @@ import (
|
|||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
sync "sync"
|
sync "sync"
|
||||||
|
unsafe "unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -24,10 +25,7 @@ const (
|
|||||||
// Config is the master config of Xray. Xray takes this config as input and
|
// Config is the master config of Xray. Xray takes this config as input and
|
||||||
// functions accordingly.
|
// functions accordingly.
|
||||||
type Config struct {
|
type Config struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
// Inbound handler configurations. Must have at least one item.
|
// Inbound handler configurations. Must have at least one item.
|
||||||
Inbound []*InboundHandlerConfig `protobuf:"bytes,1,rep,name=inbound,proto3" json:"inbound,omitempty"`
|
Inbound []*InboundHandlerConfig `protobuf:"bytes,1,rep,name=inbound,proto3" json:"inbound,omitempty"`
|
||||||
// Outbound handler configurations. Must have at least one item. The first
|
// Outbound handler configurations. Must have at least one item. The first
|
||||||
@@ -40,7 +38,9 @@ type Config struct {
|
|||||||
// Configuration for extensions. The config may not work if corresponding
|
// Configuration for extensions. The config may not work if corresponding
|
||||||
// extension is not loaded into Xray. Xray will ignore such config during
|
// extension is not loaded into Xray. Xray will ignore such config during
|
||||||
// initialization.
|
// initialization.
|
||||||
Extension []*serial.TypedMessage `protobuf:"bytes,6,rep,name=extension,proto3" json:"extension,omitempty"`
|
Extension []*serial.TypedMessage `protobuf:"bytes,6,rep,name=extension,proto3" json:"extension,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Config) Reset() {
|
func (x *Config) Reset() {
|
||||||
@@ -103,10 +103,7 @@ func (x *Config) GetExtension() []*serial.TypedMessage {
|
|||||||
|
|
||||||
// InboundHandlerConfig is the configuration for inbound handler.
|
// InboundHandlerConfig is the configuration for inbound handler.
|
||||||
type InboundHandlerConfig struct {
|
type InboundHandlerConfig struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
// Tag of the inbound handler. The tag must be unique among all inbound
|
// Tag of the inbound handler. The tag must be unique among all inbound
|
||||||
// handlers
|
// handlers
|
||||||
Tag string `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"`
|
Tag string `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"`
|
||||||
@@ -114,6 +111,8 @@ type InboundHandlerConfig struct {
|
|||||||
ReceiverSettings *serial.TypedMessage `protobuf:"bytes,2,opt,name=receiver_settings,json=receiverSettings,proto3" json:"receiver_settings,omitempty"`
|
ReceiverSettings *serial.TypedMessage `protobuf:"bytes,2,opt,name=receiver_settings,json=receiverSettings,proto3" json:"receiver_settings,omitempty"`
|
||||||
// Settings for inbound proxy. Must be one of the inbound proxies.
|
// Settings for inbound proxy. Must be one of the inbound proxies.
|
||||||
ProxySettings *serial.TypedMessage `protobuf:"bytes,3,opt,name=proxy_settings,json=proxySettings,proto3" json:"proxy_settings,omitempty"`
|
ProxySettings *serial.TypedMessage `protobuf:"bytes,3,opt,name=proxy_settings,json=proxySettings,proto3" json:"proxy_settings,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *InboundHandlerConfig) Reset() {
|
func (x *InboundHandlerConfig) Reset() {
|
||||||
@@ -169,10 +168,7 @@ func (x *InboundHandlerConfig) GetProxySettings() *serial.TypedMessage {
|
|||||||
|
|
||||||
// OutboundHandlerConfig is the configuration for outbound handler.
|
// OutboundHandlerConfig is the configuration for outbound handler.
|
||||||
type OutboundHandlerConfig struct {
|
type OutboundHandlerConfig struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
// Tag of this outbound handler.
|
// Tag of this outbound handler.
|
||||||
Tag string `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"`
|
Tag string `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"`
|
||||||
// Settings for how to dial connection for this outbound handler.
|
// Settings for how to dial connection for this outbound handler.
|
||||||
@@ -182,7 +178,9 @@ type OutboundHandlerConfig struct {
|
|||||||
// If not zero, this outbound will be expired in seconds. Not used for now.
|
// If not zero, this outbound will be expired in seconds. Not used for now.
|
||||||
Expire int64 `protobuf:"varint,4,opt,name=expire,proto3" json:"expire,omitempty"`
|
Expire int64 `protobuf:"varint,4,opt,name=expire,proto3" json:"expire,omitempty"`
|
||||||
// Comment of this outbound handler. Not used for now.
|
// Comment of this outbound handler. Not used for now.
|
||||||
Comment string `protobuf:"bytes,5,opt,name=comment,proto3" json:"comment,omitempty"`
|
Comment string `protobuf:"bytes,5,opt,name=comment,proto3" json:"comment,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *OutboundHandlerConfig) Reset() {
|
func (x *OutboundHandlerConfig) Reset() {
|
||||||
@@ -252,69 +250,34 @@ func (x *OutboundHandlerConfig) GetComment() string {
|
|||||||
|
|
||||||
var File_core_config_proto protoreflect.FileDescriptor
|
var File_core_config_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_core_config_proto_rawDesc = []byte{
|
const file_core_config_proto_rawDesc = "" +
|
||||||
0x0a, 0x11, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72,
|
"\n" +
|
||||||
0x6f, 0x74, 0x6f, 0x12, 0x09, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x1a, 0x21,
|
"\x11core/config.proto\x12\txray.core\x1a!common/serial/typed_message.proto\"\xfb\x01\n" +
|
||||||
0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x2f, 0x74, 0x79,
|
"\x06Config\x129\n" +
|
||||||
0x70, 0x65, 0x64, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
"\ainbound\x18\x01 \x03(\v2\x1f.xray.core.InboundHandlerConfigR\ainbound\x12<\n" +
|
||||||
0x6f, 0x22, 0xfb, 0x01, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x39, 0x0a, 0x07,
|
"\boutbound\x18\x02 \x03(\v2 .xray.core.OutboundHandlerConfigR\boutbound\x122\n" +
|
||||||
0x69, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e,
|
"\x03app\x18\x04 \x03(\v2 .xray.common.serial.TypedMessageR\x03app\x12>\n" +
|
||||||
0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e,
|
"\textension\x18\x06 \x03(\v2 .xray.common.serial.TypedMessageR\textensionJ\x04\b\x03\x10\x04\"\xc0\x01\n" +
|
||||||
0x64, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x07,
|
"\x14InboundHandlerConfig\x12\x10\n" +
|
||||||
0x69, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x3c, 0x0a, 0x08, 0x6f, 0x75, 0x74, 0x62, 0x6f,
|
"\x03tag\x18\x01 \x01(\tR\x03tag\x12M\n" +
|
||||||
0x75, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x78, 0x72, 0x61, 0x79,
|
"\x11receiver_settings\x18\x02 \x01(\v2 .xray.common.serial.TypedMessageR\x10receiverSettings\x12G\n" +
|
||||||
0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x48, 0x61,
|
"\x0eproxy_settings\x18\x03 \x01(\v2 .xray.common.serial.TypedMessageR\rproxySettings\"\xef\x01\n" +
|
||||||
0x6e, 0x64, 0x6c, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x08, 0x6f, 0x75, 0x74,
|
"\x15OutboundHandlerConfig\x12\x10\n" +
|
||||||
0x62, 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x32, 0x0a, 0x03, 0x61, 0x70, 0x70, 0x18, 0x04, 0x20, 0x03,
|
"\x03tag\x18\x01 \x01(\tR\x03tag\x12I\n" +
|
||||||
0x28, 0x0b, 0x32, 0x20, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
|
"\x0fsender_settings\x18\x02 \x01(\v2 .xray.common.serial.TypedMessageR\x0esenderSettings\x12G\n" +
|
||||||
0x2e, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x64, 0x4d, 0x65, 0x73,
|
"\x0eproxy_settings\x18\x03 \x01(\v2 .xray.common.serial.TypedMessageR\rproxySettings\x12\x16\n" +
|
||||||
0x73, 0x61, 0x67, 0x65, 0x52, 0x03, 0x61, 0x70, 0x70, 0x12, 0x3e, 0x0a, 0x09, 0x65, 0x78, 0x74,
|
"\x06expire\x18\x04 \x01(\x03R\x06expire\x12\x18\n" +
|
||||||
0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x78,
|
"\acomment\x18\x05 \x01(\tR\acommentB=\n" +
|
||||||
0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x73, 0x65, 0x72, 0x69, 0x61,
|
"\rcom.xray.coreP\x01Z\x1egithub.com/xtls/xray-core/core\xaa\x02\tXray.Coreb\x06proto3"
|
||||||
0x6c, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x09,
|
|
||||||
0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x4a, 0x04, 0x08, 0x03, 0x10, 0x04, 0x22,
|
|
||||||
0xc0, 0x01, 0x0a, 0x14, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x48, 0x61, 0x6e, 0x64, 0x6c,
|
|
||||||
0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18,
|
|
||||||
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x74, 0x61, 0x67, 0x12, 0x4d, 0x0a, 0x11, 0x72, 0x65,
|
|
||||||
0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18,
|
|
||||||
0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d,
|
|
||||||
0x6d, 0x6f, 0x6e, 0x2e, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x64,
|
|
||||||
0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x10, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65,
|
|
||||||
0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x47, 0x0a, 0x0e, 0x70, 0x72, 0x6f,
|
|
||||||
0x78, 0x79, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28,
|
|
||||||
0x0b, 0x32, 0x20, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e,
|
|
||||||
0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x64, 0x4d, 0x65, 0x73, 0x73,
|
|
||||||
0x61, 0x67, 0x65, 0x52, 0x0d, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e,
|
|
||||||
0x67, 0x73, 0x22, 0xef, 0x01, 0x0a, 0x15, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x48,
|
|
||||||
0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x10, 0x0a, 0x03,
|
|
||||||
0x74, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x74, 0x61, 0x67, 0x12, 0x49,
|
|
||||||
0x0a, 0x0f, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67,
|
|
||||||
0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63,
|
|
||||||
0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x2e, 0x54, 0x79, 0x70,
|
|
||||||
0x65, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x0e, 0x73, 0x65, 0x6e, 0x64, 0x65,
|
|
||||||
0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x47, 0x0a, 0x0e, 0x70, 0x72, 0x6f,
|
|
||||||
0x78, 0x79, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28,
|
|
||||||
0x0b, 0x32, 0x20, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e,
|
|
||||||
0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x64, 0x4d, 0x65, 0x73, 0x73,
|
|
||||||
0x61, 0x67, 0x65, 0x52, 0x0d, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e,
|
|
||||||
0x67, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x18, 0x04, 0x20, 0x01,
|
|
||||||
0x28, 0x03, 0x52, 0x06, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f,
|
|
||||||
0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d,
|
|
||||||
0x6d, 0x65, 0x6e, 0x74, 0x42, 0x3d, 0x0a, 0x0d, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79,
|
|
||||||
0x2e, 0x63, 0x6f, 0x72, 0x65, 0x50, 0x01, 0x5a, 0x1e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e,
|
|
||||||
0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x74, 0x6c, 0x73, 0x2f, 0x78, 0x72, 0x61, 0x79, 0x2d, 0x63, 0x6f,
|
|
||||||
0x72, 0x65, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0xaa, 0x02, 0x09, 0x58, 0x72, 0x61, 0x79, 0x2e, 0x43,
|
|
||||||
0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
file_core_config_proto_rawDescOnce sync.Once
|
file_core_config_proto_rawDescOnce sync.Once
|
||||||
file_core_config_proto_rawDescData = file_core_config_proto_rawDesc
|
file_core_config_proto_rawDescData []byte
|
||||||
)
|
)
|
||||||
|
|
||||||
func file_core_config_proto_rawDescGZIP() []byte {
|
func file_core_config_proto_rawDescGZIP() []byte {
|
||||||
file_core_config_proto_rawDescOnce.Do(func() {
|
file_core_config_proto_rawDescOnce.Do(func() {
|
||||||
file_core_config_proto_rawDescData = protoimpl.X.CompressGZIP(file_core_config_proto_rawDescData)
|
file_core_config_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_core_config_proto_rawDesc), len(file_core_config_proto_rawDesc)))
|
||||||
})
|
})
|
||||||
return file_core_config_proto_rawDescData
|
return file_core_config_proto_rawDescData
|
||||||
}
|
}
|
||||||
@@ -351,7 +314,7 @@ func file_core_config_proto_init() {
|
|||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_core_config_proto_rawDesc,
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_core_config_proto_rawDesc), len(file_core_config_proto_rawDesc)),
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 3,
|
NumMessages: 3,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
@@ -362,7 +325,6 @@ func file_core_config_proto_init() {
|
|||||||
MessageInfos: file_core_config_proto_msgTypes,
|
MessageInfos: file_core_config_proto_msgTypes,
|
||||||
}.Build()
|
}.Build()
|
||||||
File_core_config_proto = out.File
|
File_core_config_proto = out.File
|
||||||
file_core_config_proto_rawDesc = nil
|
|
||||||
file_core_config_proto_goTypes = nil
|
file_core_config_proto_goTypes = nil
|
||||||
file_core_config_proto_depIdxs = nil
|
file_core_config_proto_depIdxs = nil
|
||||||
}
|
}
|
||||||
|
|||||||
+32
-3
@@ -12,14 +12,15 @@ package core
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"runtime/debug"
|
||||||
|
|
||||||
"github.com/xtls/xray-core/common/serial"
|
"github.com/xtls/xray-core/common/serial"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
Version_x byte = 25
|
Version_x byte = 26
|
||||||
Version_y byte = 12
|
Version_y byte = 2
|
||||||
Version_z byte = 8
|
Version_z byte = 6
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -28,6 +29,34 @@ var (
|
|||||||
intro = "A unified platform for anti-censorship."
|
intro = "A unified platform for anti-censorship."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
// Manually injected
|
||||||
|
if build != "Custom" {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
info, ok := debug.ReadBuildInfo()
|
||||||
|
if !ok {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var isDirty bool
|
||||||
|
var foundBuild bool
|
||||||
|
for _, setting := range info.Settings {
|
||||||
|
switch setting.Key {
|
||||||
|
case "vcs.revision":
|
||||||
|
if len(setting.Value) < 7 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
build = setting.Value[:7]
|
||||||
|
foundBuild = true
|
||||||
|
case "vcs.modified":
|
||||||
|
isDirty = setting.Value == "true"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if isDirty && foundBuild {
|
||||||
|
build += "-dirty"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Version returns Xray's version as a string, in the form of "x.y.z" where x, y and z are numbers.
|
// Version returns Xray's version as a string, in the form of "x.y.z" where x, y and z are numbers.
|
||||||
// ".z" part may be omitted in regular releases.
|
// ".z" part may be omitted in regular releases.
|
||||||
func Version() string {
|
func Version() string {
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user