|
@ -11,6 +11,7 @@ import ( |
|
|
"io" |
|
|
"io" |
|
|
"os" |
|
|
"os" |
|
|
"path" |
|
|
"path" |
|
|
|
|
|
"runtime" |
|
|
"strconv" |
|
|
"strconv" |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
@ -22,7 +23,6 @@ var v6TProxyPort = 7289 |
|
|
var configDir = "/etc/xproxy" |
|
|
var configDir = "/etc/xproxy" |
|
|
var assetFile = "/assets.tar.xz" |
|
|
var assetFile = "/assets.tar.xz" |
|
|
|
|
|
|
|
|
var goVersion string |
|
|
|
|
|
var subProcess []*process.Process |
|
|
var subProcess []*process.Process |
|
|
var assetDir, exposeDir, configFile string |
|
|
var assetDir, exposeDir, configFile string |
|
|
|
|
|
|
|
@ -53,8 +53,8 @@ func xproxyInit() { |
|
|
isDebug := flag.Bool("debug", os.Getenv("DEBUG") == "true", "Enable debug mode") |
|
|
isDebug := flag.Bool("debug", os.Getenv("DEBUG") == "true", "Enable debug mode") |
|
|
configName := flag.String("config", xproxyConfig, "Config file name") |
|
|
configName := flag.String("config", xproxyConfig, "Config file name") |
|
|
flag.Parse() |
|
|
flag.Parse() |
|
|
if *isVersion { |
|
|
if *isVersion { // show version info and exit
|
|
|
fmt.Printf("XProxy version %s (%s)\n", version, goVersion) // show version info and exit
|
|
|
fmt.Printf("XProxy version %s (%s %s/%s)\n", version, runtime.Version(), runtime.GOOS, runtime.GOARCH) |
|
|
os.Exit(0) |
|
|
os.Exit(0) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -96,7 +96,7 @@ func main() { |
|
|
}() |
|
|
}() |
|
|
xproxyInit() |
|
|
xproxyInit() |
|
|
var settings config.Config |
|
|
var settings config.Config |
|
|
log.Infof("XProxy %s start (%s)", version, goVersion) |
|
|
log.Infof("XProxy %s start (%s %s/%s)", version, runtime.Version(), runtime.GOOS, runtime.GOARCH) |
|
|
config.Load(configFile, &settings) |
|
|
config.Load(configFile, &settings) |
|
|
loadNetwork(&settings) |
|
|
loadNetwork(&settings) |
|
|
loadProxy(&settings) |
|
|
loadProxy(&settings) |
|
|