From 48e809fcdefeb806747a07e19c87f43fcdc75b80 Mon Sep 17 00:00:00 2001 From: mzz2017 Date: Sat, 25 Sep 2021 17:24:42 +0800 Subject: [PATCH] optimize(report connection): add version of v2ray-core --- service/conf/report/connection.go | 9 +++++++++ service/conf/report/coreStatus.go | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/service/conf/report/connection.go b/service/conf/report/connection.go index 36865862..6702ad20 100644 --- a/service/conf/report/connection.go +++ b/service/conf/report/connection.go @@ -4,6 +4,7 @@ import ( "fmt" "github.com/v2rayA/v2rayA/conf" "github.com/v2rayA/v2rayA/core/ipforward" + "github.com/v2rayA/v2rayA/core/v2ray/where" "github.com/v2rayA/v2rayA/db/configure" "strings" ) @@ -32,6 +33,14 @@ func ConnectionReport(arg []string) (report string) { "", ) + // get version of v2ray-core + ver, err := where.GetV2rayServiceVersion() + if err != nil { + lines = append(lines, fmt.Sprintf("failed to get version of v2ray-core: %v", err)) + return + } else { + lines = append(lines, fmt.Sprintf("Core Version: %v", ver)) + } // check if v2ray-core is running ok, report := DefaultCoreStatusReporter.FromDatabase() lines = append(lines, report) diff --git a/service/conf/report/coreStatus.go b/service/conf/report/coreStatus.go index 6eaa0da7..d1c33ce6 100644 --- a/service/conf/report/coreStatus.go +++ b/service/conf/report/coreStatus.go @@ -45,7 +45,7 @@ func (r *CoreStatusReporter) FromApiListening() (ok bool, report string) { if apiPort == 0 { return false, "cannot get api port from config file" } - conn, err := net.DialTimeout("tcp", net.JoinHostPort("127.0.0.1", strconv.Itoa(apiPort)), 3*time.Second) + conn, err := net.DialTimeout("tcp", net.JoinHostPort("127.0.0.1", strconv.Itoa(apiPort)), 5*time.Second) if err != nil { return false, "v2ray-core is NOT running" }