Skip to content

Commit bb79f55

Browse files
CopilotRPRX
andauthored
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>
1 parent be9a229 commit bb79f55

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

infra/conf/transport_internet.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1995,7 +1995,9 @@ func (c *StreamConfig) Build() (*internet.StreamConfig, error) {
19951995
}
19961996
}
19971997
}
1998-
browser_dialer.RegisterDialerProxyURL(c.SocketSettings.DialerProxy)
1998+
if err := browser_dialer.RegisterDialerProxyURL(c.SocketSettings.DialerProxy); err != nil {
1999+
return nil, errors.New("failed to collect browser dialer url.").Base(err)
2000+
}
19992001
}
20002002
}
20012003

transport/internet/browser_dialer/dialer.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,17 @@ func BeginCollectingDialerProxyURLs() error {
7575
return nil
7676
}
7777

78-
func RegisterDialerProxyURL(raw string) {
78+
func RegisterDialerProxyURL(raw string) error {
7979
if !IsBrowserDialerProxy(raw) {
80-
return
80+
return nil
8181
}
8282
initMu.Lock()
8383
defer initMu.Unlock()
8484
if pendingURLs == nil {
85-
pendingURLs = map[string]struct{}{}
85+
return errors.New("browser dialer url collection is not initialized")
8686
}
8787
pendingURLs[raw] = struct{}{}
88+
return nil
8889
}
8990

9091
func ConfigureCollectedDialerProxyURLs() error {

0 commit comments

Comments
 (0)