diff options
| author | Ahmad Thoriq Najahi <najahi@zephyrus.id> | 2024-04-29 09:44:16 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-29 09:44:16 +0300 |
| commit | 2d209836900007b838c13ede66dd4855182bbe54 (patch) | |
| tree | 12f7d4f88d269fb62f9020cbf02f755ffc4d82d4 /web/service | |
| parent | 490048a975cb7cbb20008004c3f9503c082ee5b9 (diff) | |
feat(tgbot): Add `xray-core` version into server status (#2236)
Signed-off-by: Ahmad Thoriq Najahi <najahi@zephyrus.id>
Diffstat (limited to 'web/service')
| -rw-r--r-- | web/service/tgbot.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/web/service/tgbot.go b/web/service/tgbot.go index ad9fe2c5..b8b04f05 100644 --- a/web/service/tgbot.go +++ b/web/service/tgbot.go @@ -948,8 +948,14 @@ func (t *Tgbot) sendExhaustedToAdmins() { func (t *Tgbot) getServerUsage() string { info, ipv4, ipv6 := "", "", "" + + // get latest status of server + t.lastStatus = t.serverService.GetStatus(t.lastStatus) + onlines := p.GetOnlineClients() + info += t.I18nBot("tgbot.messages.hostname", "Hostname=="+hostname) info += t.I18nBot("tgbot.messages.version", "Version=="+config.GetVersion()) + info += t.I18nBot("tgbot.messages.xrayVersion", "XrayVersion=="+fmt.Sprint(t.lastStatus.Xray.Version)) // get ip address netInterfaces, err := net.Interfaces() @@ -978,9 +984,6 @@ func (t *Tgbot) getServerUsage() string { info += t.I18nBot("tgbot.messages.ipv6", "IPv6=="+ipv6) } - // get latest status of server - t.lastStatus = t.serverService.GetStatus(t.lastStatus) - onlines := p.GetOnlineClients() info += t.I18nBot("tgbot.messages.serverUpTime", "UpTime=="+strconv.FormatUint(t.lastStatus.Uptime/86400, 10), "Unit=="+t.I18nBot("tgbot.days")) info += t.I18nBot("tgbot.messages.serverLoad", "Load1=="+strconv.FormatFloat(t.lastStatus.Loads[0], 'f', 2, 64), "Load2=="+strconv.FormatFloat(t.lastStatus.Loads[1], 'f', 2, 64), "Load3=="+strconv.FormatFloat(t.lastStatus.Loads[2], 'f', 2, 64)) info += t.I18nBot("tgbot.messages.serverMemory", "Current=="+common.FormatTraffic(int64(t.lastStatus.Mem.Current)), "Total=="+common.FormatTraffic(int64(t.lastStatus.Mem.Total))) |
