feat: support http and socks5 upstream node uris
This commit is contained in:
@@ -2,6 +2,7 @@ package store
|
||||
|
||||
import (
|
||||
"context"
|
||||
"easy_proxies/internal/config"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/url"
|
||||
@@ -175,26 +176,13 @@ func loadNodesFromLegacyFile(path string) ([]string, error) {
|
||||
if line == "" || strings.HasPrefix(line, "#") {
|
||||
continue
|
||||
}
|
||||
if isProxyURI(line) {
|
||||
if config.IsProxyURI(line) {
|
||||
uris = append(uris, line)
|
||||
}
|
||||
}
|
||||
return uris, nil
|
||||
}
|
||||
|
||||
// isProxyURI checks if a string looks like a proxy URI.
|
||||
func isProxyURI(s string) bool {
|
||||
schemes := []string{"vmess://", "vless://", "trojan://", "ss://", "ssr://",
|
||||
"hysteria://", "hysteria2://", "hy2://", "anytls://", "http://", "socks5://"}
|
||||
lower := strings.ToLower(s)
|
||||
for _, scheme := range schemes {
|
||||
if strings.HasPrefix(lower, scheme) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// extractNameFromURI extracts a name from the URI fragment (#name).
|
||||
func extractNameFromURI(uri string) string {
|
||||
parsed, err := url.Parse(uri)
|
||||
|
||||
Reference in New Issue
Block a user