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
44 lines
818 B
Go
44 lines
818 B
Go
package dispatcher_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
. "github.com/xtls/xray-core/app/dispatcher"
|
|
"github.com/xtls/xray-core/common"
|
|
"github.com/xtls/xray-core/common/buf"
|
|
)
|
|
|
|
type TestCounter int64
|
|
|
|
func (c *TestCounter) Value() int64 {
|
|
return int64(*c)
|
|
}
|
|
|
|
func (c *TestCounter) Add(v int64) int64 {
|
|
x := int64(*c) + v
|
|
*c = TestCounter(x)
|
|
return x
|
|
}
|
|
|
|
func (c *TestCounter) Set(v int64) int64 {
|
|
*c = TestCounter(v)
|
|
return v
|
|
}
|
|
|
|
func TestStatsWriter(t *testing.T) {
|
|
var c TestCounter
|
|
writer := &SizeStatWriter{
|
|
Counter: &c,
|
|
Writer: buf.Discard,
|
|
}
|
|
|
|
mb := buf.MergeBytes(nil, []byte("abcd"))
|
|
common.Must(writer.WriteMultiBuffer(mb))
|
|
|
|
mb = buf.MergeBytes(nil, []byte("efg"))
|
|
common.Must(writer.WriteMultiBuffer(mb))
|
|
|
|
if c.Value() != 7 {
|
|
t.Fatal("unexpected counter value. want 7, but got ", c.Value())
|
|
}
|
|
}
|