diff options
| author | MHSanaei <ho3ein.sanaei@gmail.com> | 2023-08-09 00:07:05 +0300 |
|---|---|---|
| committer | MHSanaei <ho3ein.sanaei@gmail.com> | 2023-08-09 00:07:05 +0300 |
| commit | e00c3f1823a4ff80daf8290e2dfec4474e7f9173 (patch) | |
| tree | 8a3cd6e051feeabd19aac2b415953d8d02c3e8a2 /xray/process.go | |
| parent | 05bc655e169471cb7712c518364d8c5b8b41c8f2 (diff) | |
add panel usage to main page
Diffstat (limited to 'xray/process.go')
| -rw-r--r-- | xray/process.go | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/xray/process.go b/xray/process.go index b860360f..315d3ed0 100644 --- a/xray/process.go +++ b/xray/process.go @@ -13,6 +13,7 @@ import ( "strings" "sync" "syscall" + "time" "x-ui/config" "x-ui/logger" @@ -101,16 +102,18 @@ type process struct { version string apiPort int - config *Config - lines *queue.Queue - exitErr error + config *Config + lines *queue.Queue + exitErr error + startTime time.Time } func newProcess(config *Config) *process { return &process{ - version: "Unknown", - config: config, - lines: queue.New(100), + version: "Unknown", + config: config, + lines: queue.New(100), + startTime: time.Now(), } } @@ -154,6 +157,10 @@ func (p *Process) GetConfig() *Config { return p.config } +func (p *Process) GetUptime() uint64 { + return uint64(time.Since(p.startTime).Seconds()) +} + func (p *process) refreshAPIPort() { for _, inbound := range p.config.InboundConfigs { if inbound.Tag == "api" { |
