mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-02-04 04:30:05 +00:00
feat: list & block online users
This commit is contained in:
@@ -16,7 +16,7 @@ type StreamServer struct {
|
||||
|
||||
type StreamServerData struct {
|
||||
Now int64 `json:"now,omitempty"`
|
||||
Online uint64 `json:"online,omitempty"`
|
||||
Online int `json:"online,omitempty"`
|
||||
Servers []StreamServer `json:"servers,omitempty"`
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/gorilla/websocket"
|
||||
"github.com/nezhahq/nezha/pkg/utils"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
@@ -20,7 +23,6 @@ type User struct {
|
||||
|
||||
type UserInfo struct {
|
||||
Role uint8
|
||||
_ [3]byte
|
||||
AgentSecret string
|
||||
}
|
||||
|
||||
@@ -42,3 +44,11 @@ type Profile struct {
|
||||
User
|
||||
LoginIP string `json:"login_ip,omitempty"`
|
||||
}
|
||||
|
||||
type OnlineUser struct {
|
||||
UserID uint64 `json:"user_id,omitempty"`
|
||||
ConnectedAt time.Time `json:"connected_at,omitempty"`
|
||||
IP string `json:"ip,omitempty"`
|
||||
|
||||
Conn *websocket.Conn `json:"-"`
|
||||
}
|
||||
|
||||
@@ -14,12 +14,14 @@ const (
|
||||
WAFBlockReasonTypeLoginFail
|
||||
WAFBlockReasonTypeBruteForceToken
|
||||
WAFBlockReasonTypeAgentAuthFail
|
||||
WAFBlockReasonTypeManual
|
||||
)
|
||||
|
||||
const (
|
||||
BlockIDgRPC = -127 + iota
|
||||
BlockIDToken
|
||||
BlockIDUnknownUser
|
||||
BlockIDManual
|
||||
)
|
||||
|
||||
type WAFApiMock struct {
|
||||
|
||||
Reference in New Issue
Block a user