package config import "strings" // DetectProtocol infers protocol from a share/proxy URI. func DetectProtocol(raw string) Protocol { lower := strings.ToLower(strings.TrimSpace(raw)) switch { case strings.HasPrefix(lower, "hysteria2://"), strings.HasPrefix(lower, "hy2://"): return ProtocolHysteria2 case strings.HasPrefix(lower, "naive+"), strings.HasPrefix(lower, "naive://"), strings.HasPrefix(lower, "https://"), strings.HasPrefix(lower, "quic://"), strings.HasPrefix(lower, "http://"): return ProtocolNaive default: return "" } }