返回 DeepSeek-Reasonix
model_connection_target.go
根目录 / internal / config / model_connection_target.go
1 package config
2
3 import "net/url"
4
5 // SafeModelConnectionTarget omits paths, credentials, query and fragments.
6 // A hostname and port identify the selected connection without revealing URL
7 // embedded authentication or provider-specific secret path components.
8 func SafeModelConnectionTarget(raw string) string {
9 u, err := url.Parse(raw)
10 if err != nil || u.Host == "" || (u.Scheme != "http" && u.Scheme != "https") {
11 return ""
12 }
13 return u.Scheme + "://" + u.Host
14 }
15
15 lines GO