mirror of
https://github.com/nitezs/sub2sing-box.git
synced 2024-12-23 21:44:41 -05:00
🐛 Fix Error when template name contains "http"
This commit is contained in:
parent
3030ec5259
commit
9575fcf925
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,3 +3,4 @@
|
|||||||
dist
|
dist
|
||||||
template.json
|
template.json
|
||||||
.idea
|
.idea
|
||||||
|
test
|
@ -161,7 +161,11 @@ func AddCountryGroup(proxies []model.Outbound, groupType string, sortKey string,
|
|||||||
func MergeTemplate(outbounds []model.Outbound, template string) (string, error) {
|
func MergeTemplate(outbounds []model.Outbound, template string) (string, error) {
|
||||||
var config model.Config
|
var config model.Config
|
||||||
var err error
|
var err error
|
||||||
if strings.HasPrefix(template, "http") {
|
isNetworkFile, err := regexp.MatchString(`^https?://`, template)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
if isNetworkFile {
|
||||||
data, err := util.Fetch(template, 3)
|
data, err := util.Fetch(template, 3)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
package model
|
|
||||||
|
|
||||||
import (
|
|
||||||
"log"
|
|
||||||
"sub2sing-box/model"
|
|
||||||
"testing"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestCountry(t *testing.T) {
|
|
||||||
log.Println(model.GetContryName("US 节点"))
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user