Improve configuration merge

This commit is contained in:
世界
2023-12-10 22:57:28 +08:00
parent d38336bec4
commit 4e4d220bbe
3 changed files with 17 additions and 19 deletions

View File

@@ -3,7 +3,6 @@ package libbox
import (
"bytes"
"context"
"encoding/json"
"net/netip"
"os"
@@ -15,13 +14,13 @@ import (
"github.com/sagernet/sing-tun"
"github.com/sagernet/sing/common/control"
E "github.com/sagernet/sing/common/exceptions"
"github.com/sagernet/sing/common/json"
"github.com/sagernet/sing/common/logger"
"github.com/sagernet/sing/common/x/list"
)
func parseConfig(configContent string) (option.Options, error) {
var options option.Options
err := options.UnmarshalJSON([]byte(configContent))
options, err := json.UnmarshalExtended[option.Options]([]byte(configContent))
if err != nil {
return option.Options{}, E.Cause(err, "decode config")
}