mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-03-14 07:03:09 +00:00
Refactor code and fix linter warnings (#3627)
* refactor: use any instead of empty interface * refactor: code cleanup
This commit is contained in:
@@ -26,7 +26,7 @@ const (
|
||||
// Message represents a WebSocket message
|
||||
type Message struct {
|
||||
Type MessageType `json:"type"`
|
||||
Payload interface{} `json:"payload"`
|
||||
Payload any `json:"payload"`
|
||||
Time int64 `json:"time"`
|
||||
}
|
||||
|
||||
@@ -250,7 +250,7 @@ func (h *Hub) broadcastParallel(clients []*Client, message []byte) {
|
||||
}
|
||||
|
||||
// Broadcast sends a message to all connected clients
|
||||
func (h *Hub) Broadcast(messageType MessageType, payload interface{}) {
|
||||
func (h *Hub) Broadcast(messageType MessageType, payload any) {
|
||||
if h == nil {
|
||||
return
|
||||
}
|
||||
@@ -289,7 +289,7 @@ func (h *Hub) Broadcast(messageType MessageType, payload interface{}) {
|
||||
}
|
||||
|
||||
// BroadcastToTopic sends a message only to clients subscribed to the specific topic
|
||||
func (h *Hub) BroadcastToTopic(messageType MessageType, payload interface{}) {
|
||||
func (h *Hub) BroadcastToTopic(messageType MessageType, payload any) {
|
||||
if h == nil {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ func GetHub() *Hub {
|
||||
}
|
||||
|
||||
// BroadcastStatus broadcasts server status update to all connected clients
|
||||
func BroadcastStatus(status interface{}) {
|
||||
func BroadcastStatus(status any) {
|
||||
hub := GetHub()
|
||||
if hub != nil {
|
||||
hub.Broadcast(MessageTypeStatus, status)
|
||||
@@ -33,7 +33,7 @@ func BroadcastStatus(status interface{}) {
|
||||
}
|
||||
|
||||
// BroadcastTraffic broadcasts traffic statistics update to all connected clients
|
||||
func BroadcastTraffic(traffic interface{}) {
|
||||
func BroadcastTraffic(traffic any) {
|
||||
hub := GetHub()
|
||||
if hub != nil {
|
||||
hub.Broadcast(MessageTypeTraffic, traffic)
|
||||
@@ -41,7 +41,7 @@ func BroadcastTraffic(traffic interface{}) {
|
||||
}
|
||||
|
||||
// BroadcastInbounds broadcasts inbounds list update to all connected clients
|
||||
func BroadcastInbounds(inbounds interface{}) {
|
||||
func BroadcastInbounds(inbounds any) {
|
||||
hub := GetHub()
|
||||
if hub != nil {
|
||||
hub.Broadcast(MessageTypeInbounds, inbounds)
|
||||
|
||||
Reference in New Issue
Block a user