Files
proxypool/pkg/provider/surge.go
2020-09-04 16:40:50 +08:00

41 lines
649 B
Go

package provider
import (
"strings"
"github.com/zu1k/proxypool/pkg/proxy"
)
type Surge struct {
Base
}
func (s Surge) Provide() string {
s.preFilter()
var resultBuilder strings.Builder
for _, p := range *s.Proxies {
if checkSurgeSupport(p) {
resultBuilder.WriteString(p.ToClash() + "\n")
}
}
return resultBuilder.String()
}
func checkSurgeSupport(p proxy.Proxy) bool {
switch p.(type) {
case *proxy.ShadowsocksR:
return false
case *proxy.Vmess:
return true
case *proxy.Shadowsocks:
ss := p.(*proxy.Shadowsocks)
if checkInList(ssCipherList, ss.Cipher) {
return true
}
default:
return false
}
return false
}