mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-04-17 13:05:57 +00:00
1. **Fixed XPadding Placement Dropdown**: - Added the missing `cookie` and `query` options to `xPaddingPlacement` (`stream_xhttp.html`). - *Why:* Previously, users wanting `cookie` obfuscation were forced to use the `header` placement string. This caused Xray-core to blindly intercept the entire monolithic HTTP Cookie header, failing internal padding-length validations and causing the inbound to silently drop the connection. 2. **Fixed Uplink Data Placement Validation**: - Replaced the unsupported `query` option with `cookie` in `uplinkDataPlacement`. - *Why:* Xray-core's `transport_internet.go` explicitly forbids `query` as an uplink placement option. Selecting it from the UI previously sent a payload that would cause Xray-core to instantly throw an `unsupported uplink data placement: query` panic. Adding `cookie` perfectly aligns the UI with Xray-core restrictions. ### Related Issues - Resolves #3992
73 lines
1.3 KiB
Go
73 lines
1.3 KiB
Go
package strmatcher_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/xtls/xray-core/common"
|
|
. "github.com/xtls/xray-core/common/strmatcher"
|
|
)
|
|
|
|
func TestMatcher(t *testing.T) {
|
|
cases := []struct {
|
|
pattern string
|
|
mType Type
|
|
input string
|
|
output bool
|
|
}{
|
|
{
|
|
pattern: "example.com",
|
|
mType: Domain,
|
|
input: "www.example.com",
|
|
output: true,
|
|
},
|
|
{
|
|
pattern: "example.com",
|
|
mType: Domain,
|
|
input: "example.com",
|
|
output: true,
|
|
},
|
|
{
|
|
pattern: "example.com",
|
|
mType: Domain,
|
|
input: "www.fxample.com",
|
|
output: false,
|
|
},
|
|
{
|
|
pattern: "example.com",
|
|
mType: Domain,
|
|
input: "xample.com",
|
|
output: false,
|
|
},
|
|
{
|
|
pattern: "example.com",
|
|
mType: Domain,
|
|
input: "xexample.com",
|
|
output: false,
|
|
},
|
|
{
|
|
pattern: "example.com",
|
|
mType: Full,
|
|
input: "example.com",
|
|
output: true,
|
|
},
|
|
{
|
|
pattern: "example.com",
|
|
mType: Full,
|
|
input: "xexample.com",
|
|
output: false,
|
|
},
|
|
{
|
|
pattern: "example.com",
|
|
mType: Regex,
|
|
input: "examplexcom",
|
|
output: true,
|
|
},
|
|
}
|
|
for _, test := range cases {
|
|
matcher, err := test.mType.New(test.pattern)
|
|
common.Must(err)
|
|
if m := matcher.Match(test.input); m != test.output {
|
|
t.Error("unexpected output: ", m, " for test case ", test)
|
|
}
|
|
}
|
|
}
|