This project intends to deal with different proxy configuration standards and provide a unified way to parse them into a common format or convert between them.
This the list of supported protocols and their URL formats:
vmess://<base64_encoded_json_config>(see the expected JSON config below)vless://<uuid>@host:port[?<v2rayParams>][<tlsParams>]#name(see the optional v2ray and tls params below)trojan://<password>@host:port[?[<v2rayParams>][<tlsParams>]]#namess://[<base64_encoded(encryption_method:password)>][password]@host:port#name
Some optional v2ray parameters (for vmess, vless, and trojan):
type: connection type, can behttp,httpupgradeorxhttp,wsorwss,grpc, orquichost: the host header for ws/wss/http/httpupgradepath: the path for ws/wss/http/httpupgradeserviceName: the service name for grpcmethod: for http
Some optional tls parameters (for vmess, vless, and trojan):
security: can betlsornonesni: the sni value for tlsalpn: the alpn value for tls, can beh2orhttp/1.1allowInsecure: can be1or0, indicates whether to allow insecure tls
vmess decoded config example
{
"add": "example.com",
"port": 443,
"aid": 0,
"alpn": "h2",
"host": "example.com",
"id": "uuid-string-here",
"net": "ws",
"path": "/websocket",
"scy": "auto",
"sni": "example.com",
"tls": "tls"
}{
"tag": "name",
"type": "shadowsocks",
"method": "encryption_method",
"password": "password",
}Go get the package:
go get -u github.com/getlantern/pluriconfigImport and use it in your Go code:
import (
"github.com/getlantern/pluriconfig"
_ "github.com/getlantern/pluriconfig/provider/singbox"
)
...
provider, _ := pluriconfig.GetProvider("singbox")
config, _ := provider.Parse(ctx, "vmess://base64_encoded_string")