update sing-box support

This commit is contained in:
Yuzuki616
2023-07-29 18:47:47 +08:00
parent 2812b366b3
commit 96493346f9
34 changed files with 418 additions and 297 deletions

View File

@@ -2,9 +2,10 @@ package conf
import (
"fmt"
"gopkg.in/yaml.v3"
"io"
"os"
"gopkg.in/yaml.v3"
)
type Conf struct {
@@ -15,16 +16,9 @@ type Conf struct {
func New() *Conf {
return &Conf{
CoreConfig: CoreConfig{
Type: "xray",
XrayConfig: &XrayConfig{
LogConfig: NewLogConfig(),
AssetPath: "/etc/V2bX/",
DnsConfigPath: "",
InboundConfigPath: "",
OutboundConfigPath: "",
RouteConfigPath: "",
ConnectionConfig: NewConnectionConfig(),
},
Type: "xray",
XrayConfig: NewXrayConfig(),
SingConfig: NewSingConfig(),
},
NodesConfig: []*NodeConfig{},
}
@@ -44,10 +38,5 @@ func (p *Conf) LoadFromPath(filePath string) error {
if err != nil {
return fmt.Errorf("decode config error: %s", err)
}
old := &OldConfig{}
err = yaml.Unmarshal(content, old)
if err == nil {
migrateOldConfig(p, old)
}
return nil
}