fix: tighten browser URL collection order and error handling

Agent-Logs-Url: https://github.com/XTLS/Xray-core/sessions/84d72770-6ad0-447a-8d86-94d692972a05

Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-04-26 20:48:03 +00:00
committed by GitHub
parent be9a229d68
commit bb79f554dd
2 changed files with 7 additions and 4 deletions
+3 -1
View File
@@ -1995,7 +1995,9 @@ func (c *StreamConfig) Build() (*internet.StreamConfig, error) {
} }
} }
} }
browser_dialer.RegisterDialerProxyURL(c.SocketSettings.DialerProxy) if err := browser_dialer.RegisterDialerProxyURL(c.SocketSettings.DialerProxy); err != nil {
return nil, errors.New("failed to collect browser dialer url.").Base(err)
}
} }
} }
+4 -3
View File
@@ -75,16 +75,17 @@ func BeginCollectingDialerProxyURLs() error {
return nil return nil
} }
func RegisterDialerProxyURL(raw string) { func RegisterDialerProxyURL(raw string) error {
if !IsBrowserDialerProxy(raw) { if !IsBrowserDialerProxy(raw) {
return return nil
} }
initMu.Lock() initMu.Lock()
defer initMu.Unlock() defer initMu.Unlock()
if pendingURLs == nil { if pendingURLs == nil {
pendingURLs = map[string]struct{}{} return errors.New("browser dialer url collection is not initialized")
} }
pendingURLs[raw] = struct{}{} pendingURLs[raw] = struct{}{}
return nil
} }
func ConfigureCollectedDialerProxyURLs() error { func ConfigureCollectedDialerProxyURLs() error {