Browse Source

remove: proxy core option

v1.x.x
Dnomd343 2 years ago
parent
commit
6a110a084c
  1. 15
      cmd/config/decode.go
  2. 3
      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) { func decodeProxy(rawConfig *RawConfig, config *Config) {
config.Proxy = rawConfig.Proxy config.Proxy = rawConfig.Proxy
if config.Proxy.Core == "" { // TODO: add proxy bin option
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")
}
log.Debugf("Proxy log level -> %s", config.Proxy.Log) 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("Http inbounds -> %v", config.Proxy.Http)
log.Debugf("Socks5 inbounds -> %v", config.Proxy.Socks) log.Debugf("Socks5 inbounds -> %v", config.Proxy.Socks)
log.Debugf("Add-on inbounds -> %v", config.Proxy.AddOn) log.Debugf("Add-on inbounds -> %v", config.Proxy.AddOn)

3
cmd/config/default.go

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

22
cmd/controller.go

@ -71,15 +71,21 @@ func loadProxy(settings *config.Config) {
} }
func runProxy(settings *config.Config) { func runProxy(settings *config.Config) {
if settings.Proxy.Core == "xray" { // xray-core //if settings.Proxy.Core == "xray" { // xray-core
runProcess([]string{"XRAY_LOCATION_ASSET=" + assetDir}, "xray", "-confdir", configDir) // runProcess([]string{"XRAY_LOCATION_ASSET=" + assetDir}, "xray", "-confdir", configDir)
} else if settings.Proxy.Core == "v2ray" { // v2fly-core //} else if settings.Proxy.Core == "v2ray" { // v2fly-core
runProcess([]string{"V2RAY_LOCATION_ASSET=" + assetDir}, "v2ray", "run", "-d", configDir) // runProcess([]string{"V2RAY_LOCATION_ASSET=" + assetDir}, "v2ray", "run", "-d", configDir)
} else if settings.Proxy.Core == "sagray" { // sager-core //} else if settings.Proxy.Core == "sagray" { // sager-core
runProcess([]string{"V2RAY_LOCATION_ASSET=" + assetDir}, "sagray", "run", "-confdir", configDir) // runProcess([]string{"V2RAY_LOCATION_ASSET=" + assetDir}, "sagray", "run", "-confdir", configDir)
} else { //} else {
log.Panicf("Unknown core type -> %s", settings.Proxy.Core) // 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) { func runRadvd(settings *config.Config) {

2
cmd/proxy/main.go

@ -7,8 +7,8 @@ import (
) )
type Config struct { type Config struct {
//Bin string `yaml:"bin" json:"bin" toml:"bin"`
Log string `yaml:"log" json:"log" toml:"log"` 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"` Http map[string]int `yaml:"http" json:"http" toml:"http"`
Socks map[string]int `yaml:"socks" json:"socks" toml:"socks"` Socks map[string]int `yaml:"socks" json:"socks" toml:"socks"`
AddOn []interface{} `yaml:"addon" json:"addon" toml:"addon"` 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("Assets folder -> %s", assetDir)
log.Debugf("Config file -> %s", configFile) log.Debugf("Config file -> %s", configFile)
// TODO: add PROXY_BIN env option
if os.Getenv("IPV4_TABLE") != "" { if os.Getenv("IPV4_TABLE") != "" {
v4RouteTable, _ = strconv.Atoi(os.Getenv("IPV4_TABLE")) v4RouteTable, _ = strconv.Atoi(os.Getenv("IPV4_TABLE"))
} }

Loading…
Cancel
Save