This commit is contained in:
zu1k
2020-08-12 08:06:07 +08:00
parent 3e2f9d6030
commit 5ca9da8b82
4 changed files with 17 additions and 0 deletions

View File

@@ -1,6 +1,9 @@
package app
import (
"math/rand"
"strconv"
"github.com/zu1k/proxypool/getter"
"github.com/zu1k/proxypool/proxy"
)
@@ -31,5 +34,10 @@ func CrawlTGChannel() {
node = append(node, GetProxies()...)
node = proxy.Deduplication(node)
num := len(node)
for i := 0; i < num; i++ {
node[i].SetName("@tgbotlist_" + strconv.Itoa(rand.Int()))
}
SetProxies(node)
}

View File

@@ -12,6 +12,7 @@ type Proxy interface {
String() string
ToClash() string
Identifier() string
SetName(name string)
}
func Deduplication(src []Proxy) []Proxy {

View File

@@ -53,6 +53,10 @@ func (ssr ShadowsocksR) ToClash() string {
return "- " + string(data)
}
func (ssr ShadowsocksR) SetName(name string) {
ssr.Name = name
}
func ParseSSRLink(link string) (ShadowsocksR, error) {
if !strings.HasPrefix(link, "ssr") {
return ShadowsocksR{}, ErrorNotSSRLink

View File

@@ -64,6 +64,10 @@ func (v Vmess) ToClash() string {
return "- " + string(data)
}
func (v Vmess) SetName(name string) {
v.Name = name
}
type vmessLinkJson struct {
Add string `json:"add"`
V string `json:"v"`