mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-10-25 07:15:01 +03:00
207c705300
TUIC traffic reached Xray through a loopback SOCKS relay that took no login, so Xray never learned which client a connection belonged to and user routing rules never matched TUIC (#6874). The relay now carries one account per client email, so per-user rules match on TCP and both UDP modes; admission stays with the native TUIC server. Adding, removing or renaming a TUIC client swaps only that inbound's relay instead of restarting Xray: new sessions wait behind a bounded gate while live streams and UDP associations continue, accounts are verified after the swap and rolled back on failure, one failing relay no longer strands the others or blocks unrelated live changes, and emails over SOCKS5's 255-byte limit are excluded with a warning.
49 lines
1.4 KiB
Go
49 lines
1.4 KiB
Go
package xray
|
|
|
|
import (
|
|
"bytes"
|
|
|
|
"github.com/mhsanaei/3x-ui/v3/internal/util/json_util"
|
|
)
|
|
|
|
// InboundConfig represents an Xray inbound configuration.
|
|
// It defines how Xray accepts incoming connections including protocol, port, and settings.
|
|
type InboundConfig struct {
|
|
// TuicRelay owns client revocation outside Xray; its user edits must not restart the core.
|
|
TuicRelay bool `json:"-"`
|
|
TuicInboundID int `json:"-"`
|
|
Listen json_util.RawMessage `json:"listen"` // listen cannot be an empty string
|
|
Port int `json:"port"`
|
|
Protocol string `json:"protocol"`
|
|
Settings json_util.RawMessage `json:"settings"`
|
|
StreamSettings json_util.RawMessage `json:"streamSettings,omitempty"`
|
|
Tag string `json:"tag"`
|
|
Sniffing json_util.RawMessage `json:"sniffing,omitempty"`
|
|
}
|
|
|
|
// Equals compares two InboundConfig instances for deep equality.
|
|
func (c *InboundConfig) Equals(other *InboundConfig) bool {
|
|
if !bytes.Equal(c.Listen, other.Listen) {
|
|
return false
|
|
}
|
|
if c.Port != other.Port {
|
|
return false
|
|
}
|
|
if c.Protocol != other.Protocol {
|
|
return false
|
|
}
|
|
if !bytes.Equal(c.Settings, other.Settings) {
|
|
return false
|
|
}
|
|
if !bytes.Equal(c.StreamSettings, other.StreamSettings) {
|
|
return false
|
|
}
|
|
if c.Tag != other.Tag {
|
|
return false
|
|
}
|
|
if !bytes.Equal(c.Sniffing, other.Sniffing) {
|
|
return false
|
|
}
|
|
return true
|
|
}
|