force json as singbox config

This commit is contained in:
Hiddify
2024-01-16 17:16:13 +00:00
parent e6fe03c190
commit 867e3acfde

View File

@@ -4,10 +4,10 @@ import (
_ "embed"
"fmt"
"os"
"encoding/json"
"github.com/hiddify/ray2sing/ray2sing"
"github.com/sagernet/sing-box/experimental/libbox"
"github.com/sagernet/sing-box/option"
"github.com/xmdhs/clash2singbox/convert"
"github.com/xmdhs/clash2singbox/model/clash"
"gopkg.in/yaml.v3"
@@ -74,10 +74,10 @@ func parseClashConfig(content []byte, debug bool) ([]byte, error) {
}
func parseSingboxConfig(content []byte, debug bool) ([]byte, error) {
var options option.Options
err := options.UnmarshalJSON(content)
if err != nil {
fmt.Printf("[SingboxParser] unmarshal error: %s\n", err)
var dummy interface{}
err := json.Unmarshal(content, &dummy)
if err != nil{
return nil, err
}
return content, nil