diff --git a/backend/app/dto/dashboard.go b/backend/app/dto/dashboard.go
index a7d3a5c95..3275ac421 100644
--- a/backend/app/dto/dashboard.go
+++ b/backend/app/dto/dashboard.go
@@ -16,10 +16,11 @@ type DashboardBase struct {
KernelArch string `json:"kernelArch"`
KernelVersion string `json:"kernelVersion"`
VirtualizationSystem string `json:"virtualizationSystem"`
-
- CPUCores int `json:"cpuCores"`
- CPULogicalCores int `json:"cpuLogicalCores"`
- CPUModelName string `json:"cpuModelName"`
+ IpV4Addr string `json:"ipv4Addr"`
+ SystemProxy string `json:"SystemProxy"`
+ CPUCores int `json:"cpuCores"`
+ CPULogicalCores int `json:"cpuLogicalCores"`
+ CPUModelName string `json:"cpuModelName"`
CurrentInfo DashboardCurrent `json:"currentInfo"`
}
diff --git a/backend/app/service/dashboard.go b/backend/app/service/dashboard.go
index 0ac4af844..a5cd0d8ab 100644
--- a/backend/app/service/dashboard.go
+++ b/backend/app/service/dashboard.go
@@ -3,6 +3,8 @@ package service
import (
"encoding/json"
"fmt"
+ network "net"
+ "os"
"sort"
"strings"
"sync"
@@ -94,11 +96,20 @@ func (u *DashboardService) LoadBaseInfo(ioOption string, netOption string) (*dto
baseInfo.KernelVersion = hostInfo.KernelVersion
ss, _ := json.Marshal(hostInfo)
baseInfo.VirtualizationSystem = string(ss)
-
+ baseInfo.IpV4Addr = GetOutboundIP()
+ httpProxy := os.Getenv("http_proxy")
+ if httpProxy == "" {
+ httpProxy = os.Getenv("HTTP_PROXY")
+ }
+ if httpProxy != "" {
+ baseInfo.SystemProxy = httpProxy
+ }
+ baseInfo.SystemProxy = "noProxy"
appInstall, err := appInstallRepo.ListBy()
if err != nil {
return nil, err
}
+
baseInfo.AppInstalledNumber = len(appInstall)
postgresqlDbs, err := postgresqlRepo.List()
if err != nil {
@@ -208,6 +219,18 @@ func (u *DashboardService) LoadCurrentInfo(ioOption string, netOption string) *d
return ¤tInfo
}
+func GetOutboundIP() string {
+ conn, err := network.Dial("udp", "8.8.8.8:80")
+
+ if err != nil {
+ return "IPNotFound"
+ }
+ defer conn.Close()
+
+ localAddr := conn.LocalAddr().(*network.UDPAddr)
+ return localAddr.IP.String()
+}
+
type diskInfo struct {
Type string
Mount string
diff --git a/frontend/src/api/interface/dashboard.ts b/frontend/src/api/interface/dashboard.ts
index e593f9e4e..e5728289b 100644
--- a/frontend/src/api/interface/dashboard.ts
+++ b/frontend/src/api/interface/dashboard.ts
@@ -22,6 +22,8 @@ export namespace Dashboard {
kernelArch: string;
kernelVersion: string;
virtualizationSystem: string;
+ ipv4Addr: string;
+ systemProxy: string;
cpuCores: number;
cpuLogicalCores: number;
diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts
index c0b793617..5c1251aba 100644
--- a/frontend/src/lang/modules/zh.ts
+++ b/frontend/src/lang/modules/zh.ts
@@ -337,6 +337,8 @@ const message = {
kernelArch: '系统类型',
network: '流量',
io: '磁盘 IO',
+ ip: '主机地址',
+ proxy: '系统代理',
baseInfo: '基本信息',
totalSend: '总发送',
totalRecv: '总接收',
diff --git a/frontend/src/views/home/index.vue b/frontend/src/views/home/index.vue
index 3e71bdedb..8cf2ca861 100644
--- a/frontend/src/views/home/index.vue
+++ b/frontend/src/views/home/index.vue
@@ -225,6 +225,28 @@
{{ loadUpTime(currentInfo.uptime) }}
+
+
+
+ {{ $t('home.ip') }}
+
+
+ {{ baseInfo.ipv4Addr }}
+
+
+
+
+ {{ $t('home.proxy') }}
+
+
+ {{ baseInfo.systemProxy }}
+
@@ -303,7 +325,8 @@ const baseInfo = ref({
kernelArch: '',
kernelVersion: '',
virtualizationSystem: '',
-
+ ipv4Addr: '',
+ systemProxy: '',
cpuCores: 0,
cpuLogicalCores: 0,
cpuModelName: '',