mirror of
https://github.com/v2rayA/v2rayA.git
synced 2026-11-20 23:02:25 +03:00
optimize(report connection): add version of v2ray-core
This commit is contained in:
1 parent
4c00208478
commit
48e809fcde
2 files changed
+10
-1
No files matched your search
@@ -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)
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user