diff --git a/server/base/cfg.go b/server/base/cfg.go
index 6c31310..fba15f0 100644
--- a/server/base/cfg.go
+++ b/server/base/cfg.go
@@ -2,9 +2,11 @@ package base
import (
"fmt"
+ "github.com/bjdgyc/anylink/pkg/utils"
"os"
"path/filepath"
"reflect"
+ "strings"
)
const (
@@ -123,6 +125,11 @@ func initServerCfg() {
if Cfg.JwtSecret == defaultJwt {
fmt.Fprintln(os.Stderr, "=== 使用默认的jwt_secret有安全风险,请设置新的jwt_secret ===")
+
+ // 安全问题,自动生成新的密钥
+ jwtSecret, _ := utils.RandSecret(40, 60)
+ jwtSecret = strings.Trim(jwtSecret, "=")
+ Cfg.JwtSecret = jwtSecret
}
fmt.Printf("ServerCfg: %+v \n", Cfg)
diff --git a/server/sessdata/online.go b/server/sessdata/online.go
index 8785c19..89c39d7 100644
--- a/server/sessdata/online.go
+++ b/server/sessdata/online.go
@@ -11,21 +11,22 @@ import (
)
type Online struct {
- Token string `json:"token"`
- Username string `json:"username"`
- Group string `json:"group"`
- MacAddr string `json:"mac_addr"`
- UniqueMac bool `json:"unique_mac"`
- Ip net.IP `json:"ip"`
- RemoteAddr string `json:"remote_addr"`
- TunName string `json:"tun_name"`
- Mtu int `json:"mtu"`
- Client string `json:"client"`
- BandwidthUp string `json:"bandwidth_up"`
- BandwidthDown string `json:"bandwidth_down"`
- BandwidthUpAll string `json:"bandwidth_up_all"`
- BandwidthDownAll string `json:"bandwidth_down_all"`
- LastLogin time.Time `json:"last_login"`
+ Token string `json:"token"`
+ Username string `json:"username"`
+ Group string `json:"group"`
+ MacAddr string `json:"mac_addr"`
+ UniqueMac bool `json:"unique_mac"`
+ Ip net.IP `json:"ip"`
+ RemoteAddr string `json:"remote_addr"`
+ TransportProtocol string `json:"transport_protocol"`
+ TunName string `json:"tun_name"`
+ Mtu int `json:"mtu"`
+ Client string `json:"client"`
+ BandwidthUp string `json:"bandwidth_up"`
+ BandwidthDown string `json:"bandwidth_down"`
+ BandwidthUpAll string `json:"bandwidth_up_all"`
+ BandwidthDownAll string `json:"bandwidth_down_all"`
+ LastLogin time.Time `json:"last_login"`
}
type Onlines []Online
@@ -90,22 +91,28 @@ func GetOnlineSess(search_cate string, search_text string, show_sleeper bool) []
}
if show_sleeper || v.IsActive {
+ transportProtocol := "TCP"
+ dSess := cSess.GetDtlsSession()
+ if dSess != nil {
+ transportProtocol = "UDP"
+ }
val := Online{
- Token: v.Token,
- Ip: cSess.IpAddr,
- Username: v.Username,
- Group: v.Group,
- MacAddr: v.MacAddr,
- UniqueMac: v.UniqueMac,
- RemoteAddr: cSess.RemoteAddr,
- TunName: cSess.IfName,
- Mtu: cSess.Mtu,
- Client: cSess.Client,
- BandwidthUp: utils.HumanByte(cSess.BandwidthUpPeriod.Load()) + "/s",
- BandwidthDown: utils.HumanByte(cSess.BandwidthDownPeriod.Load()) + "/s",
- BandwidthUpAll: utils.HumanByte(cSess.BandwidthUpAll.Load()),
- BandwidthDownAll: utils.HumanByte(cSess.BandwidthDownAll.Load()),
- LastLogin: v.LastLogin,
+ Token: v.Token,
+ Ip: cSess.IpAddr,
+ Username: v.Username,
+ Group: v.Group,
+ MacAddr: v.MacAddr,
+ UniqueMac: v.UniqueMac,
+ RemoteAddr: cSess.RemoteAddr,
+ TransportProtocol: transportProtocol,
+ TunName: cSess.IfName,
+ Mtu: cSess.Mtu,
+ Client: cSess.Client,
+ BandwidthUp: utils.HumanByte(cSess.BandwidthUpPeriod.Load()) + "/s",
+ BandwidthDown: utils.HumanByte(cSess.BandwidthDownPeriod.Load()) + "/s",
+ BandwidthUpAll: utils.HumanByte(cSess.BandwidthUpAll.Load()),
+ BandwidthDownAll: utils.HumanByte(cSess.BandwidthDownAll.Load()),
+ LastLogin: v.LastLogin,
}
datas = append(datas, val)
}
diff --git a/version b/version
index e96a871..d61567c 100644
--- a/version
+++ b/version
@@ -1 +1 @@
-0.12.2
\ No newline at end of file
+0.12.3
\ No newline at end of file
diff --git a/web/src/pages/user/Online.vue b/web/src/pages/user/Online.vue
index 2ba25ad..d3a2b49 100644
--- a/web/src/pages/user/Online.vue
+++ b/web/src/pages/user/Online.vue
@@ -99,7 +99,10 @@
prop="remote_addr"
label="远端地址">
-
+
+