mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-04-16 20:45:50 +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
59 lines
1.3 KiB
Go
59 lines
1.3 KiB
Go
package mux
|
|
|
|
import (
|
|
"io"
|
|
|
|
"github.com/xtls/xray-core/common/buf"
|
|
"github.com/xtls/xray-core/common/crypto"
|
|
"github.com/xtls/xray-core/common/errors"
|
|
"github.com/xtls/xray-core/common/net"
|
|
"github.com/xtls/xray-core/common/serial"
|
|
)
|
|
|
|
// PacketReader is an io.Reader that reads whole chunk of Mux frames every time.
|
|
type PacketReader struct {
|
|
reader io.Reader
|
|
eof bool
|
|
dest *net.Destination
|
|
}
|
|
|
|
// NewPacketReader creates a new PacketReader.
|
|
func NewPacketReader(reader io.Reader, dest *net.Destination) *PacketReader {
|
|
return &PacketReader{
|
|
reader: reader,
|
|
eof: false,
|
|
dest: dest,
|
|
}
|
|
}
|
|
|
|
// ReadMultiBuffer implements buf.Reader.
|
|
func (r *PacketReader) ReadMultiBuffer() (buf.MultiBuffer, error) {
|
|
if r.eof {
|
|
return nil, io.EOF
|
|
}
|
|
|
|
size, err := serial.ReadUint16(r.reader)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
if size > buf.Size {
|
|
return nil, errors.New("packet size too large: ", size)
|
|
}
|
|
|
|
b := buf.New()
|
|
if _, err := b.ReadFullFrom(r.reader, int32(size)); err != nil {
|
|
b.Release()
|
|
return nil, err
|
|
}
|
|
r.eof = true
|
|
if r.dest != nil && r.dest.Network == net.Network_UDP {
|
|
b.UDP = r.dest
|
|
}
|
|
return buf.MultiBuffer{b}, nil
|
|
}
|
|
|
|
// NewStreamReader creates a new StreamReader.
|
|
func NewStreamReader(reader *buf.BufferedReader) buf.Reader {
|
|
return crypto.NewChunkStreamReaderWithChunkCount(crypto.PlainChunkSizeParser{}, reader, 1)
|
|
}
|