Add common proxy utilities

This commit is contained in:
Shelikhoo 2023-10-18 16:23:31 +01:00
parent 6b0421db0d
commit 8b46e60553
No known key found for this signature in database
GPG key ID: C4D5E79D22B25316
4 changed files with 296 additions and 2 deletions

18
common/proxy/check.go Normal file
View file

@ -0,0 +1,18 @@
package proxy
import (
"errors"
"net/url"
"strings"
)
var errUnsupportedProxyType = errors.New("unsupported proxy type")
func CheckProxyProtocolSupport(proxy *url.URL) error {
switch strings.ToLower(proxy.Scheme) {
case "socks5":
return nil
default:
return errUnsupportedProxyType
}
}