Fix clash template

This commit is contained in:
problematicconsumer
2023-08-20 23:50:13 +03:30
parent 9d63ae0cb1
commit 85efdbb5ff
4 changed files with 132 additions and 166 deletions

View File

@@ -1,6 +1,7 @@
package shared
import (
_ "embed"
"fmt"
"os"
@@ -10,6 +11,9 @@ import (
"gopkg.in/yaml.v3"
)
//go:embed config.json.template
var configByte []byte
func ParseConfig(path string) error {
content, err := os.ReadFile(path)
if err != nil {
@@ -43,7 +47,7 @@ func parseClash(content []byte) ([]byte, error) {
return nil, err
}
output := defaultTemplate(ConfigTemplateOptions{})
output := configByte
output, err = convert.Patch(output, sbConfig, "", "", nil)
if err != nil {
fmt.Printf("patch error %s", err)