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
58 lines
1.2 KiB
Go
58 lines
1.2 KiB
Go
//go:build android
|
|
|
|
package tun
|
|
|
|
import (
|
|
"context"
|
|
"strconv"
|
|
|
|
"github.com/xtls/xray-core/common/errors"
|
|
"github.com/xtls/xray-core/common/platform"
|
|
"golang.org/x/sys/unix"
|
|
"gvisor.dev/gvisor/pkg/tcpip/link/fdbased"
|
|
"gvisor.dev/gvisor/pkg/tcpip/stack"
|
|
)
|
|
|
|
type AndroidTun struct {
|
|
tunFd int
|
|
options TunOptions
|
|
}
|
|
|
|
// DefaultTun implements Tun
|
|
var _ Tun = (*AndroidTun)(nil)
|
|
|
|
// DefaultTun implements GVisorTun
|
|
var _ GVisorTun = (*AndroidTun)(nil)
|
|
|
|
// NewTun builds new tun interface handler
|
|
func NewTun(options TunOptions) (Tun, error) {
|
|
fd, err := strconv.Atoi(platform.NewEnvFlag(platform.TunFdKey).GetValue(func() string { return "0" }))
|
|
errors.LogInfo(context.Background(), "read Android Tun Fd ", fd, err)
|
|
|
|
err = unix.SetNonblock(fd, true)
|
|
if err != nil {
|
|
_ = unix.Close(fd)
|
|
return nil, err
|
|
}
|
|
|
|
return &AndroidTun{
|
|
tunFd: fd,
|
|
options: options,
|
|
}, nil
|
|
}
|
|
|
|
func (t *AndroidTun) Start() error {
|
|
return nil
|
|
}
|
|
|
|
func (t *AndroidTun) Close() error {
|
|
return nil
|
|
}
|
|
|
|
func (t *AndroidTun) newEndpoint() (stack.LinkEndpoint, error) {
|
|
return fdbased.New(&fdbased.Options{
|
|
FDs: []int{t.tunFd},
|
|
MTU: t.options.MTU,
|
|
RXChecksumOffload: true,
|
|
})
|
|
}
|