mirror of
https://github.com/bestnite/sub2clash.git
synced 2025-06-17 20:53:18 +08:00
update
This commit is contained in:
@ -5,7 +5,7 @@ import (
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sub/model"
|
||||
"sub2clash/model"
|
||||
)
|
||||
|
||||
// ParseSS 解析 SS(Shadowsocks)URL
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sub/model"
|
||||
"sub2clash/model"
|
||||
)
|
||||
|
||||
func ParseShadowsocksR(proxy string) (model.Proxy, error) {
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sub/model"
|
||||
"sub2clash/model"
|
||||
)
|
||||
|
||||
func ParseTrojan(proxy string) (model.Proxy, error) {
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sub/model"
|
||||
"sub2clash/model"
|
||||
)
|
||||
|
||||
func ParseVless(proxy string) (model.Proxy, error) {
|
||||
@ -48,18 +48,22 @@ func ParseVless(proxy string) (model.Proxy, error) {
|
||||
Fingerprint: params.Get("fp"),
|
||||
Alpn: strings.Split(params.Get("alpn"), ","),
|
||||
Servername: params.Get("sni"),
|
||||
WSOpts: model.WSOptsStruct{
|
||||
RealityOpts: model.RealityOptsStruct{
|
||||
PublicKey: params.Get("pbk"),
|
||||
},
|
||||
}
|
||||
if params.Get("type") == "ws" {
|
||||
result.WSOpts = model.WSOptsStruct{
|
||||
Path: params.Get("path"),
|
||||
Headers: model.HeaderStruct{
|
||||
Host: params.Get("host"),
|
||||
},
|
||||
},
|
||||
GRPCOpts: model.GRPCOptsStruct{
|
||||
}
|
||||
}
|
||||
if params.Get("type") == "grpc" {
|
||||
result.GRPCOpts = model.GRPCOptsStruct{
|
||||
GRPCServiceName: params.Get("serviceName"),
|
||||
},
|
||||
RealityOpts: model.RealityOptsStruct{
|
||||
PublicKey: params.Get("pbk"),
|
||||
},
|
||||
}
|
||||
}
|
||||
// 如果有节点名称
|
||||
if len(serverInfo) == 2 {
|
||||
|
@ -6,11 +6,9 @@ import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sub/model"
|
||||
"sub2clash/model"
|
||||
)
|
||||
|
||||
// vmess://eyJ2IjoiMiIsInBzIjoiXHU4MmYxXHU1NmZkLVx1NGYxOFx1NTMxNjMiLCJhZGQiOiJ0LmNjY2FvLmN5b3UiLCJwb3J0IjoiMTY2NDUiLCJpZCI6ImVmNmNiMGY0LTcwZWYtNDY2ZS04NGUwLWRiNDQwMWRmNmZhZiIsImFpZCI6IjAiLCJuZXQiOiJ3cyIsInR5cGUiOiJub25lIiwiaG9zdCI6IiIsInBhdGgiOiIiLCJ0bHMiOiIifQ==
|
||||
|
||||
func ParseVmess(proxy string) (model.Proxy, error) {
|
||||
// 判断是否以 vmess:// 开头
|
||||
if !strings.HasPrefix(proxy, "vmess://") {
|
||||
@ -57,12 +55,14 @@ func ParseVmess(proxy string) (model.Proxy, error) {
|
||||
SkipCertVerify: true,
|
||||
Servername: vmess.Add,
|
||||
Network: vmess.Net,
|
||||
WSOpts: model.WSOptsStruct{
|
||||
}
|
||||
if vmess.Net == "ws" {
|
||||
result.WSOpts = model.WSOptsStruct{
|
||||
Path: vmess.Path,
|
||||
Headers: model.HeaderStruct{
|
||||
Host: vmess.Host,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user