mirror of https://github.com/bjdgyc/anylink.git
修复问题
This commit is contained in:
parent
1c5b269aa3
commit
c0c15815f9
|
@ -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)
|
||||
|
|
|
@ -18,6 +18,7 @@ type Online struct {
|
|||
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"`
|
||||
|
@ -90,6 +91,11 @@ 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,
|
||||
|
@ -98,6 +104,7 @@ func GetOnlineSess(search_cate string, search_text string, show_sleeper bool) []
|
|||
MacAddr: v.MacAddr,
|
||||
UniqueMac: v.UniqueMac,
|
||||
RemoteAddr: cSess.RemoteAddr,
|
||||
TransportProtocol: transportProtocol,
|
||||
TunName: cSess.IfName,
|
||||
Mtu: cSess.Mtu,
|
||||
Client: cSess.Client,
|
||||
|
|
|
@ -99,7 +99,10 @@
|
|||
prop="remote_addr"
|
||||
label="远端地址">
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop="transport_protocol"
|
||||
label="传输协议">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="tun_name"
|
||||
label="虚拟网卡">
|
||||
|
|
Loading…
Reference in New Issue