MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / formatProxyURL

Function formatProxyURL

internal/watcher/diff/config_diff.go:365–391  ·  view source on GitHub ↗
(raw string)

Source from the content-addressed store, hash-verified

363}
364
365func formatProxyURL(raw string) string {
366 trimmed := strings.TrimSpace(raw)
367 if trimmed == "" {
368 return "<none>"
369 }
370 parsed, err := url.Parse(trimmed)
371 if err != nil {
372 return "<redacted>"
373 }
374 host := strings.TrimSpace(parsed.Host)
375 scheme := strings.TrimSpace(parsed.Scheme)
376 if host == "" {
377 // Allow host:port style without scheme.
378 parsed2, err2 := url.Parse("http://" + trimmed)
379 if err2 == nil {
380 host = strings.TrimSpace(parsed2.Host)
381 }
382 scheme = ""
383 }
384 if host == "" {
385 return "<redacted>"
386 }
387 if scheme == "" {
388 return host
389 }
390 return scheme + "://" + host
391}

Callers 3

BuildConfigChangeDetailsFunction · 0.85
TestFormatProxyURLFunction · 0.85
BuildAuthChangeDetailsFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestFormatProxyURLFunction · 0.68