Browse Source

update: remove redundant config

v1.x.x
dnomd343 2 years ago
parent
commit
524a5beb10
  1. 22
      cmd/proxy/config.go
  2. 6
      cmd/proxy/main.go

22
cmd/proxy/config.go

@ -6,31 +6,9 @@ import (
"path" "path"
) )
var dnsConfig = `{
"dns": {
"servers": [
"localhost"
]
}
}`
var routeConfig = `{
"routing": {
"domainStrategy": "AsIs",
"rules": [
{
"type": "field",
"network": "tcp,udp",
"outboundTag": "node"
}
]
}
}`
var outboundsConfig = `{ var outboundsConfig = `{
"outbounds": [ "outbounds": [
{ {
"tag": "node",
"protocol": "freedom", "protocol": "freedom",
"settings": {} "settings": {}
} }

6
cmd/proxy/main.go

@ -2,6 +2,7 @@ package proxy
import ( import (
"XProxy/cmd/common" "XProxy/cmd/common"
log "github.com/sirupsen/logrus"
"path" "path"
) )
@ -56,12 +57,13 @@ func Load(configDir string, exposeDir string, config *Config) {
common.CreateFolder(path.Join(exposeDir, "log")) common.CreateFolder(path.Join(exposeDir, "log"))
common.CreateFolder(path.Join(exposeDir, "config")) common.CreateFolder(path.Join(exposeDir, "config"))
common.CreateFolder(configDir) common.CreateFolder(configDir)
saveConfig(path.Join(exposeDir, "config"), "dns", dnsConfig, false)
saveConfig(path.Join(exposeDir, "config"), "routing", routeConfig, false)
saveConfig(path.Join(exposeDir, "config"), "outbounds", outboundsConfig, false) saveConfig(path.Join(exposeDir, "config"), "outbounds", outboundsConfig, false)
saveConfig(configDir, "inbounds", loadInbounds(config), true) saveConfig(configDir, "inbounds", loadInbounds(config), true)
saveConfig(configDir, "log", loadLogConfig(config.Log, path.Join(exposeDir, "log")), true) saveConfig(configDir, "log", loadLogConfig(config.Log, path.Join(exposeDir, "log")), true)
for _, configFile := range common.ListFiles(path.Join(exposeDir, "config"), ".json") { for _, configFile := range common.ListFiles(path.Join(exposeDir, "config"), ".json") {
if configFile == "log.json" || configFile == "inbounds" {
log.Warningf("Config file %s will be override", configFile)
}
common.CopyFile(path.Join(exposeDir, "config", configFile), path.Join(configDir, configFile)) common.CopyFile(path.Join(exposeDir, "config", configFile), path.Join(configDir, configFile))
} }
} }

Loading…
Cancel
Save