add clean
This commit is contained in:
@@ -112,8 +112,11 @@ func ParseSSRLink(link string) (*ShadowsocksR, error) {
|
||||
if err != nil {
|
||||
return nil, ErrorProtocolParamParseFail
|
||||
}
|
||||
if strings.HasSuffix(protocolParam, "_compatible") {
|
||||
protocolParam = strings.ReplaceAll(protocolParam, "_compatible", "")
|
||||
if tool.ContainChineseChar(protocolParam) {
|
||||
protocolParam = ""
|
||||
}
|
||||
if strings.HasSuffix(protocol, "_compatible") {
|
||||
protocol = strings.ReplaceAll(protocol, "_compatible", "")
|
||||
}
|
||||
|
||||
// obfs param
|
||||
@@ -121,8 +124,11 @@ func ParseSSRLink(link string) (*ShadowsocksR, error) {
|
||||
if err != nil {
|
||||
return nil, ErrorObfsParamParseFail
|
||||
}
|
||||
if strings.HasSuffix(obfsParam, "_compatible") {
|
||||
obfsParam = strings.ReplaceAll(obfsParam, "_compatible", "")
|
||||
if tool.ContainChineseChar(obfsParam) {
|
||||
obfsParam = ""
|
||||
}
|
||||
if strings.HasSuffix(obfs, "_compatible") {
|
||||
obfs = strings.ReplaceAll(obfs, "_compatible", "")
|
||||
}
|
||||
|
||||
//group, err := tool.Base64DecodeString(moreInfo.Get("group"))
|
||||
|
||||
17
tool/unicode.go
Normal file
17
tool/unicode.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package tool
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"unicode"
|
||||
)
|
||||
|
||||
var hanRe = regexp.MustCompile("[\u3002\uff1b\uff0c\uff1a\u201c\u201d\uff08\uff09\u3001\uff1f\u300a\u300b]")
|
||||
|
||||
func ContainChineseChar(str string) bool {
|
||||
for _, r := range str {
|
||||
if unicode.Is(unicode.Scripts["Han"], r) || (hanRe.MatchString(string(r))) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
Reference in New Issue
Block a user