feat: add root browserDialers tags for dialerProxy integration

Agent-Logs-Url: https://github.com/XTLS/Xray-core/sessions/808be5b1-7ed2-4309-87f1-18a808d6aba4

Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-04-26 17:54:10 +00:00
committed by GitHub
parent 97ad6cef43
commit ca3cd5fb88
5 changed files with 91 additions and 1 deletions
+24
View File
@@ -15,6 +15,7 @@ import (
"github.com/xtls/xray-core/common/serial"
core "github.com/xtls/xray-core/core"
"github.com/xtls/xray-core/transport/internet"
"github.com/xtls/xray-core/transport/internet/browser_dialer"
)
var (
@@ -362,6 +363,12 @@ type Config struct {
BurstObservatory *BurstObservatoryConfig `json:"burstObservatory"`
Version *VersionConfig `json:"version"`
Geodata *GeodataConfig `json:"geodata"`
BrowserDialers []BrowserDialerConfig `json:"browserDialers"`
}
type BrowserDialerConfig struct {
Tag string `json:"tag"`
URL string `json:"url"`
}
func (c *Config) findInboundTag(tag string) int {
@@ -437,6 +444,9 @@ func (c *Config) Override(o *Config, fn string) {
if o.Geodata != nil {
c.Geodata = o.Geodata
}
if o.BrowserDialers != nil {
c.BrowserDialers = o.BrowserDialers
}
// update the Inbound in slice if the only one in override config has same tag
if len(o.InboundConfigs) > 0 {
@@ -605,6 +615,20 @@ func (c *Config) Build() (*core.Config, error) {
return nil, errors.PrintRemovedFeatureError("Global transport config", "streamSettings in inbounds and outbounds")
}
browserDialerTags := make(map[string]string, len(c.BrowserDialers))
for _, browserDialer := range c.BrowserDialers {
if browserDialer.Tag == "" {
return nil, errors.New("browserDialers tag cannot be empty")
}
if _, found := browserDialerTags[browserDialer.Tag]; found {
return nil, errors.New("duplicate browserDialers tag: ", browserDialer.Tag)
}
browserDialerTags[browserDialer.Tag] = browserDialer.URL
}
if err := browser_dialer.ConfigureDialerTags(browserDialerTags); err != nil {
return nil, errors.New("failed to configure browserDialers").Base(err)
}
for _, rawInboundConfig := range inbounds {
ic, err := rawInboundConfig.Build()
if err != nil {