diff --git a/cmd/proxy/proxy.go b/cmd/proxy/proxy.go index 07782a3..00108e1 100644 --- a/cmd/proxy/proxy.go +++ b/cmd/proxy/proxy.go @@ -215,26 +215,24 @@ var ProxyCmd = &cobra.Command{ } customlog.Printf(customlog.Success, "Started listening for new connections...") fmt.Printf("\n") + + time.Sleep(time.Duration(interval) * time.Second) } - // The procedure of selecting a new outbound and starting it - connect() - // A ticker for the interval in which the outbound changes - ticker := time.NewTicker(time.Duration(interval) * time.Second) - for range ticker.C { + for { + // The procedure of selecting a new outbound and starting it + // Do it for the first time before first tick starts + connect() + customlog.Printf(customlog.Processing, "Switching outbound connection...\n") // Check if any xrayInstance is running if xrayInstance != nil { err = xrayInstance.Close() if err != nil { - //log.Fatalf(err.Error()) + log.Fatalf(err.Error()) } } - - // The procedure of selecting a new outbound and starting it - // Do it for the first time before first tick starts - connect() } } else { // Configuring outbound diff --git a/cmd/root.go b/cmd/root.go index a0cfe34..ded4bcd 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -15,7 +15,7 @@ var rootCmd = &cobra.Command{ Use: "xray-knife", Short: "Swiss Army Knife for xray-core", Long: ``, - Version: "2.8.15", + Version: "2.8.16", // Main Tools: //1. parse: Parses xray config link. //2. net: Multiple network tests for xray configs.