Compare commits

..

115 Commits

Author SHA1 Message Date
RPRX
3b06af882d v24.9.30 2024-09-30 15:20:13 +00:00
风扇滑翔翼
697156f6f6 SplitHTTP Config: Add capability to parse int in string format (#3855)
“100” → 100
“-1” → -1
“” → 0
2024-09-29 03:10:42 +08:00
RPRX
d8485bd5af Transport: Add RAW as an alias of TCP (#3852) 2024-09-28 05:25:59 +00:00
yuhan6665
3632e83faa Transport: Add HTTP3 to HTTP (#3819) 2024-09-26 01:29:41 +00:00
Kobe Arthur Scofield
7086d286be Remove legacy code (#3838)
* Add feature migration notice

* Remove legacy code of transport processing

* Clear legacy proto field

* Fix missing

* Unify protocolname

* Test remove

* Supressor

* Weird code

* Remove errorgen related comments
2024-09-23 11:28:19 -04:00
dependabot[bot]
d497de916f Bump google.golang.org/grpc from 1.66.2 to 1.67.0 (#3845)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.66.2 to 1.67.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.66.2...v1.67.0)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-23 05:37:54 +00:00
Lumière Élevé
acbf36e21b SplitHTTP server: Add global CORS headers for browser dialer (#3830) 2024-09-20 09:55:54 +02:00
mmmray
93cff1a576 Xmux: Value of 0 is treated the same as no value (#3835)
It turns out that some panels like to set `"xmux": {"maxConnections": 0,
"maxConcurrency": 0}`, and of course that fails now. To make their job
easier, let's treat `0` the same as not setting the parameter.

Again, I don't like that xray's defaults are hardcoded all over the
place. I would have liked a different default value for Xmux in a future
version, but it actually can't be done in practice because everybody
just copypastes the defaults from the docs into their own sourcecode
(and sometimes changes them silently to their own idea of a good
default)
2024-09-19 11:20:12 -04:00
Lumière Élevé
7677ac980d Browser Dialer: Change from ES5 to ES6+ for performance (#3832) 2024-09-19 10:57:43 +02:00
RPRX
bc28cad8f8 v24.9.19 2024-09-19 01:12:29 +00:00
Kobe Arthur Scofield
57a41f3b4b Config: Remove more legacy fields (#3817) 2024-09-19 01:05:59 +00:00
mmmray
f406b2dee0 SplitHTTP client: Fix xmux config deserialization (#3827) 2024-09-19 00:45:39 +00:00
RPRX
a35d5719f4 v24.9.16 2024-09-16 12:48:28 +00:00
dragonbreath2000
363e86c585 UDP noises: Add base64 and multi-packet support (#3794)
https://github.com/XTLS/Xray-core/pull/3794#issuecomment-2351329251

---------

Co-authored-by: 风扇滑翔翼 <Fangliding.fshxy@outlook.com>
Co-authored-by: mmmray <142015632+mmmray@users.noreply.github.com>
2024-09-16 12:46:30 +00:00
ll11l1lIllIl1lll
b1c6471eeb SplitHTTP client: Add xmux (multiplex controller) for H3 & H2 (#3613)
https://github.com/XTLS/Xray-core/pull/3613#issuecomment-2351954957

Closes https://github.com/XTLS/Xray-core/issues/3560#issuecomment-2247495778

---------

Co-authored-by: mmmray <142015632+mmmray@users.noreply.github.com>
2024-09-16 12:42:01 +00:00
Dmitry Anderson
a931507dd6 SplitHTTP: Read and validate HTTP/1.1 responses (#3797) 2024-09-16 12:33:03 +00:00
dependabot[bot]
67c2a29065 Bump github.com/sagernet/sing from 0.4.1 to 0.4.3 (#3818)
Bumps [github.com/sagernet/sing](https://github.com/sagernet/sing) from 0.4.1 to 0.4.3.
- [Commits](https://github.com/sagernet/sing/compare/v0.4.1...v0.4.3)

---
updated-dependencies:
- dependency-name: github.com/sagernet/sing
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-15 21:20:12 -04:00
Kobe Arthur Scofield
5f0642a671 Errors: Add PrintRemovedFeatureError & PrintDeprecatedFeatureWarning (#3804) 2024-09-15 04:55:54 +00:00
风扇滑翔翼
3fed0c773f DNS outbound: Add blockTypes (#3812) 2024-09-15 04:21:51 +00:00
Kuzmin Vladimir
d7c5a0fc5f Fix int overflow on x32 processors causing panic (#3810)
During the roll, "duration" is converted to int, causing overflow on x32 processors. The value may be very small or negative, causing a panic in rand.Intn.
2024-09-14 23:47:16 -04:00
风扇滑翔翼
781aaee21f QUIC sniffer: handle multiple initial packets (#3802)
* QUIC sniffer: handle multiple initial packets
Basically copied from Vigilans/v2ray-core@8f33db0

Co-Authored-By: Vigilans <vigilans@foxmail.com>

* Remove unnecessary file

---------

Co-authored-by: Vigilans <vigilans@foxmail.com>
2024-09-13 13:32:43 -04:00
风扇滑翔翼
7970f240de Log: show the matching rule tag (#3809) 2024-09-13 13:05:19 -04:00
风扇滑翔翼
88ae774cce Sniff: Routing “attrs” support non http inbound (#3808)
* Sniff: Support attrs route in non http inbound

* Add capability to sniff method and path

* Fix test

* Skip HTTP inbound PlainHTTP mode

* Fix test
again
2024-09-13 12:26:36 -04:00
Torikki
c259e4e4a6 Allow to inject custom validator in VLESS controller (#3453)
* Make Validator an interface

* Move validator creation away from VLESS inbound controller
2024-09-13 10:51:26 -04:00
vnxme
3a8c5f38e8 Routing: Add regexp syntax support to UserMatcher (#3799) 2024-09-12 10:48:41 -04:00
dependabot[bot]
12c3908e8c Bump google.golang.org/grpc from 1.66.1 to 1.66.2 (#3798)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.66.1 to 1.66.2.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.66.1...v1.66.2)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-12 10:38:51 -04:00
Kobe Arthur Scofield
1919a1e86f Log: Improve feature deprecation/removal logs (#3793)
* Improve feature deprecation/removal logs

* Add a note about the new feature

* When the feature has removed, this should be an error not a warning
2024-09-12 10:38:17 -04:00
风扇滑翔翼
1b607ff874 DNS: Do not hit cache if encounted err (#3784) 2024-09-12 10:34:45 -04:00
Kobe Arthur Scofield
7496413e5c Remove remnants of global transport (#3792)
* Remove remenants

* Generate pb.go

* Remove function
2024-09-11 14:06:11 -04:00
dependabot[bot]
297a9ae7bd Bump google.golang.org/grpc from 1.66.0 to 1.66.1 (#3786)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.66.0 to 1.66.1.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.66.0...v1.66.1)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-11 11:34:03 -04:00
风扇滑翔翼
a247997e38 Log: Add MaskAddress option to hide IP addresses (#3783)
* Log: Add maskAddress option

* Correct IPv6 subnet
2024-09-11 10:45:47 -04:00
Kobe Arthur Scofield
6b1bf312d7 Config: Remove legacy config fields again (#3782)
* Remove more lecacy fields

* Patch missing bracket

* Fix tests

* Fix missing comma

* Fix buried test bomb

* Cleanup test after removed legacy test content
2024-09-11 10:37:25 -04:00
yu
c90affe7db Fix: RPC call causes xray panic problem using wrong account type (#3744)
* fix:RPC call causes xray panic problem. Problem details: add a VMess protocol user in an inbound proxy. If inTag: "VMess-xxx", but the developer carelessly calls the add user method of vless or other protocols, such as xrayCtl.AddVlessUser(user), causing xray panic

* fix:use xray log system return error

---------

Co-authored-by: chengtao@snqu.com <chengtao@snqu.com>
2024-09-09 11:44:22 -04:00
风扇滑翔翼
3d0feae462 Transport: Add REALITY TLS1.3 support warning (#3774) 2024-09-09 11:37:39 -04:00
Kobe Arthur Scofield
f04cb0b288 Config: Remove some legacy fields from V2Ray 3.x era (#3776)
https://github.com/XTLS/Xray-core/pull/3776#issue-2512316726
2024-09-09 06:03:21 +00:00
mmmray
9438517130 README.md: Add SaeedDev94/Xray to Android clients
Closes https://github.com/XTLS/Xray-core/issues/3778
2024-09-09 05:59:12 +00:00
RPRX
3d9137cb6f v24.9.7 2024-09-07 00:30:27 +00:00
mmmray
6838a0ae55 Config: Remove legacy inbound/outbound/detours (#3769)
https://github.com/XTLS/Xray-core/pull/3769#issuecomment-2334915139
2024-09-06 23:43:58 +00:00
dependabot[bot]
3971532798 Bump golang.org/x/net from 0.28.0 to 0.29.0 (#3766)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.28.0 to 0.29.0.
- [Commits](https://github.com/golang/net/compare/v0.28.0...v0.29.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-06 01:52:47 +00:00
dependabot[bot]
d36e027a50 Bump golang.org/x/sys from 0.24.0 to 0.25.0 (#3762)
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.24.0 to 0.25.0.
- [Commits](https://github.com/golang/sys/compare/v0.24.0...v0.25.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-06 01:47:43 +00:00
mmmray
f357245f93 Config: Remove global transport (#3751)
https://github.com/XTLS/Xray-core/pull/3751#issuecomment-2329564039

---------

Co-authored-by: 风扇滑翔翼 <Fangliding.fshxy@outlook.com>
2024-09-04 18:09:16 -04:00
mmmray
c0a98f74fc Transport: Remove DomainSocket (#3757)
https://github.com/XTLS/Xray-core/pull/3755#issuecomment-2325533003
2024-09-03 11:36:11 +00:00
mmmray
9a953c070f Transport: Remove QUIC (#3754)
https://github.com/XTLS/Xray-core/pull/3554#issuecomment-2236171077
2024-09-03 02:39:44 +00:00
mmmray
ab3c00e96b SplitHTTP: Remove ok compatibility logic (#3753)
Remove some code that was added to maintain compatibility with older
Xray versions. This breaks compatibility with Xray-core v1.8.23 or older.
2024-09-03 02:25:15 +00:00
mmmray
f1c439c2aa Revert "Fix freedom PacketReader/PacketWriter type assertion (#3734)"
This reverts commit 815a959c96.
2024-09-01 10:59:31 -05:00
RPRX
6baad79f98 v1.8.24 2024-08-30 07:01:01 +00:00
dependabot[bot]
98e85b7f3c Bump google.golang.org/grpc from 1.65.0 to 1.66.0 (#3740)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.65.0 to 1.66.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.65.0...v1.66.0)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-29 11:32:36 -04:00
dragonbreath2000
002d08bf83 UDP noise (#3711)
* added udp noise

* adding protobuf settings

* freedom json parser and clean up

* resolve confict

* fix and clean up

* use net.conn instead of packetconnwrapper

* avoid constructing SequentialWriter directly

---------

Co-authored-by: mmmray <142015632+mmmray@users.noreply.github.com>
2024-08-28 17:10:11 -04:00
xiaorouji
8674ed5a0d Support DNS queryStrategy config for UDP NameServer (#3728) 2024-08-27 10:19:33 -04:00
dyhkwong
815a959c96 Fix freedom PacketReader/PacketWriter type assertion (#3734) 2024-08-27 10:17:55 -04:00
RPRX
1cfed96aba README.md: Add Project VLESS to Telegram 2024-08-26 02:33:03 +00:00
yuhan6665
592c2daf58 Update go 1.23 (#3730) 2024-08-25 22:30:38 -04:00
dependabot[bot]
5d7dfbbcac Bump github.com/vishvananda/netlink from 1.2.1 to 1.3.0 (#3729)
Bumps [github.com/vishvananda/netlink](https://github.com/vishvananda/netlink) from 1.2.1 to 1.3.0.
- [Release notes](https://github.com/vishvananda/netlink/releases)
- [Commits](https://github.com/vishvananda/netlink/compare/v1.2.1...v1.3.0)

---
updated-dependencies:
- dependency-name: github.com/vishvananda/netlink
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-25 22:07:31 -04:00
mmmray
3dd3bf94d4 Fix data leak between mux.cool connections (#3718)
Fix #116
2024-08-25 21:02:01 +02:00
dependabot[bot]
c0c23fdfeb Bump github.com/vishvananda/netlink (#3719)
Bumps [github.com/vishvananda/netlink](https://github.com/vishvananda/netlink) from 1.2.1-beta.2.0.20230316163032-ced5aaba43e3 to 1.2.1.
- [Release notes](https://github.com/vishvananda/netlink/releases)
- [Commits](https://github.com/vishvananda/netlink/commits/v1.2.1)

---
updated-dependencies:
- dependency-name: github.com/vishvananda/netlink
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-23 08:41:35 +00:00
风扇滑翔翼
34e0a2fb41 Issues template: Add require for latest version 2024-08-23 06:48:25 +00:00
mmmray
83eef6bc1f SplitHTTP: Fix connection leaks and crashes (#3710) 2024-08-22 17:07:57 +02:00
mmmray
2be03c56cb Pin protobuf packages (#3715)
* Pin protobuf packages

It happened in the past that I ran with the wrong protobuf version
installed locally, and apparently there is even still some file wrong in
splithttp. Fix this issue once and for all.

* bump protobuf packages

* Revert "bump protobuf packages"

This reverts commit 7a3509346a.

* Revert "Revert "bump protobuf packages""

This reverts commit bb79707d15.

* fix deprecated grpc usage
2024-08-22 10:18:36 -04:00
curlwget
790f908f0b chore: fix some comment typos (#3716)
Signed-off-by: curlwget <curlwget@icloud.com>
2024-08-22 17:32:38 +08:00
dependabot[bot]
0df7fa23f8 Bump github.com/cloudflare/circl from 1.3.9 to 1.4.0 (#3712)
Bumps [github.com/cloudflare/circl](https://github.com/cloudflare/circl) from 1.3.9 to 1.4.0.
- [Release notes](https://github.com/cloudflare/circl/releases)
- [Commits](https://github.com/cloudflare/circl/compare/v1.3.9...v1.4.0)

---
updated-dependencies:
- dependency-name: github.com/cloudflare/circl
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-21 17:36:25 -04:00
チセ
41d03d1856 Wireguard inbound: Fix no route when bind to interface (#3698) 2024-08-20 08:20:01 +00:00
mmmray
160316d53c SplitHTTP: Do not produce too large upload (#3691) 2024-08-17 13:01:58 +02:00
HunterQ
1562e1ffb9 Config: Combine filename and format into a new struct (#3687) 2024-08-16 05:32:05 +00:00
RPRX
11b04807b9 Log: Add "from" before source address
https://github.com/XTLS/Xray-core/pull/3682#issuecomment-2292600144
2024-08-16 02:18:39 +00:00
风扇滑翔翼
b612da26eb Socks inbound: Support HTTP inbound by default (#3682)
Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com>
2024-08-16 00:58:48 +00:00
HunterQ
030c9efc8c Commands: Comment some useless codes (#3681)
Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com>
2024-08-15 08:04:09 +00:00
dependabot[bot]
08d1840344 Bump github.com/miekg/dns from 1.1.61 to 1.1.62 (#3680)
* Bump github.com/miekg/dns from 1.1.61 to 1.1.62

Bumps [github.com/miekg/dns](https://github.com/miekg/dns) from 1.1.61 to 1.1.62.
- [Changelog](https://github.com/miekg/dns/blob/master/Makefile.release)
- [Commits](https://github.com/miekg/dns/compare/v1.1.61...v1.1.62)

---
updated-dependencies:
- dependency-name: github.com/miekg/dns
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update go.mod

* Update go.sum

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com>
2024-08-14 09:51:50 +00:00
yuhan6665
f0547bc04d Commands: Use creflect.MarshalToJson() as output (#3674) 2024-08-12 05:59:23 -05:00
mmmray
498d8eb3cc DialerProxy: Fix SplitHTTP H3 dialerProxy (#3570)
* wip

* wip

* formatting

* cnc connection no longer needs to be a Packetconn

* dialerProxy: do not cancel connection when Dial context is cancelled
2024-08-11 12:58:52 -04:00
Lumière Élevé
0c7303960a SplitHTTP server: Add "Cache-Control: no-store" to GET response (#3652)
https://github.com/XTLS/Xray-core/pull/3652#issuecomment-2282308407
2024-08-10 23:59:42 +00:00
mmmray
513182adf3 SplitHTTP server: Only "ok" to older clients (#3671)
https://github.com/XTLS/Xray-core/pull/3643#issuecomment-2282304185
2024-08-10 23:56:25 +00:00
mmmray
a3b306aaa4 SplitHTTP: Replace responseOkPadding with xPaddingBytes (#3643) 2024-08-10 21:47:42 +00:00
nobody
f650d87083 Commands: Add convert with two sub-commands (#3661)
* Add back convert-configs-to-protobuf command.

* Add convert-typedMessage-to-json command.

* Add -debug and -type arguments into convert.pb sub-command.

---------

Co-authored-by: nobody <nobody@nowhere.mars>
2024-08-10 12:09:07 -04:00
mmmray
85e2ebc6f7 SplitHTTP client: Raise idle timeout to 5 minutes, Add h*KeepalivePeriod (#3624) 2024-08-10 05:40:48 +00:00
风扇滑翔翼
9e93c19161 Freedom: Combine fragmented tlshello if interval is 0 (#3663)
Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com>
Co-authored-by: Ahmadreza Dorkhah <djahmadfire@gmail.com>
2024-08-10 05:06:00 +00:00
dependabot[bot]
96e8b8b279 Bump golang.org/x/sys from 0.23.0 to 0.24.0 (#3662)
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.23.0 to 0.24.0.
- [Commits](https://github.com/golang/sys/compare/v0.23.0...v0.24.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-09 02:25:33 +00:00
dependabot[bot]
1a95add8e3 Bump github.com/quic-go/quic-go from 0.45.2 to 0.46.0 (#3658)
Bumps [github.com/quic-go/quic-go](https://github.com/quic-go/quic-go) from 0.45.2 to 0.46.0.
- [Release notes](https://github.com/quic-go/quic-go/releases)
- [Changelog](https://github.com/quic-go/quic-go/blob/master/Changelog.md)
- [Commits](https://github.com/quic-go/quic-go/compare/v0.45.2...v0.46.0)

---
updated-dependencies:
- dependency-name: github.com/quic-go/quic-go
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-08 10:37:26 -04:00
nobody
ac628a9427 API: Improve MarshalToJson() in common/reflect/marshal.go (#3655)
* Serialize enum to string in MarshalToJson().

* MarshalToJson() respect json tags.

* Add insertTypeInfo parameter to MarshalToJson().

* Omit empty string in MarshalToJson().

* Serialize PortList to string in MarshalToJson().

---------

Co-authored-by: nobody <nobody@nowhere.mars>
2024-08-08 10:35:46 -04:00
RPRX
4a1c0d7124 README.md: Rename NFTs to Donation & NFTs 2024-08-07 13:15:25 +00:00
dependabot[bot]
661cb901de Bump golang.org/x/net from 0.27.0 to 0.28.0 (#3649)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.27.0 to 0.28.0.
- [Commits](https://github.com/golang/net/compare/v0.27.0...v0.28.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-07 00:28:06 +00:00
dependabot[bot]
c6d9d430bf Bump golang.org/x/sync from 0.7.0 to 0.8.0 (#3640)
Bumps [golang.org/x/sync](https://github.com/golang/sync) from 0.7.0 to 0.8.0.
- [Commits](https://github.com/golang/sync/compare/v0.7.0...v0.8.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sync
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-05 22:24:16 -04:00
dependabot[bot]
1dfec5056d Bump golang.org/x/sys from 0.22.0 to 0.23.0 (#3639)
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.22.0 to 0.23.0.
- [Commits](https://github.com/golang/sys/compare/v0.22.0...v0.23.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-05 22:22:12 -04:00
definitio
2a5eb3db7d Docker: Fix permissions of geosite and geodat (#3634) 2024-08-05 00:21:22 +02:00
RPRX
4c9e4b9de7 README.md: Add NFTs 2024-08-03 14:56:05 +00:00
风扇滑翔翼
644901d1a5 Socks4a server: Check if the client sends an IP address as domain (#3628)
Fixes https://github.com/XTLS/Xray-core/issues/3622
2024-08-03 02:08:23 +00:00
dependabot[bot]
7e24239c9a Bump github.com/quic-go/quic-go from 0.45.1 to 0.45.2 (#3623)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-02 03:16:37 +02:00
mmmray
4b7947cca9 SplitHTTP server: add ok padding (#3614) 2024-08-02 03:16:19 +02:00
RPRX
4c82ef8a1b v1.8.23 2024-07-29 10:23:04 +00:00
mmmray
30af792777 SplitHTTP: Rename three options & Reduce server defaults (#3611)
* maxUploadSize -> scMaxEachPostBytes, default is 1MB on both sides (was 2MB on the server)
* minUploadIntervalMs -> scMinPostsIntervalMs, default is 30ms on the client (no server support for now)
* maxConcurrentUploads -> scMaxConcurrentPosts, default is 100 on both sides (was 200 on the server)
2024-07-29 10:10:29 +00:00
mmmray
33daa0c94b SplitHTTP: Fix wrong config deserialization (#3610)
Testing was conducted only using explicit parameters, and using
testsuite. However, when the parameters are not explicitly set in JSON
config, it seems that `c.MaxUploadSize` will contain `RandRangeConfig {
From: 0, To: 0 }` instead of `nil`, which breaks upload entirely.
2024-07-29 08:50:59 +00:00
RPRX
70383c50cc v1.8.22 2024-07-29 08:22:12 +00:00
mayampi01
521d8ef6a1 Docker: Add multi-arch builds and Loyalsoldier flavor (#3589)
Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com>
2024-07-29 07:36:30 +00:00
lelemka0
4531a7e228 CertificateObject: Enable auto-reload for cacert & Add buildChain & Fixes (#3607) 2024-07-29 06:58:58 +00:00
yuhan6665
a342db3e28 Fix a nil pointer in Wireguard client logging (#3608) 2024-07-29 06:43:46 +00:00
RPRX
60553a6c26 SplitHTTP server: Add noSSEHeader
https://github.com/XTLS/Xray-core/pull/3603#issuecomment-2254968219
2024-07-29 06:32:04 +00:00
mmmray
59f6685774 SplitHTTP: More range options, change defaults, enforce maxUploadSize, fix querystring behavior (#3603)
* maxUploadSize and maxConcurrentUploads can now be ranges on the client
* maxUploadSize is now enforced on the server
* the default of maxUploadSize is 2MB on the server, and 1MB on the client
* the default of maxConcurrentUploads is 200 on the server, and 100 on the client
* ranges on the server are treated as a single number. if server is configured as `"1-2"`, server will enforce `2`
* querystrings in `path` are now handled correctly
2024-07-29 04:35:17 +00:00
yuhan6665
4cb2a128db Don't do raw/splice copy in case of MITM 2024-07-24 20:41:40 -04:00
mmmray
8a4217fdf5 SplitHTTP client: Add minUploadInterval (#3592) 2024-07-27 12:52:36 +00:00
mmmray
7cf5ee8afd WS, HU: Remove unnecessary sleep from test (#3600) 2024-07-27 12:38:54 +00:00
mmmray
2becdd6414 SplitHTTP server: Fix panic during concurrent Close and Push (#3593)
When Close and Push are called concurrently, it may happen that Push attempts to write to an already-closed channel, and trigger a panic.

From a user perspective, it results in logs like this:

    http: panic serving 172.19.0.6:50476: send on closed channel

It's probably triggered when download is closed at the same time an upload packet is submitted.

These panics don't crash the server and the inbound is still usable.
2024-07-26 04:36:55 +02:00
hellokindle
edae38c620 Fix SplitHTTP Unix domain socket (#3577)
Co-authored-by: mmmray <142015632+mmmray@users.noreply.github.com>
2024-07-22 22:19:31 +02:00
mayampi01
36f427f22b docker.yml: Set latest to auto to tag release version (#3581) 2024-07-22 16:16:25 +02:00
RPRX
c27d652d80 v1.8.21 2024-07-21 21:32:26 +00:00
RPRX
0f65aa8ed8 Fix SplitHTTP H3 waited for downResponse before uploading
https://github.com/XTLS/Xray-core/issues/3560#issuecomment-2241750579
2024-07-21 20:45:05 +00:00
RPRX
22535d8643 Fix SplitHTTP H3 didn't always reuse QUIC connection
https://github.com/XTLS/Xray-core/issues/3560#issuecomment-2241531502
2024-07-21 08:55:03 +00:00
mmmray
529f206d33 Fix serverside TLS support of SplitHTTP H1/H2 (#3567)
Fix #3566

Also update testsuite so that all tests read and write some data. Opening a connection is not enough to trigger connection errors, because the connection is so lazy.
2024-07-20 19:35:24 -05:00
チセ
964859b4bc SplitHTTP: Remove unnecessary keepalives (#3565)
Remove keep alive since quic-go/http3 doesn't support stream reuse
Discussion see https://t.me/projectXray/3782492

Co-authored-by: Fangliding <Fangliding.fshxy@outlook.com>
Co-authored-by: xqzr <34030394+xqzr@users.noreply.github.com>
Co-authored-by: ll11l1lIllIl1lll <88377095+ll11l1lIllIl1lll@users.noreply.github.com>
2024-07-20 19:34:57 -05:00
RPRX
8deb953aec v1.8.20 2024-07-20 06:10:40 +00:00
ll11l1lIllIl1lll
a0040f13dd SplitHTTP: Server supports HTTP/3 (#3554)
Co-authored-by: mmmray <142015632+mmmray@users.noreply.github.com>
2024-07-19 17:53:47 +00:00
ll11l1lIllIl1lll
d8994b7603 Fix SplitHTTP H3 crash on v2rayNG (#3559)
Fixes https://github.com/XTLS/Xray-core/issues/3556
2024-07-19 17:52:34 +00:00
RPRX
b277bacdf6 v1.8.19 2024-07-17 13:51:21 +00:00
RPRX
9288a7c0dc Upgrade dependencies 2024-07-17 13:45:16 +00:00
ll11l1lIllIl1lll
c40fc44a34 SplitHTTP: Client supports HTTP/3 (#3543)
Closes https://github.com/XTLS/Xray-core/issues/3456

Co-authored-by: Fangliding <Fangliding.fshxy@outlook.com>
Co-authored-by: mmmray <142015632+mmmray@users.noreply.github.com>
2024-07-17 07:55:28 -05:00
yuhan6665
02cd3b8c74 Fix SplitHTTP race condition when creating new sessions (#3533)
Co-authored-by: nobody <nobody@nowhere.mars>
Co-authored-by: mmmray <142015632+mmmray@users.noreply.github.com>
2024-07-17 11:41:17 +00:00
风扇滑翔翼
a7e198e1e2 Fix WS reading X-Forwarded-For & Add tests (#3546)
Fixes https://github.com/XTLS/Xray-core/issues/3545

---------

Co-authored-by: mmmray <142015632+mmmray@users.noreply.github.com>
2024-07-17 10:40:25 +00:00
305 changed files with 5120 additions and 6672 deletions

View File

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

View File

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

View File

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

View File

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

View File

@@ -187,7 +187,7 @@ jobs:
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v5 uses: actions/setup-go@v5
with: with:
go-version: ${{ matrix.gotoolchain || '1.22' }} go-version: ${{ matrix.gotoolchain || '1.23' }}
check-latest: true check-latest: true
- name: Get project dependencies - name: Get project dependencies

View File

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

3
.gitignore vendored
View File

@@ -28,3 +28,6 @@ errorgen
*.dat *.dat
.vscode .vscode
/build_assets /build_assets
# Output from dlv test
**/debug.*

View File

@@ -4,6 +4,10 @@
[README](https://github.com/XTLS/Xray-core#readme) is open, so feel free to submit your project [here](https://github.com/XTLS/Xray-core/pulls). [README](https://github.com/XTLS/Xray-core#readme) is open, so feel free to submit your project [here](https://github.com/XTLS/Xray-core/pulls).
## Donation & NFTs
[Announcement of NFTs by Project X](https://github.com/XTLS/Xray-core/discussions/3633)
## License ## License
[Mozilla Public License Version 2.0](https://github.com/XTLS/Xray-core/blob/main/LICENSE) [Mozilla Public License Version 2.0](https://github.com/XTLS/Xray-core/blob/main/LICENSE)
@@ -18,6 +22,8 @@
[Project X Channel](https://t.me/projectXtls) [Project X Channel](https://t.me/projectXtls)
[Project VLESS](https://t.me/projectVless) (non-Chinese)
## Installation ## Installation
- Linux Script - Linux Script
@@ -71,6 +77,7 @@
- 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)
- iOS & macOS arm64 - iOS & macOS arm64
- [FoXray](https://apps.apple.com/app/foxray/id6448898396) - [FoXray](https://apps.apple.com/app/foxray/id6448898396)
- [Streisand](https://apps.apple.com/app/streisand/id6450534064) - [Streisand](https://apps.apple.com/app/streisand/id6450534064)

View File

@@ -1,7 +1,5 @@
package commander package commander
//go:generate go run github.com/xtls/xray-core/common/errors/errorgen
import ( import (
"context" "context"
"net" "net"

View File

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

View File

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

View File

@@ -1,7 +1,5 @@
package dispatcher package dispatcher
//go:generate go run github.com/xtls/xray-core/common/errors/errorgen
import ( import (
"context" "context"
"regexp" "regexp"
@@ -10,8 +8,8 @@ import (
"time" "time"
"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/buf" "github.com/xtls/xray-core/common/buf"
"github.com/xtls/xray-core/common/errors"
"github.com/xtls/xray-core/common/log" "github.com/xtls/xray-core/common/log"
"github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/common/protocol" "github.com/xtls/xray-core/common/protocol"
@@ -41,8 +39,14 @@ func (r *cachedReader) Cache(b *buf.Buffer) {
if !mb.IsEmpty() { if !mb.IsEmpty() {
r.cache, _ = buf.MergeMulti(r.cache, mb) r.cache, _ = buf.MergeMulti(r.cache, mb)
} }
cacheLen := r.cache.Len()
if cacheLen <= b.Cap() {
b.Clear() b.Clear()
rawBytes := b.Extend(buf.Size) } else {
b.Release()
*b = *buf.NewWithSize(cacheLen)
}
rawBytes := b.Extend(cacheLen)
n := r.cache.Copy(rawBytes) n := r.cache.Copy(rawBytes)
b.Resize(0, int32(n)) b.Resize(0, int32(n))
r.Unlock() r.Unlock()
@@ -421,7 +425,11 @@ func (d *DefaultDispatcher) routedDispatch(ctx context.Context, link *transport.
outTag := route.GetOutboundTag() outTag := route.GetOutboundTag()
if h := d.ohm.GetHandler(outTag); h != nil { if h := d.ohm.GetHandler(outTag); h != nil {
isPickRoute = 2 isPickRoute = 2
if route.GetRuleTag() == "" {
errors.LogInfo(ctx, "taking detour [", outTag, "] for [", destination, "]") errors.LogInfo(ctx, "taking detour [", outTag, "] for [", destination, "]")
} else {
errors.LogInfo(ctx, "Hit route rule: [", route.GetRuleTag(), "] so taking detour [", outTag, "] for [", destination, "]")
}
handler = h handler = h
} else { } else {
errors.LogWarning(ctx, "non existing outTag: ", outTag) errors.LogWarning(ctx, "non existing outTag: ", outTag)

View File

@@ -1,3 +1 @@
package dispatcher package dispatcher
//go:generate go run github.com/xtls/xray-core/common/errors/errorgen

View File

@@ -35,7 +35,7 @@ type Sniffer struct {
func NewSniffer(ctx context.Context) *Sniffer { func NewSniffer(ctx context.Context) *Sniffer {
ret := &Sniffer{ ret := &Sniffer{
sniffer: []protocolSnifferWithMetadata{ sniffer: []protocolSnifferWithMetadata{
{func(c context.Context, b []byte) (SniffResult, error) { return http.SniffHTTP(b) }, false, net.Network_TCP}, {func(c context.Context, b []byte) (SniffResult, error) { return http.SniffHTTP(b, c) }, false, net.Network_TCP},
{func(c context.Context, b []byte) (SniffResult, error) { return tls.SniffTLS(b) }, false, net.Network_TCP}, {func(c context.Context, b []byte) (SniffResult, error) { return tls.SniffTLS(b) }, false, net.Network_TCP},
{func(c context.Context, b []byte) (SniffResult, error) { return bittorrent.SniffBittorrent(b) }, false, net.Network_TCP}, {func(c context.Context, b []byte) (SniffResult, error) { return bittorrent.SniffBittorrent(b) }, false, net.Network_TCP},
{func(c context.Context, b []byte) (SniffResult, error) { return quic.SniffQUIC(b) }, false, net.Network_UDP}, {func(c context.Context, b []byte) (SniffResult, error) { return quic.SniffQUIC(b) }, false, net.Network_UDP},

View 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.34.1 // protoc-gen-go v1.34.2
// protoc v5.27.0 // protoc v5.28.0
// source: app/dns/config.proto // source: app/dns/config.proto
package dns package dns
@@ -223,19 +223,9 @@ type Config struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
// Nameservers used by this DNS. Only traditional UDP servers are support at
// the moment. A special value 'localhost' as a domain address can be set to
// use DNS on local system.
//
// Deprecated: Marked as deprecated in app/dns/config.proto.
NameServers []*net.Endpoint `protobuf:"bytes,1,rep,name=NameServers,proto3" json:"NameServers,omitempty"`
// 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.
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"`
// Static hosts. Domain to IP.
// Deprecated. Use static_hosts.
//
// Deprecated: Marked as deprecated in app/dns/config.proto.
Hosts map[string]*net.IPOrDomain `protobuf:"bytes,2,rep,name=Hosts,proto3" json:"Hosts,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
// Client IP for EDNS client subnet. Must be 4 bytes (IPv4) or 16 bytes // Client IP for EDNS client subnet. Must be 4 bytes (IPv4) or 16 bytes
// (IPv6). // (IPv6).
ClientIp []byte `protobuf:"bytes,3,opt,name=client_ip,json=clientIp,proto3" json:"client_ip,omitempty"` ClientIp []byte `protobuf:"bytes,3,opt,name=client_ip,json=clientIp,proto3" json:"client_ip,omitempty"`
@@ -281,14 +271,6 @@ func (*Config) Descriptor() ([]byte, []int) {
return file_app_dns_config_proto_rawDescGZIP(), []int{1} return file_app_dns_config_proto_rawDescGZIP(), []int{1}
} }
// Deprecated: Marked as deprecated in app/dns/config.proto.
func (x *Config) GetNameServers() []*net.Endpoint {
if x != nil {
return x.NameServers
}
return nil
}
func (x *Config) GetNameServer() []*NameServer { func (x *Config) GetNameServer() []*NameServer {
if x != nil { if x != nil {
return x.NameServer return x.NameServer
@@ -296,14 +278,6 @@ func (x *Config) GetNameServer() []*NameServer {
return nil return nil
} }
// Deprecated: Marked as deprecated in app/dns/config.proto.
func (x *Config) GetHosts() map[string]*net.IPOrDomain {
if x != nil {
return x.Hosts
}
return nil
}
func (x *Config) GetClientIp() []byte { func (x *Config) GetClientIp() []byte {
if x != nil { if x != nil {
return x.ClientIp return x.ClientIp
@@ -479,7 +453,7 @@ type Config_HostMapping struct {
func (x *Config_HostMapping) Reset() { func (x *Config_HostMapping) Reset() {
*x = Config_HostMapping{} *x = Config_HostMapping{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_app_dns_config_proto_msgTypes[5] mi := &file_app_dns_config_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -492,7 +466,7 @@ func (x *Config_HostMapping) String() string {
func (*Config_HostMapping) ProtoMessage() {} func (*Config_HostMapping) ProtoMessage() {}
func (x *Config_HostMapping) ProtoReflect() protoreflect.Message { func (x *Config_HostMapping) ProtoReflect() protoreflect.Message {
mi := &file_app_dns_config_proto_msgTypes[5] mi := &file_app_dns_config_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -505,7 +479,7 @@ func (x *Config_HostMapping) ProtoReflect() protoreflect.Message {
// Deprecated: Use Config_HostMapping.ProtoReflect.Descriptor instead. // Deprecated: Use Config_HostMapping.ProtoReflect.Descriptor instead.
func (*Config_HostMapping) Descriptor() ([]byte, []int) { func (*Config_HostMapping) Descriptor() ([]byte, []int) {
return file_app_dns_config_proto_rawDescGZIP(), []int{1, 1} return file_app_dns_config_proto_rawDescGZIP(), []int{1, 0}
} }
func (x *Config_HostMapping) GetType() DomainMatchingType { func (x *Config_HostMapping) GetType() DomainMatchingType {
@@ -541,107 +515,92 @@ var File_app_dns_config_proto protoreflect.FileDescriptor
var file_app_dns_config_proto_rawDesc = []byte{ var file_app_dns_config_proto_rawDesc = []byte{
0x0a, 0x14, 0x61, 0x70, 0x70, 0x2f, 0x64, 0x6e, 0x73, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x0a, 0x14, 0x61, 0x70, 0x70, 0x2f, 0x64, 0x6e, 0x73, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70,
0x2e, 0x64, 0x6e, 0x73, 0x1a, 0x18, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x6e, 0x65, 0x74, 0x2e, 0x64, 0x6e, 0x73, 0x1a, 0x1c, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x6e, 0x65, 0x74,
0x2f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x2f, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f,
0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x6e, 0x65, 0x74, 0x2f, 0x64, 0x65, 0x73, 0x74, 0x69, 0x74, 0x6f, 0x1a, 0x17, 0x61, 0x70, 0x70, 0x2f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2f, 0x63,
0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x61, 0x70, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb2, 0x04, 0x0a, 0x0a,
0x70, 0x2f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x33, 0x0a, 0x07, 0x61, 0x64,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb2, 0x04, 0x0a, 0x0a, 0x4e, 0x61, 0x6d, 0x65, 0x53, 0x65, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x78, 0x72,
0x72, 0x76, 0x65, 0x72, 0x12, 0x33, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x2e, 0x45, 0x6e,
0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12,
0x6d, 0x6f, 0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x2e, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x1b, 0x0a, 0x09, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x70, 0x18, 0x05, 0x20, 0x01,
0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6c, 0x69, 0x28, 0x0c, 0x52, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x70, 0x12, 0x22, 0x0a, 0x0c,
0x65, 0x6e, 0x74, 0x5f, 0x69, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x63, 0x6c, 0x73, 0x6b, 0x69, 0x70, 0x46, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x18, 0x06, 0x20, 0x01,
0x69, 0x65, 0x6e, 0x74, 0x49, 0x70, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x6b, 0x69, 0x70, 0x46, 0x61, 0x28, 0x08, 0x52, 0x0c, 0x73, 0x6b, 0x69, 0x70, 0x46, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b,
0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x73, 0x6b, 0x12, 0x56, 0x0a, 0x12, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x69, 0x7a, 0x65, 0x64, 0x5f,
0x69, 0x70, 0x46, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x12, 0x56, 0x0a, 0x12, 0x70, 0x72, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x78,
0x69, 0x6f, 0x72, 0x69, 0x74, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x64, 0x6e, 0x73, 0x2e, 0x4e, 0x61, 0x6d, 0x65,
0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x44,
0x70, 0x2e, 0x64, 0x6e, 0x73, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x52, 0x11, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x69, 0x7a,
0x2e, 0x50, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x64, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x12, 0x2c, 0x0a, 0x05, 0x67, 0x65, 0x6f, 0x69,
0x11, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x69, 0x7a, 0x65, 0x64, 0x44, 0x6f, 0x6d, 0x61, 0x70, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61,
0x69, 0x6e, 0x12, 0x2c, 0x0a, 0x05, 0x67, 0x65, 0x6f, 0x69, 0x70, 0x18, 0x03, 0x20, 0x03, 0x28, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x6f, 0x49, 0x50, 0x52,
0x0b, 0x32, 0x16, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x05, 0x67, 0x65, 0x6f, 0x69, 0x70, 0x12, 0x4c, 0x0a, 0x0e, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e,
0x74, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x6f, 0x49, 0x50, 0x52, 0x05, 0x67, 0x65, 0x6f, 0x69, 0x70, 0x61, 0x6c, 0x5f, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25,
0x12, 0x4c, 0x0a, 0x0e, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x5f, 0x72, 0x75, 0x6c, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x64, 0x6e, 0x73, 0x2e, 0x4e, 0x61,
0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x6d, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61,
0x61, 0x70, 0x70, 0x2e, 0x64, 0x6e, 0x73, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x53, 0x65, 0x72, 0x76, 0x6c, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x0d, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x52,
0x65, 0x72, 0x2e, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x42, 0x0a, 0x0e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x73, 0x74,
0x0d, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x42, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x18, 0x07, 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, 0x1a, 0x5e, 0x0a, 0x0e, 0x50, 0x72, 0x69, 0x6f,
0x72, 0x69, 0x74, 0x79, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 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, 0x1a, 0x36, 0x0a, 0x0c, 0x4f, 0x72, 0x69, 0x67,
0x69, 0x6e, 0x61, 0x6c, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x75, 0x6c, 0x65,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x75, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04,
0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65,
0x22, 0x9c, 0x04, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x39, 0x0a, 0x0b, 0x6e,
0x61, 0x6d, 0x65, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b,
0x32, 0x18, 0x2e, 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, 0x42,
0x0a, 0x0e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x73, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x0a, 0x0e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x73, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79,
0x18, 0x07, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 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, 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, 0x65, 0x67, 0x79, 0x52, 0x0d, 0x71, 0x75, 0x65, 0x72, 0x79, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65,
0x67, 0x79, 0x1a, 0x5e, 0x0a, 0x0e, 0x50, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x44, 0x6f, 0x67, 0x79, 0x12, 0x28, 0x0a, 0x0f, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x46, 0x61, 0x6c,
0x6d, 0x61, 0x69, 0x6e, 0x12, 0x34, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 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, 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, 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, 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, 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, 0x6d, 0x61, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x6f, 0x6d, 0x61,
0x69, 0x6e, 0x1a, 0x36, 0x0a, 0x0c, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x52, 0x75, 0x69, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x02,
0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x75, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x69, 0x70, 0x12, 0x25, 0x0a, 0x0e, 0x70, 0x72, 0x6f, 0x78, 0x69, 0x65, 0x64, 0x5f, 0x64, 0x6f,
0x52, 0x04, 0x72, 0x75, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x6d, 0x61, 0x69, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x70, 0x72, 0x6f, 0x78,
0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x22, 0xef, 0x05, 0x0a, 0x06, 0x43, 0x69, 0x65, 0x64, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x4a, 0x04, 0x08, 0x07, 0x10, 0x08, 0x2a,
0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x3f, 0x0a, 0x0b, 0x4e, 0x61, 0x6d, 0x65, 0x53, 0x65, 0x72, 0x45, 0x0a, 0x12, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x69, 0x6e,
0x76, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x78, 0x72, 0x61, 0x67, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x46, 0x75, 0x6c, 0x6c, 0x10, 0x00, 0x12,
0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x2e, 0x45, 0x6e, 0x64, 0x0d, 0x0a, 0x09, 0x53, 0x75, 0x62, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x10, 0x01, 0x12, 0x0b,
0x70, 0x6f, 0x69, 0x6e, 0x74, 0x42, 0x02, 0x18, 0x01, 0x52, 0x0b, 0x4e, 0x61, 0x6d, 0x65, 0x53, 0x0a, 0x07, 0x4b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x52,
0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x12, 0x39, 0x0a, 0x0b, 0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x73, 0x65, 0x67, 0x65, 0x78, 0x10, 0x03, 0x2a, 0x35, 0x0a, 0x0d, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53,
0x65, 0x72, 0x76, 0x65, 0x72, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x78, 0x72, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x12, 0x0a, 0x0a, 0x06, 0x55, 0x53, 0x45, 0x5f, 0x49,
0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x64, 0x6e, 0x73, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x53, 0x50, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x53, 0x45, 0x5f, 0x49, 0x50, 0x34, 0x10, 0x01,
0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x0a, 0x6e, 0x61, 0x6d, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x53, 0x45, 0x5f, 0x49, 0x50, 0x36, 0x10, 0x02, 0x42, 0x46, 0x0a,
0x72, 0x12, 0x39, 0x0a, 0x05, 0x48, 0x6f, 0x73, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x64, 0x6e,
0x32, 0x1f, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x64, 0x6e, 0x73, 0x2e, 0x73, 0x50, 0x01, 0x5a, 0x21, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x78, 0x74, 0x6c, 0x73, 0x2f, 0x78, 0x72, 0x61, 0x79, 0x2d, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x61,
0x79, 0x42, 0x02, 0x18, 0x01, 0x52, 0x05, 0x48, 0x6f, 0x73, 0x74, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x70, 0x2f, 0x64, 0x6e, 0x73, 0xaa, 0x02, 0x0c, 0x58, 0x72, 0x61, 0x79, 0x2e, 0x41, 0x70,
0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x70, 0x2e, 0x44, 0x6e, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
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, 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, 0x1a, 0x55, 0x0a, 0x0a, 0x48, 0x6f,
0x73, 0x74, 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, 0x31, 0x0a, 0x05, 0x76, 0x61,
0x6c, 0x75, 0x65, 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, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38,
0x01, 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, 0x35, 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, 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 (
@@ -657,39 +616,34 @@ func file_app_dns_config_proto_rawDescGZIP() []byte {
} }
var file_app_dns_config_proto_enumTypes = make([]protoimpl.EnumInfo, 2) var file_app_dns_config_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
var file_app_dns_config_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_app_dns_config_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_app_dns_config_proto_goTypes = []interface{}{ var file_app_dns_config_proto_goTypes = []any{
(DomainMatchingType)(0), // 0: xray.app.dns.DomainMatchingType (DomainMatchingType)(0), // 0: xray.app.dns.DomainMatchingType
(QueryStrategy)(0), // 1: xray.app.dns.QueryStrategy (QueryStrategy)(0), // 1: xray.app.dns.QueryStrategy
(*NameServer)(nil), // 2: xray.app.dns.NameServer (*NameServer)(nil), // 2: xray.app.dns.NameServer
(*Config)(nil), // 3: xray.app.dns.Config (*Config)(nil), // 3: xray.app.dns.Config
(*NameServer_PriorityDomain)(nil), // 4: xray.app.dns.NameServer.PriorityDomain (*NameServer_PriorityDomain)(nil), // 4: xray.app.dns.NameServer.PriorityDomain
(*NameServer_OriginalRule)(nil), // 5: xray.app.dns.NameServer.OriginalRule (*NameServer_OriginalRule)(nil), // 5: xray.app.dns.NameServer.OriginalRule
nil, // 6: xray.app.dns.Config.HostsEntry (*Config_HostMapping)(nil), // 6: xray.app.dns.Config.HostMapping
(*Config_HostMapping)(nil), // 7: xray.app.dns.Config.HostMapping (*net.Endpoint)(nil), // 7: xray.common.net.Endpoint
(*net.Endpoint)(nil), // 8: xray.common.net.Endpoint (*router.GeoIP)(nil), // 8: xray.app.router.GeoIP
(*router.GeoIP)(nil), // 9: xray.app.router.GeoIP
(*net.IPOrDomain)(nil), // 10: xray.common.net.IPOrDomain
} }
var file_app_dns_config_proto_depIdxs = []int32{ var file_app_dns_config_proto_depIdxs = []int32{
8, // 0: xray.app.dns.NameServer.address:type_name -> xray.common.net.Endpoint 7, // 0: xray.app.dns.NameServer.address:type_name -> xray.common.net.Endpoint
4, // 1: xray.app.dns.NameServer.prioritized_domain:type_name -> xray.app.dns.NameServer.PriorityDomain 4, // 1: xray.app.dns.NameServer.prioritized_domain:type_name -> xray.app.dns.NameServer.PriorityDomain
9, // 2: xray.app.dns.NameServer.geoip:type_name -> xray.app.router.GeoIP 8, // 2: xray.app.dns.NameServer.geoip:type_name -> xray.app.router.GeoIP
5, // 3: xray.app.dns.NameServer.original_rules:type_name -> xray.app.dns.NameServer.OriginalRule 5, // 3: xray.app.dns.NameServer.original_rules:type_name -> xray.app.dns.NameServer.OriginalRule
1, // 4: xray.app.dns.NameServer.query_strategy:type_name -> xray.app.dns.QueryStrategy 1, // 4: xray.app.dns.NameServer.query_strategy:type_name -> xray.app.dns.QueryStrategy
8, // 5: xray.app.dns.Config.NameServers:type_name -> xray.common.net.Endpoint 2, // 5: xray.app.dns.Config.name_server:type_name -> xray.app.dns.NameServer
2, // 6: xray.app.dns.Config.name_server:type_name -> xray.app.dns.NameServer 6, // 6: xray.app.dns.Config.static_hosts:type_name -> xray.app.dns.Config.HostMapping
6, // 7: xray.app.dns.Config.Hosts:type_name -> xray.app.dns.Config.HostsEntry 1, // 7: xray.app.dns.Config.query_strategy:type_name -> xray.app.dns.QueryStrategy
7, // 8: xray.app.dns.Config.static_hosts:type_name -> xray.app.dns.Config.HostMapping 0, // 8: xray.app.dns.NameServer.PriorityDomain.type:type_name -> xray.app.dns.DomainMatchingType
1, // 9: xray.app.dns.Config.query_strategy:type_name -> xray.app.dns.QueryStrategy 0, // 9: xray.app.dns.Config.HostMapping.type:type_name -> xray.app.dns.DomainMatchingType
0, // 10: xray.app.dns.NameServer.PriorityDomain.type:type_name -> xray.app.dns.DomainMatchingType 10, // [10:10] is the sub-list for method output_type
10, // 11: xray.app.dns.Config.HostsEntry.value:type_name -> xray.common.net.IPOrDomain 10, // [10:10] is the sub-list for method input_type
0, // 12: xray.app.dns.Config.HostMapping.type:type_name -> xray.app.dns.DomainMatchingType 10, // [10:10] is the sub-list for extension type_name
13, // [13:13] is the sub-list for method output_type 10, // [10:10] is the sub-list for extension extendee
13, // [13:13] is the sub-list for method input_type 0, // [0:10] is the sub-list for field type_name
13, // [13:13] is the sub-list for extension type_name
13, // [13:13] is the sub-list for extension extendee
0, // [0:13] is the sub-list for field type_name
} }
func init() { file_app_dns_config_proto_init() } func init() { file_app_dns_config_proto_init() }
@@ -698,7 +652,7 @@ func file_app_dns_config_proto_init() {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_app_dns_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { file_app_dns_config_proto_msgTypes[0].Exporter = func(v any, i int) any {
switch v := v.(*NameServer); i { switch v := v.(*NameServer); i {
case 0: case 0:
return &v.state return &v.state
@@ -710,7 +664,7 @@ func file_app_dns_config_proto_init() {
return nil return nil
} }
} }
file_app_dns_config_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { file_app_dns_config_proto_msgTypes[1].Exporter = func(v any, i int) any {
switch v := v.(*Config); i { switch v := v.(*Config); i {
case 0: case 0:
return &v.state return &v.state
@@ -722,7 +676,7 @@ func file_app_dns_config_proto_init() {
return nil return nil
} }
} }
file_app_dns_config_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { file_app_dns_config_proto_msgTypes[2].Exporter = func(v any, i int) any {
switch v := v.(*NameServer_PriorityDomain); i { switch v := v.(*NameServer_PriorityDomain); i {
case 0: case 0:
return &v.state return &v.state
@@ -734,7 +688,7 @@ func file_app_dns_config_proto_init() {
return nil return nil
} }
} }
file_app_dns_config_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { file_app_dns_config_proto_msgTypes[3].Exporter = func(v any, i int) any {
switch v := v.(*NameServer_OriginalRule); i { switch v := v.(*NameServer_OriginalRule); i {
case 0: case 0:
return &v.state return &v.state
@@ -746,7 +700,7 @@ func file_app_dns_config_proto_init() {
return nil return nil
} }
} }
file_app_dns_config_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { file_app_dns_config_proto_msgTypes[4].Exporter = func(v any, i int) any {
switch v := v.(*Config_HostMapping); i { switch v := v.(*Config_HostMapping); i {
case 0: case 0:
return &v.state return &v.state
@@ -765,7 +719,7 @@ func file_app_dns_config_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_app_dns_config_proto_rawDesc, RawDescriptor: file_app_dns_config_proto_rawDesc,
NumEnums: 2, NumEnums: 2,
NumMessages: 6, NumMessages: 5,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,
}, },

View File

@@ -6,7 +6,6 @@ option go_package = "github.com/xtls/xray-core/app/dns";
option java_package = "com.xray.app.dns"; option java_package = "com.xray.app.dns";
option java_multiple_files = true; option java_multiple_files = true;
import "common/net/address.proto";
import "common/net/destination.proto"; import "common/net/destination.proto";
import "app/router/config.proto"; import "app/router/config.proto";
@@ -45,18 +44,10 @@ enum QueryStrategy {
} }
message Config { message Config {
// Nameservers used by this DNS. Only traditional UDP servers are support at
// the moment. A special value 'localhost' as a domain address can be set to
// use DNS on local system.
repeated xray.common.net.Endpoint NameServers = 1 [deprecated = true];
// 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.
repeated NameServer name_server = 5; repeated NameServer name_server = 5;
// Static hosts. Domain to IP.
// Deprecated. Use static_hosts.
map<string, xray.common.net.IPOrDomain> Hosts = 2 [deprecated = true];
// Client IP for EDNS client subnet. Must be 4 bytes (IPv4) or 16 bytes // Client IP for EDNS client subnet. Must be 4 bytes (IPv4) or 16 bytes
// (IPv6). // (IPv6).
bytes client_ip = 3; bytes client_ip = 3;

View File

@@ -1,8 +1,6 @@
// Package dns is an implementation of core.DNS feature. // Package dns is an implementation of core.DNS feature.
package dns package dns
//go:generate go run github.com/xtls/xray-core/common/errors/errorgen
import ( import (
"context" "context"
"fmt" "fmt"
@@ -15,7 +13,6 @@ import (
"github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/net"
"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"
"github.com/xtls/xray-core/features/dns" "github.com/xtls/xray-core/features/dns"
) )
@@ -79,7 +76,7 @@ func New(ctx context.Context, config *Config) (*DNS, error) {
} }
} }
hosts, err := NewStaticHosts(config.StaticHosts, config.Hosts) hosts, err := NewStaticHosts(config.StaticHosts)
if err != nil { if err != nil {
return nil, errors.New("failed to create hosts").Base(err) return nil, errors.New("failed to create hosts").Base(err)
} }
@@ -95,15 +92,6 @@ func New(ctx context.Context, config *Config) (*DNS, error) {
domainMatcher := &strmatcher.MatcherGroup{} domainMatcher := &strmatcher.MatcherGroup{}
geoipContainer := router.GeoIPMatcherContainer{} geoipContainer := router.GeoIPMatcherContainer{}
for _, endpoint := range config.NameServers {
features.PrintDeprecatedFeatureWarning("simple DNS server")
client, err := NewSimpleClient(ctx, endpoint, clientIP)
if err != nil {
return nil, errors.New("failed to create client").Base(err)
}
clients = append(clients, client)
}
for _, ns := range config.NameServer { for _, ns := range config.NameServer {
clientIdx := len(clients) clientIdx := len(clients)
updateDomain := func(domainRule strmatcher.Matcher, originalRuleIdx int, matcherInfos []*DomainMatcherInfo) error { updateDomain := func(domainRule strmatcher.Matcher, originalRuleIdx int, matcherInfos []*DomainMatcherInfo) error {

View File

@@ -124,8 +124,9 @@ func TestUDPServerSubnet(t *testing.T) {
config := &core.Config{ config := &core.Config{
App: []*serial.TypedMessage{ App: []*serial.TypedMessage{
serial.ToTypedMessage(&Config{ serial.ToTypedMessage(&Config{
NameServers: []*net.Endpoint{ NameServer: []*NameServer{
{ {
Address: &net.Endpoint{
Network: net.Network_UDP, Network: net.Network_UDP,
Address: &net.IPOrDomain{ Address: &net.IPOrDomain{
Address: &net.IPOrDomain_Ip{ Address: &net.IPOrDomain_Ip{
@@ -135,6 +136,7 @@ func TestUDPServerSubnet(t *testing.T) {
Port: uint32(port), Port: uint32(port),
}, },
}, },
},
ClientIp: []byte{7, 8, 9, 10}, ClientIp: []byte{7, 8, 9, 10},
}), }),
serial.ToTypedMessage(&dispatcher.Config{}), serial.ToTypedMessage(&dispatcher.Config{}),
@@ -183,8 +185,9 @@ func TestUDPServer(t *testing.T) {
config := &core.Config{ config := &core.Config{
App: []*serial.TypedMessage{ App: []*serial.TypedMessage{
serial.ToTypedMessage(&Config{ serial.ToTypedMessage(&Config{
NameServers: []*net.Endpoint{ NameServer: []*NameServer{
{ {
Address: &net.Endpoint{
Network: net.Network_UDP, Network: net.Network_UDP,
Address: &net.IPOrDomain{ Address: &net.IPOrDomain{
Address: &net.IPOrDomain_Ip{ Address: &net.IPOrDomain_Ip{
@@ -194,6 +197,7 @@ func TestUDPServer(t *testing.T) {
Port: uint32(port), Port: uint32(port),
}, },
}, },
},
}), }),
serial.ToTypedMessage(&dispatcher.Config{}), serial.ToTypedMessage(&dispatcher.Config{}),
serial.ToTypedMessage(&proxyman.OutboundConfig{}), serial.ToTypedMessage(&proxyman.OutboundConfig{}),
@@ -303,8 +307,9 @@ func TestPrioritizedDomain(t *testing.T) {
config := &core.Config{ config := &core.Config{
App: []*serial.TypedMessage{ App: []*serial.TypedMessage{
serial.ToTypedMessage(&Config{ serial.ToTypedMessage(&Config{
NameServers: []*net.Endpoint{ NameServer: []*NameServer{
{ {
Address: &net.Endpoint{
Network: net.Network_UDP, Network: net.Network_UDP,
Address: &net.IPOrDomain{ Address: &net.IPOrDomain{
Address: &net.IPOrDomain_Ip{ Address: &net.IPOrDomain_Ip{
@@ -314,7 +319,6 @@ func TestPrioritizedDomain(t *testing.T) {
Port: 9999, /* unreachable */ Port: 9999, /* unreachable */
}, },
}, },
NameServer: []*NameServer{
{ {
Address: &net.Endpoint{ Address: &net.Endpoint{
Network: net.Network_UDP, Network: net.Network_UDP,
@@ -389,8 +393,9 @@ func TestUDPServerIPv6(t *testing.T) {
config := &core.Config{ config := &core.Config{
App: []*serial.TypedMessage{ App: []*serial.TypedMessage{
serial.ToTypedMessage(&Config{ serial.ToTypedMessage(&Config{
NameServers: []*net.Endpoint{ NameServer: []*NameServer{
{ {
Address: &net.Endpoint{
Network: net.Network_UDP, Network: net.Network_UDP,
Address: &net.IPOrDomain{ Address: &net.IPOrDomain{
Address: &net.IPOrDomain_Ip{ Address: &net.IPOrDomain_Ip{
@@ -400,6 +405,7 @@ func TestUDPServerIPv6(t *testing.T) {
Port: uint32(port), Port: uint32(port),
}, },
}, },
},
}), }),
serial.ToTypedMessage(&dispatcher.Config{}), serial.ToTypedMessage(&dispatcher.Config{}),
serial.ToTypedMessage(&proxyman.OutboundConfig{}), serial.ToTypedMessage(&proxyman.OutboundConfig{}),
@@ -448,8 +454,9 @@ func TestStaticHostDomain(t *testing.T) {
config := &core.Config{ config := &core.Config{
App: []*serial.TypedMessage{ App: []*serial.TypedMessage{
serial.ToTypedMessage(&Config{ serial.ToTypedMessage(&Config{
NameServers: []*net.Endpoint{ NameServer: []*NameServer{
{ {
Address: &net.Endpoint{
Network: net.Network_UDP, Network: net.Network_UDP,
Address: &net.IPOrDomain{ Address: &net.IPOrDomain{
Address: &net.IPOrDomain_Ip{ Address: &net.IPOrDomain_Ip{
@@ -459,6 +466,7 @@ func TestStaticHostDomain(t *testing.T) {
Port: uint32(port), Port: uint32(port),
}, },
}, },
},
StaticHosts: []*Config_HostMapping{ StaticHosts: []*Config_HostMapping{
{ {
Type: DomainMatchingType_Full, Type: DomainMatchingType_Full,
@@ -631,8 +639,9 @@ func TestLocalDomain(t *testing.T) {
config := &core.Config{ config := &core.Config{
App: []*serial.TypedMessage{ App: []*serial.TypedMessage{
serial.ToTypedMessage(&Config{ serial.ToTypedMessage(&Config{
NameServers: []*net.Endpoint{ NameServer: []*NameServer{
{ {
Address: &net.Endpoint{
Network: net.Network_UDP, Network: net.Network_UDP,
Address: &net.IPOrDomain{ Address: &net.IPOrDomain{
Address: &net.IPOrDomain_Ip{ Address: &net.IPOrDomain_Ip{
@@ -642,7 +651,6 @@ func TestLocalDomain(t *testing.T) {
Port: 9999, /* unreachable */ Port: 9999, /* unreachable */
}, },
}, },
NameServer: []*NameServer{
{ {
Address: &net.Endpoint{ Address: &net.Endpoint{
Network: net.Network_UDP, Network: net.Network_UDP,
@@ -859,8 +867,9 @@ func TestMultiMatchPrioritizedDomain(t *testing.T) {
config := &core.Config{ config := &core.Config{
App: []*serial.TypedMessage{ App: []*serial.TypedMessage{
serial.ToTypedMessage(&Config{ serial.ToTypedMessage(&Config{
NameServers: []*net.Endpoint{ NameServer: []*NameServer{
{ {
Address: &net.Endpoint{
Network: net.Network_UDP, Network: net.Network_UDP,
Address: &net.IPOrDomain{ Address: &net.IPOrDomain{
Address: &net.IPOrDomain_Ip{ Address: &net.IPOrDomain_Ip{
@@ -870,7 +879,6 @@ func TestMultiMatchPrioritizedDomain(t *testing.T) {
Port: 9999, /* unreachable */ Port: 9999, /* unreachable */
}, },
}, },
NameServer: []*NameServer{
{ {
Address: &net.Endpoint{ Address: &net.Endpoint{
Network: net.Network_UDP, Network: net.Network_UDP,

View File

@@ -1,3 +1 @@
package fakedns package fakedns
//go:generate go run github.com/xtls/xray-core/common/errors/errorgen

View File

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

View File

@@ -3,11 +3,9 @@ package dns
import ( import (
"context" "context"
"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/strmatcher" "github.com/xtls/xray-core/common/strmatcher"
"github.com/xtls/xray-core/features"
"github.com/xtls/xray-core/features/dns" "github.com/xtls/xray-core/features/dns"
) )
@@ -18,30 +16,13 @@ type StaticHosts struct {
} }
// NewStaticHosts creates a new StaticHosts instance. // NewStaticHosts creates a new StaticHosts instance.
func NewStaticHosts(hosts []*Config_HostMapping, legacy map[string]*net.IPOrDomain) (*StaticHosts, error) { func NewStaticHosts(hosts []*Config_HostMapping) (*StaticHosts, error) {
g := new(strmatcher.MatcherGroup) g := new(strmatcher.MatcherGroup)
sh := &StaticHosts{ sh := &StaticHosts{
ips: make([][]net.Address, len(hosts)+len(legacy)+16), ips: make([][]net.Address, len(hosts)+16),
matchers: g, matchers: g,
} }
if legacy != nil {
features.PrintDeprecatedFeatureWarning("simple host mapping")
for domain, ip := range legacy {
matcher, err := strmatcher.Full.New(domain)
common.Must(err)
id := g.Add(matcher)
address := ip.AsAddress()
if address.Family().IsDomain() {
return nil, errors.New("invalid domain address in static hosts: ", address.Domain()).AtWarning()
}
sh.ips[id] = []net.Address{address}
}
}
for _, mapping := range hosts { for _, mapping := range hosts {
matcher, err := toStrMatcher(mapping.Type, mapping.Domain) matcher, err := toStrMatcher(mapping.Type, mapping.Domain)
if err != nil { if err != nil {

View File

@@ -50,7 +50,7 @@ func TestStaticHosts(t *testing.T) {
}, },
} }
hosts, err := NewStaticHosts(pb, nil) hosts, err := NewStaticHosts(pb)
common.Must(err) common.Must(err)
{ {

View File

@@ -62,7 +62,7 @@ func NewServer(dest net.Destination, dispatcher routing.Dispatcher, queryStrateg
dest.Network = net.Network_UDP dest.Network = net.Network_UDP
} }
if dest.Network == net.Network_UDP { // UDP classic DNS mode if dest.Network == net.Network_UDP { // UDP classic DNS mode
return NewClassicNameServer(dest, dispatcher), nil return NewClassicNameServer(dest, dispatcher, queryStrategy), nil
} }
return nil, errors.New("No available name server could be created from ", dest).AtWarning() return nil, errors.New("No available name server could be created from ", dest).AtWarning()
} }
@@ -90,7 +90,7 @@ func NewClient(
ns.PrioritizedDomain = append(ns.PrioritizedDomain, localTLDsAndDotlessDomains...) ns.PrioritizedDomain = append(ns.PrioritizedDomain, localTLDsAndDotlessDomains...)
ns.OriginalRules = append(ns.OriginalRules, localTLDsAndDotlessDomainsRule) ns.OriginalRules = append(ns.OriginalRules, localTLDsAndDotlessDomainsRule)
// The following lines is a solution to avoid core panicsrule index out of range when setting `localhost` DNS client in config. // The following lines is a solution to avoid core panicsrule index out of range when setting `localhost` DNS client in config.
// Because the `localhost` DNS client will apend len(localTLDsAndDotlessDomains) rules into matcherInfos to match `geosite:private` default rule. // Because the `localhost` DNS client will append len(localTLDsAndDotlessDomains) rules into matcherInfos to match `geosite:private` default rule.
// But `matcherInfos` has no enough length to add rules, which leads to core panics (rule index out of range). // But `matcherInfos` has no enough length to add rules, which leads to core panics (rule index out of range).
// To avoid this, the length of `matcherInfos` must be equal to the expected, so manually append it with Golang default zero value first for later modification. // To avoid this, the length of `matcherInfos` must be equal to the expected, so manually append it with Golang default zero value first for later modification.
// Related issues: // Related issues:
@@ -163,31 +163,6 @@ func NewClient(
return client, err return client, err
} }
// NewSimpleClient creates a DNS client with a simple destination.
func NewSimpleClient(ctx context.Context, endpoint *net.Endpoint, clientIP net.IP) (*Client, error) {
client := &Client{}
err := core.RequireFeatures(ctx, func(dispatcher routing.Dispatcher) error {
server, err := NewServer(endpoint.AsDestination(), dispatcher, QueryStrategy_USE_IP)
if err != nil {
return errors.New("failed to create nameserver").Base(err).AtWarning()
}
client.server = server
client.clientIP = clientIP
return nil
})
if len(clientIP) > 0 {
switch endpoint.Address.GetAddress().(type) {
case *net.IPOrDomain_Domain:
errors.LogInfo(ctx, "DNS: client ", endpoint.Address.GetDomain(), " uses clientIP ", clientIP.String())
case *net.IPOrDomain_Ip:
errors.LogInfo(ctx, "DNS: client ", endpoint.Address.GetIp(), " uses clientIP ", clientIP.String())
}
}
return client, err
}
// Name returns the server name the client manages. // Name returns the server name the client manages.
func (c *Client) Name() string { func (c *Client) Name() string {
return c.server.Name() return c.server.Name()

View File

@@ -365,7 +365,7 @@ func (s *DoHNameServer) QueryIP(ctx context.Context, domain string, clientIP net
errors.LogDebug(ctx, "DNS cache is disabled. Querying IP for ", domain, " at ", s.name) errors.LogDebug(ctx, "DNS cache is disabled. Querying IP for ", domain, " at ", s.name)
} else { } else {
ips, err := s.findIPsForDomain(fqdn, option) ips, err := s.findIPsForDomain(fqdn, option)
if err != errRecordNotFound { if err == nil || err == dns_feature.ErrEmptyResponse {
errors.LogDebugInner(ctx, err, s.name, " cache HIT ", domain, " -> ", ips) errors.LogDebugInner(ctx, err, s.name, " cache HIT ", domain, " -> ", ips)
log.Record(&log.DNSLog{Server: s.name, Domain: domain, Result: ips, Status: log.DNSCacheHit, Elapsed: 0, Error: err}) log.Record(&log.DNSLog{Server: s.name, Domain: domain, Result: ips, Status: log.DNSCacheHit, Elapsed: 0, Error: err})
return ips, err return ips, err

View File

@@ -300,7 +300,7 @@ func (s *QUICNameServer) QueryIP(ctx context.Context, domain string, clientIP ne
errors.LogDebug(ctx, "DNS cache is disabled. Querying IP for ", domain, " at ", s.name) errors.LogDebug(ctx, "DNS cache is disabled. Querying IP for ", domain, " at ", s.name)
} else { } else {
ips, err := s.findIPsForDomain(fqdn, option) ips, err := s.findIPsForDomain(fqdn, option)
if err != errRecordNotFound { if err == nil || err == dns_feature.ErrEmptyResponse {
errors.LogDebugInner(ctx, err, s.name, " cache HIT ", domain, " -> ", ips) errors.LogDebugInner(ctx, err, s.name, " cache HIT ", domain, " -> ", ips)
log.Record(&log.DNSLog{Server: s.name, Domain: domain, Result: ips, Status: log.DNSCacheHit, Elapsed: 0, Error: err}) log.Record(&log.DNSLog{Server: s.name, Domain: domain, Result: ips, Status: log.DNSCacheHit, Elapsed: 0, Error: err})
return ips, err return ips, err

View File

@@ -323,7 +323,7 @@ func (s *TCPNameServer) QueryIP(ctx context.Context, domain string, clientIP net
errors.LogDebug(ctx, "DNS cache is disabled. Querying IP for ", domain, " at ", s.name) errors.LogDebug(ctx, "DNS cache is disabled. Querying IP for ", domain, " at ", s.name)
} else { } else {
ips, err := s.findIPsForDomain(fqdn, option) ips, err := s.findIPsForDomain(fqdn, option)
if err != errRecordNotFound { if err == nil || err == dns_feature.ErrEmptyResponse {
errors.LogDebugInner(ctx, err, s.name, " cache HIT ", domain, " -> ", ips) errors.LogDebugInner(ctx, err, s.name, " cache HIT ", domain, " -> ", ips)
log.Record(&log.DNSLog{Server: s.name, Domain: domain, Result: ips, Status: log.DNSCacheHit, Elapsed: 0, Error: err}) log.Record(&log.DNSLog{Server: s.name, Domain: domain, Result: ips, Status: log.DNSCacheHit, Elapsed: 0, Error: err})
return ips, err return ips, err

View File

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

View File

@@ -1,7 +1,5 @@
package command package command
//go:generate go run github.com/xtls/xray-core/common/errors/errorgen
import ( import (
"context" "context"

View File

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

View File

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

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.34.1 // protoc-gen-go v1.34.2
// protoc v5.27.0 // protoc v5.27.0
// source: app/log/config.proto // source: app/log/config.proto
@@ -84,6 +84,7 @@ type Config struct {
AccessLogType LogType `protobuf:"varint,4,opt,name=access_log_type,json=accessLogType,proto3,enum=xray.app.log.LogType" json:"access_log_type,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"` 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"` 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() {
@@ -160,13 +161,20 @@ func (x *Config) GetEnableDnsLog() bool {
return false return false
} }
func (x *Config) GetMaskAddress() string {
if x != nil {
return x.MaskAddress
}
return ""
}
var File_app_log_config_proto protoreflect.FileDescriptor var File_app_log_config_proto protoreflect.FileDescriptor
var file_app_log_config_proto_rawDesc = []byte{ var file_app_log_config_proto_rawDesc = []byte{
0x0a, 0x14, 0x61, 0x70, 0x70, 0x2f, 0x6c, 0x6f, 0x67, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x0a, 0x14, 0x61, 0x70, 0x70, 0x2f, 0x6c, 0x6f, 0x67, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70,
0x2e, 0x6c, 0x6f, 0x67, 0x1a, 0x14, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x6c, 0x6f, 0x67, 0x2e, 0x6c, 0x6f, 0x67, 0x1a, 0x14, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x6c, 0x6f, 0x67,
0x2f, 0x6c, 0x6f, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbb, 0x02, 0x0a, 0x06, 0x43, 0x2f, 0x6c, 0x6f, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xde, 0x02, 0x0a, 0x06, 0x43,
0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x3b, 0x0a, 0x0e, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6c, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x3b, 0x0a, 0x0e, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6c,
0x6f, 0x67, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x6f, 0x67, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e,
0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x6c, 0x6f, 0x67, 0x2e, 0x4c, 0x6f, 0x67, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x6c, 0x6f, 0x67, 0x2e, 0x4c, 0x6f, 0x67,
@@ -186,15 +194,18 @@ var file_app_log_config_proto_rawDesc = []byte{
0x01, 0x28, 0x09, 0x52, 0x0d, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4c, 0x6f, 0x67, 0x50, 0x61, 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, 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, 0x5f, 0x6c, 0x6f, 0x67, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x65, 0x6e, 0x61, 0x62,
0x6c, 0x65, 0x44, 0x6e, 0x73, 0x4c, 0x6f, 0x67, 0x2a, 0x35, 0x0a, 0x07, 0x4c, 0x6f, 0x67, 0x54, 0x6c, 0x65, 0x44, 0x6e, 0x73, 0x4c, 0x6f, 0x67, 0x12, 0x21, 0x0a, 0x0c, 0x6d, 0x61, 0x73, 0x6b,
0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x6f, 0x6e, 0x65, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b,
0x07, 0x43, 0x6f, 0x6e, 0x73, 0x6f, 0x6c, 0x65, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x46, 0x69, 0x6d, 0x61, 0x73, 0x6b, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2a, 0x35, 0x0a, 0x07, 0x4c,
0x6c, 0x65, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x10, 0x03, 0x42, 0x6f, 0x67, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x6f, 0x6e, 0x65, 0x10, 0x00,
0x46, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x73, 0x6f, 0x6c, 0x65, 0x10, 0x01, 0x12, 0x08, 0x0a,
0x6c, 0x6f, 0x67, 0x50, 0x01, 0x5a, 0x21, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x04, 0x46, 0x69, 0x6c, 0x65, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x76, 0x65, 0x6e, 0x74,
0x6d, 0x2f, 0x78, 0x74, 0x6c, 0x73, 0x2f, 0x78, 0x72, 0x61, 0x79, 0x2d, 0x63, 0x6f, 0x72, 0x65, 0x10, 0x03, 0x42, 0x46, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61,
0x2f, 0x61, 0x70, 0x70, 0x2f, 0x6c, 0x6f, 0x67, 0xaa, 0x02, 0x0c, 0x58, 0x72, 0x61, 0x79, 0x2e, 0x70, 0x70, 0x2e, 0x6c, 0x6f, 0x67, 0x50, 0x01, 0x5a, 0x21, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62,
0x41, 0x70, 0x70, 0x2e, 0x4c, 0x6f, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 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 (
@@ -211,7 +222,7 @@ func file_app_log_config_proto_rawDescGZIP() []byte {
var file_app_log_config_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_app_log_config_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_app_log_config_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_app_log_config_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_app_log_config_proto_goTypes = []interface{}{ var file_app_log_config_proto_goTypes = []any{
(LogType)(0), // 0: xray.app.log.LogType (LogType)(0), // 0: xray.app.log.LogType
(*Config)(nil), // 1: xray.app.log.Config (*Config)(nil), // 1: xray.app.log.Config
(log.Severity)(0), // 2: xray.common.log.Severity (log.Severity)(0), // 2: xray.common.log.Severity
@@ -233,7 +244,7 @@ func file_app_log_config_proto_init() {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_app_log_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { file_app_log_config_proto_msgTypes[0].Exporter = func(v any, i int) any {
switch v := v.(*Config); i { switch v := v.(*Config); i {
case 0: case 0:
return &v.state return &v.state

View File

@@ -23,4 +23,5 @@ message Config {
LogType access_log_type = 4; LogType access_log_type = 4;
string access_log_path = 5; string access_log_path = 5;
bool enable_dns_log = 6; bool enable_dns_log = 6;
string mask_address= 7;
} }

View File

@@ -1,9 +1,10 @@
package log package log
//go:generate go run github.com/xtls/xray-core/common/errors/errorgen
import ( import (
"context" "context"
"fmt"
"regexp"
"strings"
"sync" "sync"
"github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common"
@@ -101,18 +102,25 @@ func (g *Instance) Handle(msg log.Message) {
return return
} }
var Msg log.Message
if g.config.MaskAddress != "" {
Msg = &MaskedMsgWrapper{Message: msg, config: g.config}
} else {
Msg = msg
}
switch msg := msg.(type) { switch msg := msg.(type) {
case *log.AccessMessage: case *log.AccessMessage:
if g.accessLogger != nil { if g.accessLogger != nil {
g.accessLogger.Handle(msg) g.accessLogger.Handle(Msg)
} }
case *log.DNSLog: case *log.DNSLog:
if g.dns && g.accessLogger != nil { if g.dns && g.accessLogger != nil {
g.accessLogger.Handle(msg) g.accessLogger.Handle(Msg)
} }
case *log.GeneralMessage: case *log.GeneralMessage:
if g.errorLogger != nil && msg.Severity <= g.config.ErrorLogLevel { if g.errorLogger != nil && msg.Severity <= g.config.ErrorLogLevel {
g.errorLogger.Handle(msg) g.errorLogger.Handle(Msg)
} }
default: default:
// Swallow // Swallow
@@ -141,6 +149,56 @@ func (g *Instance) Close() error {
return nil return nil
} }
// MaskedMsgWrapper is to wrap the string() method to mask IP addresses in the log.
type MaskedMsgWrapper struct {
log.Message
config *Config
}
func (m *MaskedMsgWrapper) String() 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
maskedMsg := ipv4Regex.ReplaceAllStringFunc(str, func(ip string) string {
parts := strings.Split(ip, ".")
switch m.config.MaskAddress {
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
}
})
// process ipv6
maskedMsg = ipv6Regex.ReplaceAllStringFunc(maskedMsg, func(ip string) string {
parts := strings.Split(ip, ":")
switch m.config.MaskAddress {
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
})
return maskedMsg
}
func init() { func init() {
common.Must(common.RegisterConfig((*Config)(nil), func(ctx context.Context, config interface{}) (interface{}, error) { common.Must(common.RegisterConfig((*Config)(nil), func(ctx context.Context, config interface{}) (interface{}, error) {
return New(ctx, config.(*Config)) return New(ctx, config.(*Config))

View File

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

View File

@@ -5,8 +5,6 @@ import (
"time" "time"
) )
//go:generate go run github.com/v2fly/v2ray-core/v4/common/errors/errorgen
const ( const (
rttFailed = time.Duration(math.MaxInt64 - iota) rttFailed = time.Duration(math.MaxInt64 - iota)
rttUntested rttUntested

View File

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

View File

@@ -156,7 +156,7 @@ func (h *HealthPing) doCheck(tags []string, duration time.Duration, rounds int)
for i := 0; i < rounds; i++ { for i := 0; i < rounds; i++ {
delay := time.Duration(0) delay := time.Duration(0)
if duration > 0 { if duration > 0 {
delay = time.Duration(dice.Roll(int(duration))) delay = time.Duration(dice.RollInt63n(int64(duration)))
} }
time.AfterFunc(delay, func() { time.AfterFunc(delay, func() {
errors.LogDebug(h.ctx, "checking ", handler) errors.LogDebug(h.ctx, "checking ", handler)

View File

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

View File

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

View File

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

View File

@@ -1,3 +1 @@
package observatory package observatory
//go:generate go run github.com/xtls/xray-core/common/errors/errorgen

View File

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

View File

@@ -1,4 +1,2 @@
// Package policy is an implementation of policy.Manager feature. // Package policy is an implementation of policy.Manager feature.
package policy package policy
//go:generate go run github.com/xtls/xray-core/common/errors/errorgen

View File

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

View File

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

View File

@@ -1,3 +1 @@
package command package command
//go:generate go run github.com/xtls/xray-core/common/errors/errorgen

View File

@@ -19,21 +19,5 @@ func (c *ReceiverConfig) GetEffectiveSniffingSettings() *SniffingConfig {
return c.SniffingSettings return c.SniffingSettings
} }
if len(c.DomainOverride) > 0 {
var p []string
for _, kd := range c.DomainOverride {
switch kd {
case KnownProtocols_HTTP:
p = append(p, "http")
case KnownProtocols_TLS:
p = append(p, "tls")
}
}
return &SniffingConfig{
Enabled: true,
DestinationOverride: p,
}
}
return nil return nil
} }

View 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.34.1 // protoc-gen-go v1.34.2
// protoc v5.27.0 // protoc v5.28.0
// source: app/proxyman/config.proto // source: app/proxyman/config.proto
package proxyman package proxyman
@@ -23,52 +23,6 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
) )
type KnownProtocols int32
const (
KnownProtocols_HTTP KnownProtocols = 0
KnownProtocols_TLS KnownProtocols = 1
)
// Enum value maps for KnownProtocols.
var (
KnownProtocols_name = map[int32]string{
0: "HTTP",
1: "TLS",
}
KnownProtocols_value = map[string]int32{
"HTTP": 0,
"TLS": 1,
}
)
func (x KnownProtocols) Enum() *KnownProtocols {
p := new(KnownProtocols)
*p = x
return p
}
func (x KnownProtocols) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (KnownProtocols) Descriptor() protoreflect.EnumDescriptor {
return file_app_proxyman_config_proto_enumTypes[0].Descriptor()
}
func (KnownProtocols) Type() protoreflect.EnumType {
return &file_app_proxyman_config_proto_enumTypes[0]
}
func (x KnownProtocols) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use KnownProtocols.Descriptor instead.
func (KnownProtocols) EnumDescriptor() ([]byte, []int) {
return file_app_proxyman_config_proto_rawDescGZIP(), []int{0}
}
type AllocationStrategy_Type int32 type AllocationStrategy_Type int32
const ( const (
@@ -105,11 +59,11 @@ func (x AllocationStrategy_Type) String() string {
} }
func (AllocationStrategy_Type) Descriptor() protoreflect.EnumDescriptor { func (AllocationStrategy_Type) Descriptor() protoreflect.EnumDescriptor {
return file_app_proxyman_config_proto_enumTypes[1].Descriptor() return file_app_proxyman_config_proto_enumTypes[0].Descriptor()
} }
func (AllocationStrategy_Type) Type() protoreflect.EnumType { func (AllocationStrategy_Type) Type() protoreflect.EnumType {
return &file_app_proxyman_config_proto_enumTypes[1] return &file_app_proxyman_config_proto_enumTypes[0]
} }
func (x AllocationStrategy_Type) Number() protoreflect.EnumNumber { func (x AllocationStrategy_Type) Number() protoreflect.EnumNumber {
@@ -323,12 +277,7 @@ type ReceiverConfig struct {
AllocationStrategy *AllocationStrategy `protobuf:"bytes,3,opt,name=allocation_strategy,json=allocationStrategy,proto3" json:"allocation_strategy,omitempty"` AllocationStrategy *AllocationStrategy `protobuf:"bytes,3,opt,name=allocation_strategy,json=allocationStrategy,proto3" json:"allocation_strategy,omitempty"`
StreamSettings *internet.StreamConfig `protobuf:"bytes,4,opt,name=stream_settings,json=streamSettings,proto3" json:"stream_settings,omitempty"` StreamSettings *internet.StreamConfig `protobuf:"bytes,4,opt,name=stream_settings,json=streamSettings,proto3" json:"stream_settings,omitempty"`
ReceiveOriginalDestination bool `protobuf:"varint,5,opt,name=receive_original_destination,json=receiveOriginalDestination,proto3" json:"receive_original_destination,omitempty"` ReceiveOriginalDestination bool `protobuf:"varint,5,opt,name=receive_original_destination,json=receiveOriginalDestination,proto3" json:"receive_original_destination,omitempty"`
// Override domains for the given protocol. SniffingSettings *SniffingConfig `protobuf:"bytes,7,opt,name=sniffing_settings,json=sniffingSettings,proto3" json:"sniffing_settings,omitempty"`
// Deprecated. Use sniffing_settings.
//
// Deprecated: Marked as deprecated in app/proxyman/config.proto.
DomainOverride []KnownProtocols `protobuf:"varint,7,rep,packed,name=domain_override,json=domainOverride,proto3,enum=xray.app.proxyman.KnownProtocols" json:"domain_override,omitempty"`
SniffingSettings *SniffingConfig `protobuf:"bytes,8,opt,name=sniffing_settings,json=sniffingSettings,proto3" json:"sniffing_settings,omitempty"`
} }
func (x *ReceiverConfig) Reset() { func (x *ReceiverConfig) Reset() {
@@ -398,14 +347,6 @@ func (x *ReceiverConfig) GetReceiveOriginalDestination() bool {
return false return false
} }
// Deprecated: Marked as deprecated in app/proxyman/config.proto.
func (x *ReceiverConfig) GetDomainOverride() []KnownProtocols {
if x != nil {
return x.DomainOverride
}
return nil
}
func (x *ReceiverConfig) GetSniffingSettings() *SniffingConfig { func (x *ReceiverConfig) GetSniffingSettings() *SniffingConfig {
if x != nil { if x != nil {
return x.SniffingSettings return x.SniffingSettings
@@ -817,7 +758,7 @@ var file_app_proxyman_config_proto_rawDesc = []byte{
0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74,
0x61, 0x4f, 0x6e, 0x6c, 0x79, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x5f, 0x6f, 0x61, 0x4f, 0x6e, 0x6c, 0x79, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x5f, 0x6f,
0x6e, 0x6c, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x6e, 0x6c, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x72, 0x6f, 0x75, 0x74, 0x65,
0x4f, 0x6e, 0x6c, 0x79, 0x22, 0x8d, 0x04, 0x0a, 0x0e, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x4f, 0x6e, 0x6c, 0x79, 0x22, 0xbd, 0x03, 0x0a, 0x0e, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65,
0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x36, 0x0a, 0x09, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x36, 0x0a, 0x09, 0x70, 0x6f, 0x72, 0x74, 0x5f,
0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x78, 0x72, 0x61, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 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, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x2e, 0x50, 0x6f, 0x72,
@@ -840,13 +781,8 @@ var file_app_proxyman_config_proto_rawDesc = []byte{
0x5f, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x5f, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01,
0x28, 0x08, 0x52, 0x1a, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x4f, 0x72, 0x69, 0x67, 0x69, 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, 0x6e, 0x61, 0x6c, 0x44, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x4e,
0x0a, 0x0f, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x5f, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64,
0x65, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x21, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61,
0x70, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2e, 0x4b, 0x6e, 0x6f, 0x77,
0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x73, 0x42, 0x02, 0x18, 0x01, 0x52, 0x0e,
0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x4f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x12, 0x4e,
0x0a, 0x11, 0x73, 0x6e, 0x69, 0x66, 0x66, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x0a, 0x11, 0x73, 0x6e, 0x69, 0x66, 0x66, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69,
0x6e, 0x67, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x6e, 0x67, 0x73, 0x18, 0x07, 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, 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, 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, 0x69, 0x66, 0x66, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x4a, 0x04,
@@ -894,16 +830,13 @@ var file_app_proxyman_config_proto_rawDesc = []byte{
0x01, 0x28, 0x05, 0x52, 0x0f, 0x78, 0x75, 0x64, 0x70, 0x43, 0x6f, 0x6e, 0x63, 0x75, 0x72, 0x72, 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, 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, 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, 0x2a, 0x23, 0x75, 0x64, 0x70, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x55, 0x44, 0x50, 0x34, 0x34, 0x33, 0x42, 0x55,
0x0a, 0x0e, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x73, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70,
0x12, 0x08, 0x0a, 0x04, 0x48, 0x54, 0x54, 0x50, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x54, 0x4c, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x50, 0x01, 0x5a, 0x26, 0x67, 0x69, 0x74, 0x68, 0x75,
0x53, 0x10, 0x01, 0x42, 0x55, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x74, 0x6c, 0x73, 0x2f, 0x78, 0x72, 0x61, 0x79, 0x2d,
0x61, 0x70, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x50, 0x01, 0x5a, 0x26, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61,
0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x74, 0x6c, 0x73, 0x2f, 0x6e, 0xaa, 0x02, 0x11, 0x58, 0x72, 0x61, 0x79, 0x2e, 0x41, 0x70, 0x70, 0x2e, 0x50, 0x72, 0x6f,
0x78, 0x72, 0x61, 0x79, 0x2d, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x70, 0x72, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
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 (
@@ -918,48 +851,46 @@ func file_app_proxyman_config_proto_rawDescGZIP() []byte {
return file_app_proxyman_config_proto_rawDescData return file_app_proxyman_config_proto_rawDescData
} }
var file_app_proxyman_config_proto_enumTypes = make([]protoimpl.EnumInfo, 2) var file_app_proxyman_config_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_app_proxyman_config_proto_msgTypes = make([]protoimpl.MessageInfo, 10) var file_app_proxyman_config_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
var file_app_proxyman_config_proto_goTypes = []interface{}{ var file_app_proxyman_config_proto_goTypes = []any{
(KnownProtocols)(0), // 0: xray.app.proxyman.KnownProtocols (AllocationStrategy_Type)(0), // 0: xray.app.proxyman.AllocationStrategy.Type
(AllocationStrategy_Type)(0), // 1: xray.app.proxyman.AllocationStrategy.Type (*InboundConfig)(nil), // 1: xray.app.proxyman.InboundConfig
(*InboundConfig)(nil), // 2: xray.app.proxyman.InboundConfig (*AllocationStrategy)(nil), // 2: xray.app.proxyman.AllocationStrategy
(*AllocationStrategy)(nil), // 3: xray.app.proxyman.AllocationStrategy (*SniffingConfig)(nil), // 3: xray.app.proxyman.SniffingConfig
(*SniffingConfig)(nil), // 4: xray.app.proxyman.SniffingConfig (*ReceiverConfig)(nil), // 4: xray.app.proxyman.ReceiverConfig
(*ReceiverConfig)(nil), // 5: xray.app.proxyman.ReceiverConfig (*InboundHandlerConfig)(nil), // 5: xray.app.proxyman.InboundHandlerConfig
(*InboundHandlerConfig)(nil), // 6: xray.app.proxyman.InboundHandlerConfig (*OutboundConfig)(nil), // 6: xray.app.proxyman.OutboundConfig
(*OutboundConfig)(nil), // 7: xray.app.proxyman.OutboundConfig (*SenderConfig)(nil), // 7: xray.app.proxyman.SenderConfig
(*SenderConfig)(nil), // 8: xray.app.proxyman.SenderConfig (*MultiplexingConfig)(nil), // 8: xray.app.proxyman.MultiplexingConfig
(*MultiplexingConfig)(nil), // 9: xray.app.proxyman.MultiplexingConfig (*AllocationStrategy_AllocationStrategyConcurrency)(nil), // 9: xray.app.proxyman.AllocationStrategy.AllocationStrategyConcurrency
(*AllocationStrategy_AllocationStrategyConcurrency)(nil), // 10: xray.app.proxyman.AllocationStrategy.AllocationStrategyConcurrency (*AllocationStrategy_AllocationStrategyRefresh)(nil), // 10: xray.app.proxyman.AllocationStrategy.AllocationStrategyRefresh
(*AllocationStrategy_AllocationStrategyRefresh)(nil), // 11: xray.app.proxyman.AllocationStrategy.AllocationStrategyRefresh (*net.PortList)(nil), // 11: xray.common.net.PortList
(*net.PortList)(nil), // 12: xray.common.net.PortList (*net.IPOrDomain)(nil), // 12: xray.common.net.IPOrDomain
(*net.IPOrDomain)(nil), // 13: xray.common.net.IPOrDomain (*internet.StreamConfig)(nil), // 13: xray.transport.internet.StreamConfig
(*internet.StreamConfig)(nil), // 14: xray.transport.internet.StreamConfig (*serial.TypedMessage)(nil), // 14: xray.common.serial.TypedMessage
(*serial.TypedMessage)(nil), // 15: xray.common.serial.TypedMessage (*internet.ProxyConfig)(nil), // 15: xray.transport.internet.ProxyConfig
(*internet.ProxyConfig)(nil), // 16: xray.transport.internet.ProxyConfig
} }
var file_app_proxyman_config_proto_depIdxs = []int32{ var file_app_proxyman_config_proto_depIdxs = []int32{
1, // 0: xray.app.proxyman.AllocationStrategy.type:type_name -> xray.app.proxyman.AllocationStrategy.Type 0, // 0: xray.app.proxyman.AllocationStrategy.type:type_name -> xray.app.proxyman.AllocationStrategy.Type
10, // 1: xray.app.proxyman.AllocationStrategy.concurrency:type_name -> xray.app.proxyman.AllocationStrategy.AllocationStrategyConcurrency 9, // 1: xray.app.proxyman.AllocationStrategy.concurrency:type_name -> xray.app.proxyman.AllocationStrategy.AllocationStrategyConcurrency
11, // 2: xray.app.proxyman.AllocationStrategy.refresh:type_name -> xray.app.proxyman.AllocationStrategy.AllocationStrategyRefresh 10, // 2: xray.app.proxyman.AllocationStrategy.refresh:type_name -> xray.app.proxyman.AllocationStrategy.AllocationStrategyRefresh
12, // 3: xray.app.proxyman.ReceiverConfig.port_list:type_name -> xray.common.net.PortList 11, // 3: xray.app.proxyman.ReceiverConfig.port_list:type_name -> xray.common.net.PortList
13, // 4: xray.app.proxyman.ReceiverConfig.listen:type_name -> xray.common.net.IPOrDomain 12, // 4: xray.app.proxyman.ReceiverConfig.listen:type_name -> xray.common.net.IPOrDomain
3, // 5: xray.app.proxyman.ReceiverConfig.allocation_strategy:type_name -> xray.app.proxyman.AllocationStrategy 2, // 5: xray.app.proxyman.ReceiverConfig.allocation_strategy:type_name -> xray.app.proxyman.AllocationStrategy
14, // 6: xray.app.proxyman.ReceiverConfig.stream_settings:type_name -> xray.transport.internet.StreamConfig 13, // 6: xray.app.proxyman.ReceiverConfig.stream_settings:type_name -> xray.transport.internet.StreamConfig
0, // 7: xray.app.proxyman.ReceiverConfig.domain_override:type_name -> xray.app.proxyman.KnownProtocols 3, // 7: xray.app.proxyman.ReceiverConfig.sniffing_settings:type_name -> xray.app.proxyman.SniffingConfig
4, // 8: xray.app.proxyman.ReceiverConfig.sniffing_settings:type_name -> xray.app.proxyman.SniffingConfig 14, // 8: xray.app.proxyman.InboundHandlerConfig.receiver_settings:type_name -> xray.common.serial.TypedMessage
15, // 9: xray.app.proxyman.InboundHandlerConfig.receiver_settings:type_name -> xray.common.serial.TypedMessage 14, // 9: xray.app.proxyman.InboundHandlerConfig.proxy_settings:type_name -> xray.common.serial.TypedMessage
15, // 10: xray.app.proxyman.InboundHandlerConfig.proxy_settings:type_name -> xray.common.serial.TypedMessage 12, // 10: xray.app.proxyman.SenderConfig.via:type_name -> xray.common.net.IPOrDomain
13, // 11: xray.app.proxyman.SenderConfig.via:type_name -> xray.common.net.IPOrDomain 13, // 11: xray.app.proxyman.SenderConfig.stream_settings:type_name -> xray.transport.internet.StreamConfig
14, // 12: xray.app.proxyman.SenderConfig.stream_settings:type_name -> xray.transport.internet.StreamConfig 15, // 12: xray.app.proxyman.SenderConfig.proxy_settings:type_name -> xray.transport.internet.ProxyConfig
16, // 13: xray.app.proxyman.SenderConfig.proxy_settings:type_name -> xray.transport.internet.ProxyConfig 8, // 13: xray.app.proxyman.SenderConfig.multiplex_settings:type_name -> xray.app.proxyman.MultiplexingConfig
9, // 14: xray.app.proxyman.SenderConfig.multiplex_settings:type_name -> xray.app.proxyman.MultiplexingConfig 14, // [14:14] is the sub-list for method output_type
15, // [15:15] is the sub-list for method output_type 14, // [14:14] is the sub-list for method input_type
15, // [15:15] is the sub-list for method input_type 14, // [14:14] is the sub-list for extension type_name
15, // [15:15] is the sub-list for extension type_name 14, // [14:14] is the sub-list for extension extendee
15, // [15:15] is the sub-list for extension extendee 0, // [0:14] is the sub-list for field type_name
0, // [0:15] is the sub-list for field type_name
} }
func init() { file_app_proxyman_config_proto_init() } func init() { file_app_proxyman_config_proto_init() }
@@ -968,7 +899,7 @@ func file_app_proxyman_config_proto_init() {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_app_proxyman_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { file_app_proxyman_config_proto_msgTypes[0].Exporter = func(v any, i int) any {
switch v := v.(*InboundConfig); i { switch v := v.(*InboundConfig); i {
case 0: case 0:
return &v.state return &v.state
@@ -980,7 +911,7 @@ func file_app_proxyman_config_proto_init() {
return nil return nil
} }
} }
file_app_proxyman_config_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { file_app_proxyman_config_proto_msgTypes[1].Exporter = func(v any, i int) any {
switch v := v.(*AllocationStrategy); i { switch v := v.(*AllocationStrategy); i {
case 0: case 0:
return &v.state return &v.state
@@ -992,7 +923,7 @@ func file_app_proxyman_config_proto_init() {
return nil return nil
} }
} }
file_app_proxyman_config_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { file_app_proxyman_config_proto_msgTypes[2].Exporter = func(v any, i int) any {
switch v := v.(*SniffingConfig); i { switch v := v.(*SniffingConfig); i {
case 0: case 0:
return &v.state return &v.state
@@ -1004,7 +935,7 @@ func file_app_proxyman_config_proto_init() {
return nil return nil
} }
} }
file_app_proxyman_config_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { file_app_proxyman_config_proto_msgTypes[3].Exporter = func(v any, i int) any {
switch v := v.(*ReceiverConfig); i { switch v := v.(*ReceiverConfig); i {
case 0: case 0:
return &v.state return &v.state
@@ -1016,7 +947,7 @@ func file_app_proxyman_config_proto_init() {
return nil return nil
} }
} }
file_app_proxyman_config_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { file_app_proxyman_config_proto_msgTypes[4].Exporter = func(v any, i int) any {
switch v := v.(*InboundHandlerConfig); i { switch v := v.(*InboundHandlerConfig); i {
case 0: case 0:
return &v.state return &v.state
@@ -1028,7 +959,7 @@ func file_app_proxyman_config_proto_init() {
return nil return nil
} }
} }
file_app_proxyman_config_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { file_app_proxyman_config_proto_msgTypes[5].Exporter = func(v any, i int) any {
switch v := v.(*OutboundConfig); i { switch v := v.(*OutboundConfig); i {
case 0: case 0:
return &v.state return &v.state
@@ -1040,7 +971,7 @@ func file_app_proxyman_config_proto_init() {
return nil return nil
} }
} }
file_app_proxyman_config_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { file_app_proxyman_config_proto_msgTypes[6].Exporter = func(v any, i int) any {
switch v := v.(*SenderConfig); i { switch v := v.(*SenderConfig); i {
case 0: case 0:
return &v.state return &v.state
@@ -1052,7 +983,7 @@ func file_app_proxyman_config_proto_init() {
return nil return nil
} }
} }
file_app_proxyman_config_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { file_app_proxyman_config_proto_msgTypes[7].Exporter = func(v any, i int) any {
switch v := v.(*MultiplexingConfig); i { switch v := v.(*MultiplexingConfig); i {
case 0: case 0:
return &v.state return &v.state
@@ -1064,7 +995,7 @@ func file_app_proxyman_config_proto_init() {
return nil return nil
} }
} }
file_app_proxyman_config_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { file_app_proxyman_config_proto_msgTypes[8].Exporter = func(v any, i int) any {
switch v := v.(*AllocationStrategy_AllocationStrategyConcurrency); i { switch v := v.(*AllocationStrategy_AllocationStrategyConcurrency); i {
case 0: case 0:
return &v.state return &v.state
@@ -1076,7 +1007,7 @@ func file_app_proxyman_config_proto_init() {
return nil return nil
} }
} }
file_app_proxyman_config_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { file_app_proxyman_config_proto_msgTypes[9].Exporter = func(v any, i int) any {
switch v := v.(*AllocationStrategy_AllocationStrategyRefresh); i { switch v := v.(*AllocationStrategy_AllocationStrategyRefresh); i {
case 0: case 0:
return &v.state return &v.state
@@ -1094,7 +1025,7 @@ func file_app_proxyman_config_proto_init() {
File: protoimpl.DescBuilder{ File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_app_proxyman_config_proto_rawDesc, RawDescriptor: file_app_proxyman_config_proto_rawDesc,
NumEnums: 2, NumEnums: 1,
NumMessages: 10, NumMessages: 10,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,

View File

@@ -40,11 +40,6 @@ message AllocationStrategy {
AllocationStrategyRefresh refresh = 3; AllocationStrategyRefresh refresh = 3;
} }
enum KnownProtocols {
HTTP = 0;
TLS = 1;
}
message SniffingConfig { message SniffingConfig {
// Whether or not to enable content sniffing on an inbound connection. // Whether or not to enable content sniffing on an inbound connection.
bool enabled = 1; bool enabled = 1;
@@ -71,10 +66,7 @@ message ReceiverConfig {
xray.transport.internet.StreamConfig stream_settings = 4; xray.transport.internet.StreamConfig stream_settings = 4;
bool receive_original_destination = 5; bool receive_original_destination = 5;
reserved 6; reserved 6;
// Override domains for the given protocol. SniffingConfig sniffing_settings = 7;
// Deprecated. Use sniffing_settings.
repeated KnownProtocols domain_override = 7 [ deprecated = true ];
SniffingConfig sniffing_settings = 8;
} }
message InboundHandlerConfig { message InboundHandlerConfig {

View File

@@ -1,7 +1,5 @@
package inbound package inbound
//go:generate go run github.com/xtls/xray-core/common/errors/errorgen
import ( import (
"context" "context"
"sync" "sync"

View File

@@ -1,7 +1,5 @@
package outbound package outbound
//go:generate go run github.com/xtls/xray-core/common/errors/errorgen
import ( import (
"context" "context"
"sort" "sort"

View File

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

View File

@@ -1,7 +1,5 @@
package reverse package reverse
//go:generate go run github.com/xtls/xray-core/common/errors/errorgen
import ( import (
"context" "context"

View File

@@ -1,7 +1,5 @@
package command package command
//go:generate go run github.com/xtls/xray-core/common/errors/errorgen
import ( import (
"context" "context"
"time" "time"

View File

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

View File

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

View File

@@ -28,6 +28,10 @@ func (c routingContext) GetTargetPort() net.Port {
return net.Port(c.RoutingContext.GetTargetPort()) return net.Port(c.RoutingContext.GetTargetPort())
} }
func (c routingContext) GetRuleTag() string {
return ""
}
// GetSkipDNSResolve is a mock implementation here to match the interface, // GetSkipDNSResolve is a mock implementation here to match the interface,
// SkipDNSResolve is set from dns module, no use if coming from a protobuf object? // SkipDNSResolve is set from dns module, no use if coming from a protobuf object?
// TODO: please confirm @Vigilans // TODO: please confirm @Vigilans

View File

@@ -193,17 +193,27 @@ func (v NetworkMatcher) Apply(ctx routing.Context) bool {
type UserMatcher struct { type UserMatcher struct {
user []string user []string
pattern []*regexp.Regexp
} }
func NewUserMatcher(users []string) *UserMatcher { func NewUserMatcher(users []string) *UserMatcher {
usersCopy := make([]string, 0, len(users)) usersCopy := make([]string, 0, len(users))
patternsCopy := make([]*regexp.Regexp, 0, len(users))
for _, user := range users { for _, user := range users {
if len(user) > 0 { if len(user) > 0 {
if len(user) > 7 && strings.HasPrefix(user, "regexp:") {
if re, err := regexp.Compile(user[7:]); err != nil {
patternsCopy = append(patternsCopy, re)
}
// Items of users slice with an invalid regexp syntax are ignored.
continue
}
usersCopy = append(usersCopy, user) usersCopy = append(usersCopy, user)
} }
} }
return &UserMatcher{ return &UserMatcher{
user: usersCopy, user: usersCopy,
pattern: patternsCopy,
} }
} }
@@ -218,6 +228,11 @@ func (v *UserMatcher) Apply(ctx routing.Context) bool {
return true return true
} }
} }
for _, re := range v.pattern {
if re.MatchString(user) {
return true
}
}
return false return false
} }

View File

@@ -106,42 +106,6 @@ func TestRoutingRule(t *testing.T) {
}, },
}, },
}, },
{
rule: &RoutingRule{
Cidr: []*CIDR{
{
Ip: []byte{8, 8, 8, 8},
Prefix: 32,
},
{
Ip: []byte{8, 8, 8, 8},
Prefix: 32,
},
{
Ip: net.ParseAddress("2001:0db8:85a3:0000:0000:8a2e:0370:7334").IP(),
Prefix: 128,
},
},
},
test: []ruleTest{
{
input: withOutbound(&session.Outbound{Target: net.TCPDestination(net.ParseAddress("8.8.8.8"), 80)}),
output: true,
},
{
input: withOutbound(&session.Outbound{Target: net.TCPDestination(net.ParseAddress("8.8.4.4"), 80)}),
output: false,
},
{
input: withOutbound(&session.Outbound{Target: net.TCPDestination(net.ParseAddress("2001:0db8:85a3:0000:0000:8a2e:0370:7334"), 80)}),
output: true,
},
{
input: withBackground(),
output: false,
},
},
},
{ {
rule: &RoutingRule{ rule: &RoutingRule{
Geoip: []*GeoIP{ Geoip: []*GeoIP{
@@ -184,13 +148,17 @@ func TestRoutingRule(t *testing.T) {
}, },
{ {
rule: &RoutingRule{ rule: &RoutingRule{
SourceCidr: []*CIDR{ SourceGeoip: []*GeoIP{
{
Cidr: []*CIDR{
{ {
Ip: []byte{192, 168, 0, 0}, Ip: []byte{192, 168, 0, 0},
Prefix: 16, Prefix: 16,
}, },
}, },
}, },
},
},
test: []ruleTest{ test: []ruleTest{
{ {
input: withInbound(&session.Inbound{Source: net.TCPDestination(net.ParseAddress("192.168.0.1"), 80)}), input: withInbound(&session.Inbound{Source: net.TCPDestination(net.ParseAddress("192.168.0.1"), 80)}),

View File

@@ -6,7 +6,6 @@ import (
"strings" "strings"
"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/features/outbound" "github.com/xtls/xray-core/features/outbound"
"github.com/xtls/xray-core/features/routing" "github.com/xtls/xray-core/features/routing"
) )
@@ -63,8 +62,6 @@ func (rr *RoutingRule) BuildCondition() (Condition, error) {
if rr.PortList != nil { if rr.PortList != nil {
conds.Add(NewPortMatcher(rr.PortList, false)) conds.Add(NewPortMatcher(rr.PortList, false))
} else if rr.PortRange != nil {
conds.Add(NewPortMatcher(&net.PortList{Range: []*net.PortRange{rr.PortRange}}, false))
} }
if rr.SourcePortList != nil { if rr.SourcePortList != nil {
@@ -73,8 +70,6 @@ func (rr *RoutingRule) BuildCondition() (Condition, error) {
if len(rr.Networks) > 0 { if len(rr.Networks) > 0 {
conds.Add(NewNetworkMatcher(rr.Networks)) conds.Add(NewNetworkMatcher(rr.Networks))
} else if rr.NetworkList != nil {
conds.Add(NewNetworkMatcher(rr.NetworkList.Network))
} }
if len(rr.Geoip) > 0 { if len(rr.Geoip) > 0 {
@@ -83,12 +78,6 @@ func (rr *RoutingRule) BuildCondition() (Condition, error) {
return nil, err return nil, err
} }
conds.Add(cond) conds.Add(cond)
} else if len(rr.Cidr) > 0 {
cond, err := NewMultiGeoIPMatcher([]*GeoIP{{Cidr: rr.Cidr}}, false)
if err != nil {
return nil, err
}
conds.Add(cond)
} }
if len(rr.SourceGeoip) > 0 { if len(rr.SourceGeoip) > 0 {
@@ -97,12 +86,6 @@ func (rr *RoutingRule) BuildCondition() (Condition, error) {
return nil, err return nil, err
} }
conds.Add(cond) conds.Add(cond)
} else if len(rr.SourceCidr) > 0 {
cond, err := NewMultiGeoIPMatcher([]*GeoIP{{Cidr: rr.SourceCidr}}, true)
if err != nil {
return nil, err
}
conds.Add(cond)
} }
if len(rr.Protocol) > 0 { if len(rr.Protocol) > 0 {

View 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.34.1 // protoc-gen-go v1.34.2
// protoc v5.27.0 // protoc v5.28.0
// source: app/router/config.proto // source: app/router/config.proto
package router package router
@@ -485,33 +485,15 @@ type RoutingRule struct {
RuleTag string `protobuf:"bytes,18,opt,name=rule_tag,json=ruleTag,proto3" json:"rule_tag,omitempty"` RuleTag string `protobuf:"bytes,18,opt,name=rule_tag,json=ruleTag,proto3" json:"rule_tag,omitempty"`
// List of domains for target domain matching. // List of domains for target domain matching.
Domain []*Domain `protobuf:"bytes,2,rep,name=domain,proto3" json:"domain,omitempty"` Domain []*Domain `protobuf:"bytes,2,rep,name=domain,proto3" json:"domain,omitempty"`
// List of CIDRs for target IP address matching.
// Deprecated. Use geoip below.
//
// Deprecated: Marked as deprecated in app/router/config.proto.
Cidr []*CIDR `protobuf:"bytes,3,rep,name=cidr,proto3" json:"cidr,omitempty"`
// List of GeoIPs for target IP address matching. If this entry exists, the // List of GeoIPs for target IP address matching. If this entry exists, the
// cidr above will have no effect. GeoIP fields with the same country code are // cidr above will have no effect. GeoIP fields with the same country code are
// supposed to contain exactly same content. They will be merged during // supposed to contain exactly same content. They will be merged during
// runtime. For customized GeoIPs, please leave country code empty. // runtime. For customized GeoIPs, please leave country code empty.
Geoip []*GeoIP `protobuf:"bytes,10,rep,name=geoip,proto3" json:"geoip,omitempty"` Geoip []*GeoIP `protobuf:"bytes,10,rep,name=geoip,proto3" json:"geoip,omitempty"`
// A range of port [from, to]. If the destination port is in this range, this
// rule takes effect. Deprecated. Use port_list.
//
// Deprecated: Marked as deprecated in app/router/config.proto.
PortRange *net.PortRange `protobuf:"bytes,4,opt,name=port_range,json=portRange,proto3" json:"port_range,omitempty"`
// List of ports. // List of ports.
PortList *net.PortList `protobuf:"bytes,14,opt,name=port_list,json=portList,proto3" json:"port_list,omitempty"` PortList *net.PortList `protobuf:"bytes,14,opt,name=port_list,json=portList,proto3" json:"port_list,omitempty"`
// List of networks. Deprecated. Use networks.
//
// Deprecated: Marked as deprecated in app/router/config.proto.
NetworkList *net.NetworkList `protobuf:"bytes,5,opt,name=network_list,json=networkList,proto3" json:"network_list,omitempty"`
// List of networks for matching. // List of networks for matching.
Networks []net.Network `protobuf:"varint,13,rep,packed,name=networks,proto3,enum=xray.common.net.Network" json:"networks,omitempty"` Networks []net.Network `protobuf:"varint,13,rep,packed,name=networks,proto3,enum=xray.common.net.Network" json:"networks,omitempty"`
// List of CIDRs for source IP address matching.
//
// Deprecated: Marked as deprecated in app/router/config.proto.
SourceCidr []*CIDR `protobuf:"bytes,6,rep,name=source_cidr,json=sourceCidr,proto3" json:"source_cidr,omitempty"`
// List of GeoIPs for source IP address matching. If this entry exists, the // List of GeoIPs for source IP address matching. If this entry exists, the
// source_cidr above will have no effect. // source_cidr above will have no effect.
SourceGeoip []*GeoIP `protobuf:"bytes,11,rep,name=source_geoip,json=sourceGeoip,proto3" json:"source_geoip,omitempty"` SourceGeoip []*GeoIP `protobuf:"bytes,11,rep,name=source_geoip,json=sourceGeoip,proto3" json:"source_geoip,omitempty"`
@@ -591,14 +573,6 @@ func (x *RoutingRule) GetDomain() []*Domain {
return nil return nil
} }
// Deprecated: Marked as deprecated in app/router/config.proto.
func (x *RoutingRule) GetCidr() []*CIDR {
if x != nil {
return x.Cidr
}
return nil
}
func (x *RoutingRule) GetGeoip() []*GeoIP { func (x *RoutingRule) GetGeoip() []*GeoIP {
if x != nil { if x != nil {
return x.Geoip return x.Geoip
@@ -606,14 +580,6 @@ func (x *RoutingRule) GetGeoip() []*GeoIP {
return nil return nil
} }
// Deprecated: Marked as deprecated in app/router/config.proto.
func (x *RoutingRule) GetPortRange() *net.PortRange {
if x != nil {
return x.PortRange
}
return nil
}
func (x *RoutingRule) GetPortList() *net.PortList { func (x *RoutingRule) GetPortList() *net.PortList {
if x != nil { if x != nil {
return x.PortList return x.PortList
@@ -621,14 +587,6 @@ func (x *RoutingRule) GetPortList() *net.PortList {
return nil return nil
} }
// Deprecated: Marked as deprecated in app/router/config.proto.
func (x *RoutingRule) GetNetworkList() *net.NetworkList {
if x != nil {
return x.NetworkList
}
return nil
}
func (x *RoutingRule) GetNetworks() []net.Network { func (x *RoutingRule) GetNetworks() []net.Network {
if x != nil { if x != nil {
return x.Networks return x.Networks
@@ -636,14 +594,6 @@ func (x *RoutingRule) GetNetworks() []net.Network {
return nil return nil
} }
// Deprecated: Marked as deprecated in app/router/config.proto.
func (x *RoutingRule) GetSourceCidr() []*CIDR {
if x != nil {
return x.SourceCidr
}
return nil
}
func (x *RoutingRule) GetSourceGeoip() []*GeoIP { func (x *RoutingRule) GetSourceGeoip() []*GeoIP {
if x != nil { if x != nil {
return x.SourceGeoip return x.SourceGeoip
@@ -1143,7 +1093,7 @@ var file_app_router_config_proto_rawDesc = []byte{
0x6f, 0x53, 0x69, 0x74, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x2e, 0x0a, 0x05, 0x65, 0x6e, 0x74, 0x6f, 0x53, 0x69, 0x74, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x2e, 0x0a, 0x05, 0x65, 0x6e, 0x74,
0x72, 0x79, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x72, 0x79, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e,
0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x6f, 0x53, 0x69, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x6f, 0x53, 0x69,
0x74, 0x65, 0x52, 0x05, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x22, 0xbd, 0x07, 0x0a, 0x0b, 0x52, 0x6f, 0x74, 0x65, 0x52, 0x05, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x22, 0xce, 0x05, 0x0a, 0x0b, 0x52, 0x6f,
0x75, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x75, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x03, 0x74, 0x61, 0x67,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x03, 0x74, 0x61, 0x67, 0x12, 0x25, 0x0a, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x03, 0x74, 0x61, 0x67, 0x12, 0x25, 0x0a,
0x0d, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x69, 0x6e, 0x67, 0x5f, 0x74, 0x61, 0x67, 0x18, 0x0c, 0x0d, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x69, 0x6e, 0x67, 0x5f, 0x74, 0x61, 0x67, 0x18, 0x0c,
@@ -1153,112 +1103,97 @@ var file_app_router_config_proto_rawDesc = []byte{
0x2f, 0x0a, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2f, 0x0a, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x17, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x17, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65,
0x72, 0x2e, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x52, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x72, 0x2e, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x52, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e,
0x12, 0x2d, 0x0a, 0x04, 0x63, 0x69, 0x64, 0x72, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x12, 0x2c, 0x0a, 0x05, 0x67, 0x65, 0x6f, 0x69, 0x70, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x16, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65,
0x2e, 0x43, 0x49, 0x44, 0x52, 0x42, 0x02, 0x18, 0x01, 0x52, 0x04, 0x63, 0x69, 0x64, 0x72, 0x12, 0x72, 0x2e, 0x47, 0x65, 0x6f, 0x49, 0x50, 0x52, 0x05, 0x67, 0x65, 0x6f, 0x69, 0x70, 0x12, 0x36,
0x2c, 0x0a, 0x05, 0x67, 0x65, 0x6f, 0x69, 0x70, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x0a, 0x09, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x0e, 0x20, 0x01, 0x28,
0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x0b, 0x32, 0x19, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e,
0x2e, 0x47, 0x65, 0x6f, 0x49, 0x50, 0x52, 0x05, 0x67, 0x65, 0x6f, 0x69, 0x70, 0x12, 0x3d, 0x0a, 0x6e, 0x65, 0x74, 0x2e, 0x50, 0x6f, 0x72, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x08, 0x70, 0x6f,
0x0a, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x72, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x34, 0x0a, 0x08, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72,
0x0b, 0x32, 0x1a, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6b, 0x73, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e,
0x6e, 0x65, 0x74, 0x2e, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x42, 0x02, 0x18, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f,
0x01, 0x52, 0x09, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x36, 0x0a, 0x09, 0x72, 0x6b, 0x52, 0x08, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x12, 0x39, 0x0a, 0x0c,
0x70, 0x6f, 0x72, 0x74, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x67, 0x65, 0x6f, 0x69, 0x70, 0x18, 0x0b, 0x20, 0x03,
0x19, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6e, 0x65, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f,
0x74, 0x2e, 0x50, 0x6f, 0x72, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x08, 0x70, 0x6f, 0x72, 0x74, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x6f, 0x49, 0x50, 0x52, 0x0b, 0x73, 0x6f, 0x75, 0x72,
0x4c, 0x69, 0x73, 0x74, 0x12, 0x43, 0x0a, 0x0c, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x63, 0x65, 0x47, 0x65, 0x6f, 0x69, 0x70, 0x12, 0x43, 0x0a, 0x10, 0x73, 0x6f, 0x75, 0x72, 0x63,
0x6c, 0x69, 0x73, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x78, 0x72, 0x61, 0x65, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x10, 0x20, 0x01, 0x28,
0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x2e, 0x4e, 0x65, 0x74, 0x0b, 0x32, 0x19, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e,
0x77, 0x6f, 0x72, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x02, 0x18, 0x01, 0x52, 0x0b, 0x6e, 0x65, 0x6e, 0x65, 0x74, 0x2e, 0x50, 0x6f, 0x72, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x0e, 0x73, 0x6f,
0x74, 0x77, 0x6f, 0x72, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x34, 0x0a, 0x08, 0x6e, 0x65, 0x74, 0x75, 0x72, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a,
0x77, 0x6f, 0x72, 0x6b, 0x73, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x78, 0x72, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09,
0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x2e, 0x4e, 0x65, 0x52, 0x09, 0x75, 0x73, 0x65, 0x72, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x1f, 0x0a, 0x0b, 0x69,
0x74, 0x77, 0x6f, 0x72, 0x6b, 0x52, 0x08, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x12, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x5f, 0x74, 0x61, 0x67, 0x18, 0x08, 0x20, 0x03, 0x28, 0x09,
0x3a, 0x0a, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x63, 0x69, 0x64, 0x72, 0x18, 0x06, 0x52, 0x0a, 0x69, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x54, 0x61, 0x67, 0x12, 0x1a, 0x0a, 0x08,
0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x09, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08,
0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x43, 0x49, 0x44, 0x52, 0x42, 0x02, 0x18, 0x01, 0x52, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x4c, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72,
0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x69, 0x64, 0x72, 0x12, 0x39, 0x0a, 0x0c, 0x73, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x0f, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x78,
0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x67, 0x65, 0x6f, 0x69, 0x70, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x52,
0x0b, 0x32, 0x16, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x6f, 0x75, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x75, 0x6c, 0x65, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69,
0x74, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x6f, 0x49, 0x50, 0x52, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x62, 0x75, 0x74, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72,
0x65, 0x47, 0x65, 0x6f, 0x69, 0x70, 0x12, 0x43, 0x0a, 0x10, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e,
0x5f, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0b, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x18, 0x11, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d,
0x32, 0x19, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6e, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x1a, 0x3d, 0x0a,
0x65, 0x74, 0x2e, 0x50, 0x6f, 0x72, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x0e, 0x73, 0x6f, 0x75, 0x0f, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79,
0x72, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b,
0x73, 0x65, 0x72, 0x5f, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
0x09, 0x75, 0x73, 0x65, 0x72, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x6e, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x0c, 0x0a, 0x0a,
0x62, 0x6f, 0x75, 0x6e, 0x64, 0x5f, 0x74, 0x61, 0x67, 0x18, 0x08, 0x20, 0x03, 0x28, 0x09, 0x52, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x74, 0x61, 0x67, 0x22, 0xdc, 0x01, 0x0a, 0x0d, 0x42,
0x0a, 0x69, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x54, 0x61, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x69, 0x6e, 0x67, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x10, 0x0a, 0x03,
0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x09, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x70, 0x74, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x74, 0x61, 0x67, 0x12, 0x2b,
0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x4c, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x0a, 0x11, 0x6f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x5f, 0x73, 0x65, 0x6c, 0x65, 0x63,
0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x0f, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x78, 0x72, 0x74, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x10, 0x6f, 0x75, 0x74, 0x62, 0x6f,
0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x73,
0x75, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x75, 0x6c, 0x65, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73,
0x75, 0x74, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x12, 0x4d, 0x0a, 0x11, 0x73, 0x74, 0x72, 0x61, 0x74,
0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x5f, 0x65, 0x67, 0x79, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x04, 0x20, 0x01,
0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x18, 0x11, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x64, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x1a, 0x3d, 0x0a, 0x0f, 0x2e, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x64, 0x4d, 0x65, 0x73,
0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x73, 0x61, 0x67, 0x65, 0x52, 0x10, 0x73, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x53, 0x65,
0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x66, 0x61, 0x6c, 0x6c, 0x62, 0x61,
0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x63, 0x6b, 0x5f, 0x74, 0x61, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x66, 0x61,
0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x0c, 0x0a, 0x0a, 0x74, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x54, 0x61, 0x67, 0x22, 0x54, 0x0a, 0x0e, 0x53, 0x74, 0x72,
0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x74, 0x61, 0x67, 0x22, 0xdc, 0x01, 0x0a, 0x0d, 0x42, 0x61, 0x61, 0x74, 0x65, 0x67, 0x79, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x72,
0x6c, 0x61, 0x6e, 0x63, 0x69, 0x6e, 0x67, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x65, 0x67, 0x65, 0x78, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x72, 0x65, 0x67,
0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x74, 0x61, 0x67, 0x12, 0x2b, 0x0a, 0x65, 0x78, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01,
0x11, 0x6f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x5f, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x28, 0x09, 0x52, 0x05, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c,
0x6f, 0x72, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x10, 0x6f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x02, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22,
0x6e, 0x64, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x74, 0xc0, 0x01, 0x0a, 0x17, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x4c, 0x65, 0x61, 0x73,
0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x74, 0x74, 0x4c, 0x6f, 0x61, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x35, 0x0a, 0x05, 0x63,
0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x12, 0x4d, 0x0a, 0x11, 0x73, 0x74, 0x72, 0x61, 0x74, 0x65, 0x6f, 0x73, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x78, 0x72, 0x61,
0x67, 0x79, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x53, 0x74, 0x72,
0x0b, 0x32, 0x20, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x61, 0x74, 0x65, 0x67, 0x79, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x52, 0x05, 0x63, 0x6f, 0x73,
0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x74, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x62, 0x61, 0x73, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x18,
0x61, 0x67, 0x65, 0x52, 0x10, 0x73, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x53, 0x65, 0x74, 0x03, 0x20, 0x03, 0x28, 0x03, 0x52, 0x09, 0x62, 0x61, 0x73, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x73,
0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x66, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01,
0x6b, 0x5f, 0x74, 0x61, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x66, 0x61, 0x6c, 0x28, 0x05, 0x52, 0x08, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06,
0x6c, 0x62, 0x61, 0x63, 0x6b, 0x54, 0x61, 0x67, 0x22, 0x54, 0x0a, 0x0e, 0x53, 0x74, 0x72, 0x61, 0x6d, 0x61, 0x78, 0x52, 0x54, 0x54, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6d, 0x61,
0x74, 0x65, 0x67, 0x79, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x78, 0x52, 0x54, 0x54, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x6f, 0x6c, 0x65, 0x72, 0x61, 0x6e, 0x63,
0x67, 0x65, 0x78, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x72, 0x65, 0x67, 0x65, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x02, 0x52, 0x09, 0x74, 0x6f, 0x6c, 0x65, 0x72, 0x61, 0x6e,
0x78, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x63, 0x65, 0x22, 0x9b, 0x02, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x4f, 0x0a,
0x09, 0x52, 0x05, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x0f, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x5f, 0x73, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79,
0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x02, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xc0, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x26, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70,
0x01, 0x0a, 0x17, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x4c, 0x65, 0x61, 0x73, 0x74, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e,
0x4c, 0x6f, 0x61, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x35, 0x0a, 0x05, 0x63, 0x6f, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x52, 0x0e,
0x73, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x12, 0x30,
0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x53, 0x74, 0x72, 0x61, 0x0a, 0x04, 0x72, 0x75, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x78,
0x74, 0x65, 0x67, 0x79, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x52, 0x05, 0x63, 0x6f, 0x73, 0x74, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x52,
0x73, 0x12, 0x1c, 0x0a, 0x09, 0x62, 0x61, 0x73, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x18, 0x03, 0x6f, 0x75, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x04, 0x72, 0x75, 0x6c, 0x65,
0x20, 0x03, 0x28, 0x03, 0x52, 0x09, 0x62, 0x61, 0x73, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x12, 0x12, 0x45, 0x0a, 0x0e, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x69, 0x6e, 0x67, 0x5f, 0x72, 0x75,
0x1a, 0x0a, 0x08, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e,
0x05, 0x52, 0x08, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x42, 0x61, 0x6c, 0x61, 0x6e,
0x61, 0x78, 0x52, 0x54, 0x54, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6d, 0x61, 0x78, 0x63, 0x69, 0x6e, 0x67, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x0d, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63,
0x52, 0x54, 0x54, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x6f, 0x6c, 0x65, 0x72, 0x61, 0x6e, 0x63, 0x65, 0x69, 0x6e, 0x67, 0x52, 0x75, 0x6c, 0x65, 0x22, 0x47, 0x0a, 0x0e, 0x44, 0x6f, 0x6d, 0x61, 0x69,
0x18, 0x06, 0x20, 0x01, 0x28, 0x02, 0x52, 0x09, 0x74, 0x6f, 0x6c, 0x65, 0x72, 0x61, 0x6e, 0x63, 0x6e, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x12, 0x08, 0x0a, 0x04, 0x41, 0x73, 0x49,
0x65, 0x22, 0x9b, 0x02, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x4f, 0x0a, 0x0f, 0x73, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x55, 0x73, 0x65, 0x49, 0x70, 0x10, 0x01, 0x12, 0x10,
0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x5f, 0x73, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x18, 0x0a, 0x0c, 0x49, 0x70, 0x49, 0x66, 0x4e, 0x6f, 0x6e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x10, 0x02,
0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x26, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x12, 0x0e, 0x0a, 0x0a, 0x49, 0x70, 0x4f, 0x6e, 0x44, 0x65, 0x6d, 0x61, 0x6e, 0x64, 0x10, 0x03,
0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x44, 0x42, 0x4f, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70,
0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x52, 0x0e, 0x64, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x50, 0x01, 0x5a, 0x24, 0x67, 0x69, 0x74, 0x68, 0x75,
0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x12, 0x30, 0x0a, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x74, 0x6c, 0x73, 0x2f, 0x78, 0x72, 0x61, 0x79, 0x2d,
0x04, 0x72, 0x75, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x78, 0x72, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0xaa,
0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x52, 0x6f, 0x02, 0x0f, 0x58, 0x72, 0x61, 0x79, 0x2e, 0x41, 0x70, 0x70, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65,
0x75, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x04, 0x72, 0x75, 0x6c, 0x65, 0x12, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
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, 0x47, 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, 0x09, 0x0a, 0x05, 0x55, 0x73, 0x65, 0x49, 0x70, 0x10, 0x01, 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 (
@@ -1275,7 +1210,7 @@ func file_app_router_config_proto_rawDescGZIP() []byte {
var file_app_router_config_proto_enumTypes = make([]protoimpl.EnumInfo, 2) var file_app_router_config_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
var file_app_router_config_proto_msgTypes = make([]protoimpl.MessageInfo, 13) var file_app_router_config_proto_msgTypes = make([]protoimpl.MessageInfo, 13)
var file_app_router_config_proto_goTypes = []interface{}{ 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
(*Domain)(nil), // 2: xray.app.router.Domain (*Domain)(nil), // 2: xray.app.router.Domain
@@ -1291,11 +1226,9 @@ var file_app_router_config_proto_goTypes = []interface{}{
(*Config)(nil), // 12: xray.app.router.Config (*Config)(nil), // 12: xray.app.router.Config
(*Domain_Attribute)(nil), // 13: xray.app.router.Domain.Attribute (*Domain_Attribute)(nil), // 13: xray.app.router.Domain.Attribute
nil, // 14: xray.app.router.RoutingRule.AttributesEntry nil, // 14: xray.app.router.RoutingRule.AttributesEntry
(*net.PortRange)(nil), // 15: xray.common.net.PortRange (*net.PortList)(nil), // 15: xray.common.net.PortList
(*net.PortList)(nil), // 16: xray.common.net.PortList (net.Network)(0), // 16: xray.common.net.Network
(*net.NetworkList)(nil), // 17: xray.common.net.NetworkList (*serial.TypedMessage)(nil), // 17: xray.common.serial.TypedMessage
(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
@@ -1305,26 +1238,22 @@ var file_app_router_config_proto_depIdxs = []int32{
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
3, // 7: xray.app.router.RoutingRule.cidr:type_name -> xray.app.router.CIDR 4, // 7: xray.app.router.RoutingRule.geoip:type_name -> xray.app.router.GeoIP
4, // 8: 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
15, // 9: xray.app.router.RoutingRule.port_range:type_name -> xray.common.net.PortRange 16, // 9: xray.app.router.RoutingRule.networks:type_name -> xray.common.net.Network
16, // 10: xray.app.router.RoutingRule.port_list:type_name -> xray.common.net.PortList 4, // 10: xray.app.router.RoutingRule.source_geoip:type_name -> xray.app.router.GeoIP
17, // 11: xray.app.router.RoutingRule.network_list:type_name -> xray.common.net.NetworkList 15, // 11: xray.app.router.RoutingRule.source_port_list:type_name -> xray.common.net.PortList
18, // 12: xray.app.router.RoutingRule.networks:type_name -> xray.common.net.Network 14, // 12: xray.app.router.RoutingRule.attributes:type_name -> xray.app.router.RoutingRule.AttributesEntry
3, // 13: xray.app.router.RoutingRule.source_cidr:type_name -> xray.app.router.CIDR 17, // 13: xray.app.router.BalancingRule.strategy_settings:type_name -> xray.common.serial.TypedMessage
4, // 14: xray.app.router.RoutingRule.source_geoip:type_name -> xray.app.router.GeoIP 10, // 14: xray.app.router.StrategyLeastLoadConfig.costs:type_name -> xray.app.router.StrategyWeight
16, // 15: xray.app.router.RoutingRule.source_port_list:type_name -> xray.common.net.PortList 1, // 15: xray.app.router.Config.domain_strategy:type_name -> xray.app.router.Config.DomainStrategy
14, // 16: xray.app.router.RoutingRule.attributes:type_name -> xray.app.router.RoutingRule.AttributesEntry 8, // 16: xray.app.router.Config.rule:type_name -> xray.app.router.RoutingRule
19, // 17: xray.app.router.BalancingRule.strategy_settings:type_name -> xray.common.serial.TypedMessage 9, // 17: xray.app.router.Config.balancing_rule:type_name -> xray.app.router.BalancingRule
10, // 18: xray.app.router.StrategyLeastLoadConfig.costs:type_name -> xray.app.router.StrategyWeight 18, // [18:18] is the sub-list for method output_type
1, // 19: xray.app.router.Config.domain_strategy:type_name -> xray.app.router.Config.DomainStrategy 18, // [18:18] is the sub-list for method input_type
8, // 20: xray.app.router.Config.rule:type_name -> xray.app.router.RoutingRule 18, // [18:18] is the sub-list for extension type_name
9, // 21: xray.app.router.Config.balancing_rule:type_name -> xray.app.router.BalancingRule 18, // [18:18] is the sub-list for extension extendee
22, // [22:22] is the sub-list for method output_type 0, // [0:18] is the sub-list for field type_name
22, // [22:22] is the sub-list for method input_type
22, // [22:22] is the sub-list for extension type_name
22, // [22:22] is the sub-list for extension extendee
0, // [0:22] is the sub-list for field type_name
} }
func init() { file_app_router_config_proto_init() } func init() { file_app_router_config_proto_init() }
@@ -1333,7 +1262,7 @@ func file_app_router_config_proto_init() {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_app_router_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { file_app_router_config_proto_msgTypes[0].Exporter = func(v any, i int) any {
switch v := v.(*Domain); i { switch v := v.(*Domain); i {
case 0: case 0:
return &v.state return &v.state
@@ -1345,7 +1274,7 @@ func file_app_router_config_proto_init() {
return nil return nil
} }
} }
file_app_router_config_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { file_app_router_config_proto_msgTypes[1].Exporter = func(v any, i int) any {
switch v := v.(*CIDR); i { switch v := v.(*CIDR); i {
case 0: case 0:
return &v.state return &v.state
@@ -1357,7 +1286,7 @@ func file_app_router_config_proto_init() {
return nil return nil
} }
} }
file_app_router_config_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { file_app_router_config_proto_msgTypes[2].Exporter = func(v any, i int) any {
switch v := v.(*GeoIP); i { switch v := v.(*GeoIP); i {
case 0: case 0:
return &v.state return &v.state
@@ -1369,7 +1298,7 @@ func file_app_router_config_proto_init() {
return nil return nil
} }
} }
file_app_router_config_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { file_app_router_config_proto_msgTypes[3].Exporter = func(v any, i int) any {
switch v := v.(*GeoIPList); i { switch v := v.(*GeoIPList); i {
case 0: case 0:
return &v.state return &v.state
@@ -1381,7 +1310,7 @@ func file_app_router_config_proto_init() {
return nil return nil
} }
} }
file_app_router_config_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { file_app_router_config_proto_msgTypes[4].Exporter = func(v any, i int) any {
switch v := v.(*GeoSite); i { switch v := v.(*GeoSite); i {
case 0: case 0:
return &v.state return &v.state
@@ -1393,7 +1322,7 @@ func file_app_router_config_proto_init() {
return nil return nil
} }
} }
file_app_router_config_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { file_app_router_config_proto_msgTypes[5].Exporter = func(v any, i int) any {
switch v := v.(*GeoSiteList); i { switch v := v.(*GeoSiteList); i {
case 0: case 0:
return &v.state return &v.state
@@ -1405,7 +1334,7 @@ func file_app_router_config_proto_init() {
return nil return nil
} }
} }
file_app_router_config_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { file_app_router_config_proto_msgTypes[6].Exporter = func(v any, i int) any {
switch v := v.(*RoutingRule); i { switch v := v.(*RoutingRule); i {
case 0: case 0:
return &v.state return &v.state
@@ -1417,7 +1346,7 @@ func file_app_router_config_proto_init() {
return nil return nil
} }
} }
file_app_router_config_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { file_app_router_config_proto_msgTypes[7].Exporter = func(v any, i int) any {
switch v := v.(*BalancingRule); i { switch v := v.(*BalancingRule); i {
case 0: case 0:
return &v.state return &v.state
@@ -1429,7 +1358,7 @@ func file_app_router_config_proto_init() {
return nil return nil
} }
} }
file_app_router_config_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { file_app_router_config_proto_msgTypes[8].Exporter = func(v any, i int) any {
switch v := v.(*StrategyWeight); i { switch v := v.(*StrategyWeight); i {
case 0: case 0:
return &v.state return &v.state
@@ -1441,7 +1370,7 @@ func file_app_router_config_proto_init() {
return nil return nil
} }
} }
file_app_router_config_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { file_app_router_config_proto_msgTypes[9].Exporter = func(v any, i int) any {
switch v := v.(*StrategyLeastLoadConfig); i { switch v := v.(*StrategyLeastLoadConfig); i {
case 0: case 0:
return &v.state return &v.state
@@ -1453,7 +1382,7 @@ func file_app_router_config_proto_init() {
return nil return nil
} }
} }
file_app_router_config_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { file_app_router_config_proto_msgTypes[10].Exporter = func(v any, i int) any {
switch v := v.(*Config); i { switch v := v.(*Config); i {
case 0: case 0:
return &v.state return &v.state
@@ -1465,7 +1394,7 @@ func file_app_router_config_proto_init() {
return nil return nil
} }
} }
file_app_router_config_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { file_app_router_config_proto_msgTypes[11].Exporter = func(v any, i int) any {
switch v := v.(*Domain_Attribute); i { switch v := v.(*Domain_Attribute); i {
case 0: case 0:
return &v.state return &v.state
@@ -1478,11 +1407,11 @@ func file_app_router_config_proto_init() {
} }
} }
} }
file_app_router_config_proto_msgTypes[6].OneofWrappers = []interface{}{ file_app_router_config_proto_msgTypes[6].OneofWrappers = []any{
(*RoutingRule_Tag)(nil), (*RoutingRule_Tag)(nil),
(*RoutingRule_BalancingTag)(nil), (*RoutingRule_BalancingTag)(nil),
} }
file_app_router_config_proto_msgTypes[11].OneofWrappers = []interface{}{ file_app_router_config_proto_msgTypes[11].OneofWrappers = []any{
(*Domain_Attribute_BoolValue)(nil), (*Domain_Attribute_BoolValue)(nil),
(*Domain_Attribute_IntValue)(nil), (*Domain_Attribute_IntValue)(nil),
} }

View File

@@ -84,32 +84,18 @@ message RoutingRule {
// List of domains for target domain matching. // List of domains for target domain matching.
repeated Domain domain = 2; repeated Domain domain = 2;
// List of CIDRs for target IP address matching.
// Deprecated. Use geoip below.
repeated CIDR cidr = 3 [deprecated = true];
// List of GeoIPs for target IP address matching. If this entry exists, the // List of GeoIPs for target IP address matching. If this entry exists, the
// cidr above will have no effect. GeoIP fields with the same country code are // cidr above will have no effect. GeoIP fields with the same country code are
// supposed to contain exactly same content. They will be merged during // supposed to contain exactly same content. They will be merged during
// runtime. For customized GeoIPs, please leave country code empty. // runtime. For customized GeoIPs, please leave country code empty.
repeated GeoIP geoip = 10; repeated GeoIP geoip = 10;
// A range of port [from, to]. If the destination port is in this range, this
// rule takes effect. Deprecated. Use port_list.
xray.common.net.PortRange port_range = 4 [deprecated = true];
// List of ports. // List of ports.
xray.common.net.PortList port_list = 14; xray.common.net.PortList port_list = 14;
// List of networks. Deprecated. Use networks.
xray.common.net.NetworkList network_list = 5 [deprecated = true];
// List of networks for matching. // List of networks for matching.
repeated xray.common.net.Network networks = 13; repeated xray.common.net.Network networks = 13;
// List of CIDRs for source IP address matching.
repeated CIDR source_cidr = 6 [deprecated = true];
// List of GeoIPs for source IP address matching. If this entry exists, the // List of GeoIPs for source IP address matching. If this entry exists, the
// source_cidr above will have no effect. // source_cidr above will have no effect.
repeated GeoIP source_geoip = 11; repeated GeoIP source_geoip = 11;

View File

@@ -1,7 +1,5 @@
package router package router
//go:generate go run github.com/xtls/xray-core/common/errors/errorgen
import ( import (
"context" "context"
sync "sync" sync "sync"
@@ -34,6 +32,7 @@ type Route struct {
routing.Context routing.Context
outboundGroupTags []string outboundGroupTags []string
outboundTag string outboundTag string
ruleTag string
} }
// Init initializes the Router. // Init initializes the Router.
@@ -89,7 +88,7 @@ func (r *Router) PickRoute(ctx routing.Context) (routing.Route, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
return &Route{Context: ctx, outboundTag: tag}, nil return &Route{Context: ctx, outboundTag: tag, ruleTag: rule.RuleTag}, nil
} }
// AddRule implements routing.Router. // AddRule implements routing.Router.
@@ -239,6 +238,10 @@ func (r *Route) GetOutboundTag() string {
return r.outboundTag return r.outboundTag
} }
func (r *Route) GetRuleTag() string {
return r.ruleTag
}
func init() { func init() {
common.Must(common.RegisterConfig((*Config)(nil), func(ctx context.Context, config interface{}) (interface{}, error) { common.Must(common.RegisterConfig((*Config)(nil), func(ctx context.Context, config interface{}) (interface{}, error) {
r := new(Router) r := new(Router)

View File

@@ -155,6 +155,8 @@ func TestIPOnDemand(t *testing.T) {
TargetTag: &RoutingRule_Tag{ TargetTag: &RoutingRule_Tag{
Tag: "test", Tag: "test",
}, },
Geoip: []*GeoIP{
{
Cidr: []*CIDR{ Cidr: []*CIDR{
{ {
Ip: []byte{192, 168, 0, 0}, Ip: []byte{192, 168, 0, 0},
@@ -163,6 +165,8 @@ func TestIPOnDemand(t *testing.T) {
}, },
}, },
}, },
},
},
} }
mockCtl := gomock.NewController(t) mockCtl := gomock.NewController(t)
@@ -196,6 +200,8 @@ func TestIPIfNonMatchDomain(t *testing.T) {
TargetTag: &RoutingRule_Tag{ TargetTag: &RoutingRule_Tag{
Tag: "test", Tag: "test",
}, },
Geoip: []*GeoIP{
{
Cidr: []*CIDR{ Cidr: []*CIDR{
{ {
Ip: []byte{192, 168, 0, 0}, Ip: []byte{192, 168, 0, 0},
@@ -204,6 +210,8 @@ func TestIPIfNonMatchDomain(t *testing.T) {
}, },
}, },
}, },
},
},
} }
mockCtl := gomock.NewController(t) mockCtl := gomock.NewController(t)
@@ -237,6 +245,8 @@ func TestIPIfNonMatchIP(t *testing.T) {
TargetTag: &RoutingRule_Tag{ TargetTag: &RoutingRule_Tag{
Tag: "test", Tag: "test",
}, },
Geoip: []*GeoIP{
{
Cidr: []*CIDR{ Cidr: []*CIDR{
{ {
Ip: []byte{127, 0, 0, 0}, Ip: []byte{127, 0, 0, 0},
@@ -245,6 +255,8 @@ func TestIPIfNonMatchIP(t *testing.T) {
}, },
}, },
}, },
},
},
} }
mockCtl := gomock.NewController(t) mockCtl := gomock.NewController(t)

View File

@@ -203,7 +203,7 @@ func TestStatsChannelBlocking(t *testing.T) {
// Test blocking channel publishing // Test blocking channel publishing
go func() { go func() {
// Dummy messsage with no subscriber receiving, will block broadcasting goroutine // Dummy message with no subscriber receiving, will block broadcasting goroutine
c.Publish(context.Background(), nil) c.Publish(context.Background(), nil)
<-pauseCh <-pauseCh

View File

@@ -1,7 +1,5 @@
package command package command
//go:generate go run github.com/xtls/xray-core/common/errors/errorgen
import ( import (
"context" "context"
"runtime" "runtime"

View File

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

View File

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

View File

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

View File

@@ -1,7 +1,5 @@
package stats package stats
//go:generate go run github.com/xtls/xray-core/common/errors/errorgen
import ( import (
"context" "context"
"sync" "sync"

View File

@@ -1,4 +1,2 @@
// Package buf provides a light-weight memory allocation mechanism. // Package buf provides a light-weight memory allocation mechanism.
package buf // import "github.com/xtls/xray-core/common/buf" package buf // import "github.com/xtls/xray-core/common/buf"
//go:generate go run github.com/xtls/xray-core/common/errors/errorgen

View File

@@ -207,6 +207,21 @@ func (b *Buffer) Len() int32 {
return b.end - b.start return b.end - b.start
} }
// Cap returns the capacity of the buffer content.
func (b *Buffer) Cap() int32 {
if b == nil {
return 0
}
return int32(len(b.v))
}
// NewWithSize creates a Buffer with 0 length and capacity with at least the given size.
func NewWithSize(size int32) *Buffer {
return &Buffer{
v: bytespool.Alloc(size),
}
}
// IsEmpty returns true if the buffer is empty. // IsEmpty returns true if the buffer is empty.
func (b *Buffer) IsEmpty() bool { func (b *Buffer) IsEmpty() bool {
return b.Len() == 0 return b.Len() == 0

View File

@@ -12,8 +12,6 @@ import (
"github.com/xtls/xray-core/common/errors" "github.com/xtls/xray-core/common/errors"
) )
//go:generate go run github.com/xtls/xray-core/common/errors/errorgen
// ErrNoClue is for the situation that existing information is not enough to make a decision. For example, Router may return this error when there is no suitable route. // ErrNoClue is for the situation that existing information is not enough to make a decision. For example, Router may return this error when there is no suitable route.
var ErrNoClue = errors.New("not enough information for making a decision") var ErrNoClue = errors.New("not enough information for making a decision")

View File

@@ -1,4 +1,2 @@
// Package crypto provides common crypto libraries for Xray. // Package crypto provides common crypto libraries for Xray.
package crypto // import "github.com/xtls/xray-core/common/crypto" package crypto // import "github.com/xtls/xray-core/common/crypto"
//go:generate go run github.com/xtls/xray-core/common/errors/errorgen

View File

@@ -14,6 +14,14 @@ func Roll(n int) int {
return rand.Intn(n) return rand.Intn(n)
} }
// RollInt63n returns a non-negative number between 0 (inclusive) and n (exclusive).
func RollInt63n(n int64) int64 {
if n == 1 {
return 0
}
return rand.Int63n(n)
}
// Roll returns a non-negative number between 0 (inclusive) and n (exclusive). // Roll returns a non-negative number between 0 (inclusive) and n (exclusive).
func RollDeterministic(n int, seed int64) int { func RollDeterministic(n int, seed int64) int {
if n == 1 { if n == 1 {

View File

@@ -2,8 +2,6 @@ package drain
import "io" import "io"
//go:generate go run github.com/xtls/xray-core/common/errors/errorgen
type Drainer interface { type Drainer interface {
AcknowledgeReceive(size int) AcknowledgeReceive(size int)
Drain(reader io.Reader) error Drain(reader io.Reader) error

View File

@@ -0,0 +1,34 @@
package errors
import (
"context"
)
// PrintMigrateFeatureInfo prints a notice of the upcoming feature migration.
// 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.
func PrintMigrateFeatureInfo(sourceFeature string, targetFeature string) {
LogInfo(context.Background(), "The feature " + sourceFeature + " will be migrated to " + targetFeature + " in the future.")
}
// PrintDeprecatedFeatureWarning prints a warning for deprecated and going to be removed feature.
// Do not remove this function even there is no reference to it.
func PrintDeprecatedFeatureWarning(feature string, migrateFeature string) {
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.")
} else {
LogWarning(context.Background(), "This feature " + feature + " is deprecated. Please update your config(s) according to release note and documentation before removal.")
}
}
// PrintRemovedFeatureError prints an error message for removed feature then return an error. And after long enough time the message can also be removed, uses as an indicator.
// Do not remove this function even there is no reference to it.
func PrintRemovedFeatureError(feature string, migrateFeature string) (error) {
if len(migrateFeature) > 0 {
return New("The feature " + feature + " has been removed and migrated to " + migrateFeature + ". Please update your config(s) according to release note and documentation.")
} else {
return New("The feature " + feature + " has been removed. Please update your config(s) according to release note and documentation.")
}
}

View File

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

View File

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

View File

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

View File

@@ -1,3 +1 @@
package mux package mux
//go:generate go run github.com/xtls/xray-core/common/errors/errorgen

View File

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

124
common/mux/server_test.go Normal file
View File

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

View File

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

View File

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

View File

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

View File

@@ -1,4 +1,2 @@
// Package net is a drop-in replacement to Golang's net package, with some more functionalities. // Package net is a drop-in replacement to Golang's net package, with some more functionalities.
package net // import "github.com/xtls/xray-core/common/net" package net // import "github.com/xtls/xray-core/common/net"
//go:generate go run github.com/xtls/xray-core/common/errors/errorgen

View 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.34.1 // protoc-gen-go v1.34.2
// protoc v5.27.0 // protoc v5.28.0
// source: common/net/network.proto // source: common/net/network.proto
package net package net
@@ -24,8 +24,6 @@ type Network int32
const ( const (
Network_Unknown Network = 0 Network_Unknown Network = 0
// Deprecated: Marked as deprecated in common/net/network.proto.
Network_RawTCP Network = 1
Network_TCP Network = 2 Network_TCP Network = 2
Network_UDP Network = 3 Network_UDP Network = 3
Network_UNIX Network = 4 Network_UNIX Network = 4
@@ -35,14 +33,12 @@ const (
var ( var (
Network_name = map[int32]string{ Network_name = map[int32]string{
0: "Unknown", 0: "Unknown",
1: "RawTCP",
2: "TCP", 2: "TCP",
3: "UDP", 3: "UDP",
4: "UNIX", 4: "UNIX",
} }
Network_value = map[string]int32{ Network_value = map[string]int32{
"Unknown": 0, "Unknown": 0,
"RawTCP": 1,
"TCP": 2, "TCP": 2,
"UDP": 3, "UDP": 3,
"UNIX": 4, "UNIX": 4,
@@ -133,10 +129,9 @@ var file_common_net_network_proto_rawDesc = []byte{
0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x32, 0x0a, 0x07, 0x6e, 0x65, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x32, 0x0a, 0x07, 0x6e, 0x65,
0x74, 0x77, 0x6f, 0x72, 0x6b, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x78, 0x72, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x78, 0x72,
0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x2e, 0x4e, 0x65, 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, 0x2a, 0x42, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x52, 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2a, 0x32,
0x0a, 0x07, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x6e, 0x6b, 0x0a, 0x07, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x6e, 0x6b,
0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x06, 0x52, 0x61, 0x77, 0x54, 0x43, 0x50, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x54, 0x43, 0x50, 0x10, 0x02, 0x12,
0x10, 0x01, 0x1a, 0x02, 0x08, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x54, 0x43, 0x50, 0x10, 0x02, 0x12,
0x07, 0x0a, 0x03, 0x55, 0x44, 0x50, 0x10, 0x03, 0x12, 0x08, 0x0a, 0x04, 0x55, 0x4e, 0x49, 0x58, 0x07, 0x0a, 0x03, 0x55, 0x44, 0x50, 0x10, 0x03, 0x12, 0x08, 0x0a, 0x04, 0x55, 0x4e, 0x49, 0x58,
0x10, 0x04, 0x42, 0x4f, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 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, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x50, 0x01, 0x5a, 0x24, 0x67, 0x69, 0x74,
@@ -160,7 +155,7 @@ func file_common_net_network_proto_rawDescGZIP() []byte {
var file_common_net_network_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_common_net_network_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_common_net_network_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_common_net_network_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_common_net_network_proto_goTypes = []interface{}{ var file_common_net_network_proto_goTypes = []any{
(Network)(0), // 0: xray.common.net.Network (Network)(0), // 0: xray.common.net.Network
(*NetworkList)(nil), // 1: xray.common.net.NetworkList (*NetworkList)(nil), // 1: xray.common.net.NetworkList
} }
@@ -179,7 +174,7 @@ func file_common_net_network_proto_init() {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_common_net_network_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { file_common_net_network_proto_msgTypes[0].Exporter = func(v any, i int) any {
switch v := v.(*NetworkList); i { switch v := v.(*NetworkList); i {
case 0: case 0:
return &v.state return &v.state

View File

@@ -9,7 +9,6 @@ option java_multiple_files = true;
enum Network { enum Network {
Unknown = 0; Unknown = 0;
RawTCP = 1 [deprecated = true];
TCP = 2; TCP = 2;
UDP = 3; UDP = 3;
UNIX = 4; UNIX = 4;

View File

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

View File

@@ -12,8 +12,6 @@ import (
"github.com/xtls/xray-core/common/platform" "github.com/xtls/xray-core/common/platform"
) )
//go:generate go run github.com/xtls/xray-core/common/errors/errorgen
func Run(args []string, input io.Reader) (buf.MultiBuffer, error) { func Run(args []string, input io.Reader) (buf.MultiBuffer, error) {
xctl := platform.GetToolLocation("xctl") xctl := platform.GetToolLocation("xctl")
if _, err := os.Stat(xctl); err != nil { if _, err := os.Stat(xctl); err != nil {

View File

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

View File

@@ -2,11 +2,13 @@ package http
import ( import (
"bytes" "bytes"
"context"
"errors" "errors"
"strings" "strings"
"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/common/session"
) )
type version byte type version byte
@@ -56,7 +58,14 @@ func beginWithHTTPMethod(b []byte) error {
return errNotHTTPMethod return errNotHTTPMethod
} }
func SniffHTTP(b []byte) (*SniffHeader, error) { func SniffHTTP(b []byte, c context.Context) (*SniffHeader, error) {
content := session.ContentFromContext(c)
ShouldSniffAttr := true
// If content.Attributes have information, that means it comes from HTTP inbound PlainHTTP mode.
// It will set attributes, so skip it.
if content == nil || len(content.Attributes) != 0 {
ShouldSniffAttr = false
}
if err := beginWithHTTPMethod(b); err != nil { if err := beginWithHTTPMethod(b); err != nil {
return nil, err return nil, err
} }
@@ -76,8 +85,12 @@ func SniffHTTP(b []byte) (*SniffHeader, error) {
continue continue
} }
key := strings.ToLower(string(parts[0])) key := strings.ToLower(string(parts[0]))
value := string(bytes.TrimSpace(parts[1]))
if ShouldSniffAttr {
content.SetAttribute(key, value) // Put header in attribute
}
if key == "host" { if key == "host" {
rawHost := strings.ToLower(string(bytes.TrimSpace(parts[1]))) rawHost := strings.ToLower(value)
dest, err := ParseHost(rawHost, net.Port(80)) dest, err := ParseHost(rawHost, net.Port(80))
if err != nil { if err != nil {
return nil, err return nil, err
@@ -85,6 +98,16 @@ func SniffHTTP(b []byte) (*SniffHeader, error) {
sh.host = dest.Address.String() sh.host = dest.Address.String()
} }
} }
// Parse request line
// Request line is like this
// "GET /homo/114514 HTTP/1.1"
if len(headers) > 0 && ShouldSniffAttr {
RequestLineParts := bytes.Split(headers[0], []byte{' '})
if len(RequestLineParts) == 3 {
content.SetAttribute(":method", string(RequestLineParts[0]))
content.SetAttribute(":path", string(RequestLineParts[1]))
}
}
if len(sh.host) > 0 { if len(sh.host) > 0 {
return sh, nil return sh, nil

View File

@@ -1,6 +1,7 @@
package http_test package http_test
import ( import (
"context"
"testing" "testing"
. "github.com/xtls/xray-core/common/protocol/http" . "github.com/xtls/xray-core/common/protocol/http"
@@ -88,7 +89,7 @@ first_name=John&last_name=Doe&action=Submit`,
} }
for _, test := range cases { for _, test := range cases {
header, err := SniffHTTP([]byte(test.input)) header, err := SniffHTTP([]byte(test.input), context.TODO())
if test.err { if test.err {
if err == nil { if err == nil {
t.Errorf("Expect error but nil, in test: %v", test) t.Errorf("Expect error but nil, in test: %v", test)

View File

@@ -1,3 +1 @@
package protocol // import "github.com/xtls/xray-core/common/protocol" package protocol // import "github.com/xtls/xray-core/common/protocol"
//go:generate go run github.com/xtls/xray-core/common/errors/errorgen

View File

@@ -47,11 +47,19 @@ var (
) )
func SniffQUIC(b []byte) (*SniffHeader, error) { func SniffQUIC(b []byte) (*SniffHeader, error) {
// Crypto data separated across packets
cryptoLen := 0
cryptoData := bytespool.Alloc(int32(len(b)))
defer bytespool.Free(cryptoData)
// Parse QUIC packets
for len(b) > 0 {
buffer := buf.FromBytes(b) buffer := buf.FromBytes(b)
typeByte, err := buffer.ReadByte() typeByte, err := buffer.ReadByte()
if err != nil { if err != nil {
return nil, errNotQuic return nil, errNotQuic
} }
isLongHeader := typeByte&0x80 > 0 isLongHeader := typeByte&0x80 > 0
if !isLongHeader || typeByte&0x40 == 0 { if !isLongHeader || typeByte&0x40 == 0 {
return nil, errNotQuicInitial return nil, errNotQuicInitial
@@ -63,16 +71,14 @@ func SniffQUIC(b []byte) (*SniffHeader, error) {
} }
versionNumber := binary.BigEndian.Uint32(vb) versionNumber := binary.BigEndian.Uint32(vb)
if versionNumber != 0 && typeByte&0x40 == 0 { if versionNumber != 0 && typeByte&0x40 == 0 {
return nil, errNotQuic return nil, errNotQuic
} else if versionNumber != versionDraft29 && versionNumber != version1 { } else if versionNumber != versionDraft29 && versionNumber != version1 {
return nil, errNotQuic return nil, errNotQuic
} }
if (typeByte&0x30)>>4 != 0x0 { packetType := (typeByte & 0x30) >> 4
return nil, errNotQuicInitial isQuicInitial := packetType == 0x0
}
var destConnID []byte var destConnID []byte
if l, err := buffer.ReadByte(); err != nil { if l, err := buffer.ReadByte(); err != nil {
@@ -102,6 +108,15 @@ func SniffQUIC(b []byte) (*SniffHeader, error) {
} }
hdrLen := len(b) - int(buffer.Len()) hdrLen := len(b) - int(buffer.Len())
if len(b) < hdrLen+int(packetLen) {
return nil, common.ErrNoClue // Not enough data to read as a QUIC packet. QUIC is UDP-based, so this is unlikely to happen.
}
restPayload := b[hdrLen+int(packetLen):]
if !isQuicInitial { // Skip this packet if it's not initial packet
b = restPayload
continue
}
origPNBytes := make([]byte, 4) origPNBytes := make([]byte, 4)
copy(origPNBytes, b[hdrLen:hdrLen+4]) copy(origPNBytes, b[hdrLen:hdrLen+4])
@@ -142,10 +157,6 @@ func SniffQUIC(b []byte) (*SniffHeader, error) {
packetNumber = uint32(n) packetNumber = uint32(n)
} }
if packetNumber != 0 && packetNumber != 1 {
return nil, errNotQuicInitial
}
extHdrLen := hdrLen + int(packetNumberLength) extHdrLen := hdrLen + int(packetNumberLength)
copy(b[extHdrLen:hdrLen+4], origPNBytes[packetNumberLength:]) copy(b[extHdrLen:hdrLen+4], origPNBytes[packetNumberLength:])
data := b[extHdrLen : int(packetLen)+hdrLen] data := b[extHdrLen : int(packetLen)+hdrLen]
@@ -160,10 +171,6 @@ func SniffQUIC(b []byte) (*SniffHeader, error) {
return nil, err return nil, err
} }
buffer = buf.FromBytes(decrypted) buffer = buf.FromBytes(decrypted)
cryptoLen := uint(0)
cryptoData := bytespool.Alloc(buffer.Len())
defer bytespool.Free(cryptoData)
for i := 0; !buffer.IsEmpty(); i++ { for i := 0; !buffer.IsEmpty(); i++ {
frameType := byte(0x0) // Default to PADDING frame frameType := byte(0x0) // Default to PADDING frame
for frameType == 0x0 && !buffer.IsEmpty() { for frameType == 0x0 && !buffer.IsEmpty() {
@@ -214,8 +221,14 @@ func SniffQUIC(b []byte) (*SniffHeader, error) {
if err != nil || length > uint64(buffer.Len()) { if err != nil || length > uint64(buffer.Len()) {
return nil, io.ErrUnexpectedEOF return nil, io.ErrUnexpectedEOF
} }
if cryptoLen < uint(offset+length) { if cryptoLen < int(offset+length) {
cryptoLen = uint(offset + length) cryptoLen = int(offset + length)
if len(cryptoData) < cryptoLen {
newCryptoData := bytespool.Alloc(int32(cryptoLen))
copy(newCryptoData, cryptoData)
bytespool.Free(cryptoData)
cryptoData = newCryptoData
}
} }
if _, err := buffer.Read(cryptoData[offset : offset+length]); err != nil { // Field: Crypto Data if _, err := buffer.Read(cryptoData[offset : offset+length]); err != nil { // Field: Crypto Data
return nil, io.ErrUnexpectedEOF return nil, io.ErrUnexpectedEOF
@@ -244,10 +257,15 @@ func SniffQUIC(b []byte) (*SniffHeader, error) {
tlsHdr := &ptls.SniffHeader{} tlsHdr := &ptls.SniffHeader{}
err = ptls.ReadClientHello(cryptoData[:cryptoLen], tlsHdr) err = ptls.ReadClientHello(cryptoData[:cryptoLen], tlsHdr)
if err != nil { if err != nil {
return nil, err // The crypto data may have not been fully recovered in current packets,
// So we continue to sniff rest packets.
b = restPayload
continue
} }
return &SniffHeader{domain: tlsHdr.Domain()}, nil return &SniffHeader{domain: tlsHdr.Domain()}, nil
} }
return nil, common.ErrNoClue
}
func hkdfExpandLabel(hash crypto.Hash, secret, context []byte, label string, length int) []byte { func hkdfExpandLabel(hash crypto.Hash, secret, context []byte, label string, length int) []byte {
b := make([]byte, 3, 3+6+len(label)+1+len(context)) b := make([]byte, 3, 3+6+len(label)+1+len(context))

View File

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

View File

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

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.34.1 // protoc-gen-go v1.34.2
// protoc v5.27.0 // protoc v5.27.0
// source: common/protocol/user.proto // source: common/protocol/user.proto
@@ -124,7 +124,7 @@ func file_common_protocol_user_proto_rawDescGZIP() []byte {
} }
var file_common_protocol_user_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_common_protocol_user_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_common_protocol_user_proto_goTypes = []interface{}{ var file_common_protocol_user_proto_goTypes = []any{
(*User)(nil), // 0: xray.common.protocol.User (*User)(nil), // 0: xray.common.protocol.User
(*serial.TypedMessage)(nil), // 1: xray.common.serial.TypedMessage (*serial.TypedMessage)(nil), // 1: xray.common.serial.TypedMessage
} }
@@ -143,7 +143,7 @@ func file_common_protocol_user_proto_init() {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_common_protocol_user_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { file_common_protocol_user_proto_msgTypes[0].Exporter = func(v any, i int) any {
switch v := v.(*User); i { switch v := v.(*User); i {
case 0: case 0:
return &v.state return &v.state

View File

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

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