Skip to content

Commit 2dbddc9

Browse files
authored
Add files via upload
1 parent 5c29a1b commit 2dbddc9

File tree

1 file changed

+12
-77
lines changed

1 file changed

+12
-77
lines changed

xrkeyparser.go

Lines changed: 12 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,6 @@ type ParseResult struct {
5757
VlessXrConfigs []XrayConf `json:"xrvless,omitzero"`
5858
}
5959

60-
//type SsXrConfigs struct {
61-
// Configs []XrayConf `json:"xrss"`
62-
//}
63-
64-
//type VlessXrConfigs struct {
65-
// Configs []XrayConf `json:"xrvless"`
66-
//}
67-
68-
//type SsConfigs struct {
69-
// Configs []XrSsServerConf `json:"ss"`
70-
//}
71-
7260
type XrayConf struct {
7361
Protocol string `json:"protocol"`
7462
Settings any `json:"settings"` //XrSsServerConf
@@ -276,17 +264,13 @@ func createSsServerConfig(str string) (errstr string) { //, errcode int
276264
}
277265
conf.Port = i
278266
}
279-
if config.SsMultipleOutbounds {
280-
xrconf := new(XrayConf)
281-
xrconf.Protocol = "shadowsocks"
282-
servers := new(XrSsServers)
283-
servers.SsServers = append(servers.SsServers, *conf)
284-
xrconf.Settings = servers
285-
xrconf.Tag = config.SsTag + strconv.Itoa(len(xrSsConfigs)+1)
286-
xrSsConfigs = append(xrSsConfigs, *xrconf)
287-
} else {
288-
ssConfigs = append(ssConfigs, *conf)
289-
}
267+
xrconf := new(XrayConf)
268+
xrconf.Protocol = "shadowsocks"
269+
servers := new(XrSsServers)
270+
servers.SsServers = append(servers.SsServers, *conf)
271+
xrconf.Settings = servers
272+
xrconf.Tag = config.SsTag + strconv.Itoa(len(xrSsConfigs)+1)
273+
xrSsConfigs = append(xrSsConfigs, *xrconf)
290274
ssConfToSave = ssConfToSave + 1
291275
}
292276
return "" //, 0
@@ -450,6 +434,9 @@ func createWsParams(parMap map[string]string) (wsset XrWsSettings) {
450434
}
451435
path, ok := parMap["path"]
452436
if ok {
437+
if path == "%2F" {
438+
path = "/"
439+
}
453440
wsset.Path = path
454441
}
455442
return wsset
@@ -600,11 +587,8 @@ func getHtml(link Link, wg *sync.WaitGroup) {
600587
}
601588

602589
func saveParseResult(resFile os.File) bool {
603-
if config.SsMultipleOutbounds {
604-
parseresult.XrSsConfigs = xrSsConfigs
605-
} else {
606-
parseresult.SsConfigs = ssConfigs
607-
}
590+
591+
parseresult.XrSsConfigs = xrSsConfigs
608592
parseresult.VlessXrConfigs = xrVlConfigs
609593
jsondata, err := json.MarshalIndent(parseresult, "", " ") //ssConfigs
610594
if err != nil {
@@ -621,55 +605,6 @@ func saveParseResult(resFile os.File) bool {
621605
}
622606
}
623607

624-
/*
625-
func getSsConfigs() any {
626-
if config.SsMultipleOutbounds {
627-
SsXrConfigs := new(SsXrConfigs)
628-
SsXrConfigs.Configs = xrSsConfigs
629-
return SsXrConfigs
630-
} else {
631-
SsConfigs := new(SsConfigs)
632-
SsConfigs.Configs = ssConfigs
633-
return SsConfigs
634-
}
635-
}
636-
637-
func saveSsConfigs(resFile os.File) bool {
638-
Configs := getSsConfigs()
639-
jsondata, err := json.MarshalIndent(Configs, "", " ") //ssConfigs
640-
if err != nil {
641-
fmt.Println("json encoding ss conf error", err)
642-
return false
643-
} else {
644-
_, err := resFile.Write(jsondata)
645-
if err != nil {
646-
fmt.Println("json writning ss conf err", err)
647-
return false
648-
} else {
649-
return true
650-
}
651-
}
652-
}
653-
654-
func saveVlConfigs(resFile os.File) bool {
655-
VlessXrConfigs := new(VlessXrConfigs)
656-
VlessXrConfigs.Configs = xrVlConfigs
657-
jsondata, err := json.MarshalIndent(VlessXrConfigs, "", " ") //ssConfigs
658-
if err != nil {
659-
fmt.Println("json encoding ss conf error", err)
660-
return false
661-
} else {
662-
_, err := resFile.Write(jsondata)
663-
if err != nil {
664-
fmt.Println("json writning ss conf err", err)
665-
return false
666-
} else {
667-
return true
668-
}
669-
}
670-
}
671-
*/
672-
673608
func main() {
674609
restart := false
675610
args := os.Args

0 commit comments

Comments
 (0)