mirror of
https://github.com/wyx2685/V2bX.git
synced 2026-02-04 04:30:08 +00:00
add run many core at the same time
This commit is contained in:
@@ -23,6 +23,7 @@ func New() *Conf {
|
||||
Type: "xray",
|
||||
XrayConfig: &XrayConfig{
|
||||
LogConfig: NewLogConfig(),
|
||||
AssetPath: "/etc/V2bX/",
|
||||
DnsConfigPath: "",
|
||||
InboundConfigPath: "",
|
||||
OutboundConfigPath: "",
|
||||
@@ -35,9 +36,6 @@ func New() *Conf {
|
||||
}
|
||||
|
||||
func (p *Conf) LoadFromPath(filePath string) error {
|
||||
confPath := path.Dir(filePath)
|
||||
os.Setenv("XRAY_LOCATION_ASSET", confPath)
|
||||
os.Setenv("XRAY_LOCATION_CONFIG", confPath)
|
||||
f, err := os.Open(filePath)
|
||||
if err != nil {
|
||||
return fmt.Errorf("open config file error: %s", err)
|
||||
|
||||
@@ -7,13 +7,13 @@ import (
|
||||
|
||||
func TestConf_LoadFromPath(t *testing.T) {
|
||||
c := New()
|
||||
t.Log(c.LoadFromPath("../example/config.yml.example"), c.NodesConfig[0].ControllerConfig.EnableXtls)
|
||||
t.Log(c.LoadFromPath("../example/config.yml.example"))
|
||||
}
|
||||
|
||||
func TestConf_Watch(t *testing.T) {
|
||||
c := New()
|
||||
c.Watch("../example/config.yml.example", func() {
|
||||
log.Println(c.Watch("../example/config.yml.example", func() {
|
||||
log.Println(1)
|
||||
})
|
||||
}))
|
||||
select {}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ type CoreConfig struct {
|
||||
|
||||
type XrayConfig struct {
|
||||
LogConfig *LogConfig `yaml:"Log"`
|
||||
AssetPath string `yaml:"AssetPath"`
|
||||
DnsConfigPath string `yaml:"DnsConfigPath"`
|
||||
RouteConfigPath string `yaml:"RouteConfigPath"`
|
||||
ConnectionConfig *ConnectionConfig `yaml:"ConnectionConfig"`
|
||||
|
||||
Reference in New Issue
Block a user