Browse Source

remove: proxy core option

v1.x.x
Dnomd343 2 years ago
parent
commit
6a110a084c
  1. 15
      cmd/config/decode.go
  2. 5
      cmd/config/default.go
  3. 22
      cmd/controller.go
  4. 2
      cmd/proxy/main.go
  5. 2
      cmd/xproxy.go

15
cmd/config/decode.go

@ -132,20 +132,9 @@ func decodeIPv6(rawConfig *RawConfig, config *Config) {
func decodeProxy(rawConfig *RawConfig, config *Config) {
config.Proxy = rawConfig.Proxy
if config.Proxy.Core == "" {
config.Proxy.Core = "xray" // use xray in default
}
if config.Proxy.Core != "xray" && config.Proxy.Core != "v2ray" && config.Proxy.Core != "sagray" {
log.Warningf("Unknown core type -> %s", config.Proxy.Core)
}
if config.Proxy.Core != "xray" && config.Proxy.Core != "sagray" && !config.Proxy.Sniff.Redirect {
log.Warningf("V2fly core couldn't disable redirect in sniff (aka `routeOnly` option)")
}
if config.Proxy.Core != "xray" && len(config.Proxy.Sniff.Exclude) != 0 {
log.Warningf("The exclude list in sniff options can only use for Xray-core")
}
// TODO: add proxy bin option
log.Debugf("Proxy log level -> %s", config.Proxy.Log)
log.Debugf("Core type -> %s", config.Proxy.Core)
//log.Debugf("Core type -> %s", config.Proxy.Core)
log.Debugf("Http inbounds -> %v", config.Proxy.Http)
log.Debugf("Socks5 inbounds -> %v", config.Proxy.Socks)
log.Debugf("Add-on inbounds -> %v", config.Proxy.AddOn)

5
cmd/config/default.go

@ -11,9 +11,10 @@ import (
)
var defaultConfig = map[string]interface{}{
// TODO: add proxy bin option
"proxy": map[string]string{
"core": "xray",
"log": "warning",
//"core": "xray",
"log": "warning",
},
"network": map[string]interface{}{
"bypass": []string{

22
cmd/controller.go

@ -71,15 +71,21 @@ func loadProxy(settings *config.Config) {
}
func runProxy(settings *config.Config) {
if settings.Proxy.Core == "xray" { // xray-core
runProcess([]string{"XRAY_LOCATION_ASSET=" + assetDir}, "xray", "-confdir", configDir)
} else if settings.Proxy.Core == "v2ray" { // v2fly-core
runProcess([]string{"V2RAY_LOCATION_ASSET=" + assetDir}, "v2ray", "run", "-d", configDir)
} else if settings.Proxy.Core == "sagray" { // sager-core
runProcess([]string{"V2RAY_LOCATION_ASSET=" + assetDir}, "sagray", "run", "-confdir", configDir)
} else {
log.Panicf("Unknown core type -> %s", settings.Proxy.Core)
//if settings.Proxy.Core == "xray" { // xray-core
// runProcess([]string{"XRAY_LOCATION_ASSET=" + assetDir}, "xray", "-confdir", configDir)
//} else if settings.Proxy.Core == "v2ray" { // v2fly-core
// runProcess([]string{"V2RAY_LOCATION_ASSET=" + assetDir}, "v2ray", "run", "-d", configDir)
//} else if settings.Proxy.Core == "sagray" { // sager-core
// runProcess([]string{"V2RAY_LOCATION_ASSET=" + assetDir}, "sagray", "run", "-confdir", configDir)
//} else {
// log.Panicf("Unknown core type -> %s", settings.Proxy.Core)
//}
assetEnv := []string{
"XRAY_LOCATION_ASSET=" + assetDir, // xray asset folder
"V2RAY_LOCATION_ASSET=" + assetDir, // v2ray / sagray asset folder
}
// TODO: add proxy bin options
runProcess(assetEnv, "xray", "run", "-confdir", configDir)
}
func runRadvd(settings *config.Config) {

2
cmd/proxy/main.go

@ -7,8 +7,8 @@ import (
)
type Config struct {
//Bin string `yaml:"bin" json:"bin" toml:"bin"`
Log string `yaml:"log" json:"log" toml:"log"`
Core string `yaml:"core" json:"core" toml:"core"`
Http map[string]int `yaml:"http" json:"http" toml:"http"`
Socks map[string]int `yaml:"socks" json:"socks" toml:"socks"`
AddOn []interface{} `yaml:"addon" json:"addon" toml:"addon"`

2
cmd/xproxy.go

@ -70,6 +70,8 @@ func xproxyInit() {
log.Debugf("Assets folder -> %s", assetDir)
log.Debugf("Config file -> %s", configFile)
// TODO: add PROXY_BIN env option
if os.Getenv("IPV4_TABLE") != "" {
v4RouteTable, _ = strconv.Atoi(os.Getenv("IPV4_TABLE"))
}

Loading…
Cancel
Save