Add new Radix UI components and associated dependencies in package-lock.json
This commit is contained in:
@@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"log"
|
||||
"net/url"
|
||||
@@ -15,6 +16,51 @@ import (
|
||||
"github.com/gorilla/websocket"
|
||||
)
|
||||
|
||||
type DevServer struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
EncryptedRcon string `json:"encryptedRcon"`
|
||||
}
|
||||
|
||||
type DecryptedRcon struct {
|
||||
Address string `json:"address"`
|
||||
Port int `json:"port"`
|
||||
Pass string `json:"pass"`
|
||||
}
|
||||
|
||||
func handleServerConfig(server DevServer, masterKey []byte) {
|
||||
if server.EncryptedRcon == "" {
|
||||
log.Printf("[RCON] Server %s has no RCON configuration", server.Name)
|
||||
return
|
||||
}
|
||||
|
||||
// 1. Decode Base64
|
||||
encryptedBytes, err := base64.StdEncoding.DecodeString(server.EncryptedRcon)
|
||||
if err != nil {
|
||||
log.Printf("[RCON] Failed to decode RCON blob for %s: %v", server.Name, err)
|
||||
return
|
||||
}
|
||||
|
||||
// 2. Decrypt using local Master Key (E2EE)
|
||||
decryptedJSON, err := crypto.Decrypt(encryptedBytes, masterKey)
|
||||
if err != nil {
|
||||
log.Printf("[RCON] Failed to decrypt RCON for %s: %v (Key mismatch?)", server.Name, err)
|
||||
return
|
||||
}
|
||||
|
||||
// 3. Parse RCON parameters
|
||||
var rcon DecryptedRcon
|
||||
if err := json.Unmarshal(decryptedJSON, &rcon); err != nil {
|
||||
log.Printf("[RCON] Failed to parse decrypted RCON JSON for %s: %v", server.Name, err)
|
||||
return
|
||||
}
|
||||
|
||||
log.Printf("[RCON] Successfully decrypted credentials for %s", server.Name)
|
||||
log.Printf("[RCON] Target established: %s:%d (Auth secret verified)", rcon.Address, rcon.Port)
|
||||
|
||||
// TODO: Establish persistent RCON connection
|
||||
}
|
||||
|
||||
var mockLogs = []string{
|
||||
"12:30:01.122 SCRIPT : [RJSSupport][Chat] [Global] Zauberklöte: hi, leute kurze frage. zock seit monaten wieder mal arma, was ist aus dem gtg#4 und #5 geworden, da ist ja nix los",
|
||||
"09:37:50.865 DEFAULT : BattlEye Server: 'Player #0 Mike1Delta (92.209.175.19:6679) connected'",
|
||||
@@ -81,6 +127,25 @@ func main() {
|
||||
log.Println("Connected to gateway")
|
||||
var mu sync.Mutex
|
||||
|
||||
// 0. Listen for Configuration Updates (E2EE)
|
||||
go func() {
|
||||
for {
|
||||
_, message, err := c.ReadMessage()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var msg struct {
|
||||
Type string `json:"type"`
|
||||
Server DevServer `json:"server"`
|
||||
}
|
||||
if err := json.Unmarshal(message, &msg); err == nil && msg.Type == "CONFIG_UPDATE" {
|
||||
log.Printf("[CONFIG] Received update for server: %s", msg.Server.Name)
|
||||
handleServerConfig(msg.Server, masterKey)
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
// 1. Telemetry Loop
|
||||
go func() {
|
||||
for {
|
||||
@@ -111,13 +176,14 @@ func main() {
|
||||
line := mockLogs[i%len(mockLogs)]
|
||||
event := parser.ParseLine(line)
|
||||
if event != nil {
|
||||
// Enrich event with blind index for player names
|
||||
if event.Type == "JOIN" || event.Type == "LEAVE" || event.Type == "CHAT" {
|
||||
playerName := extractPlayerName(event.Content)
|
||||
if playerName != "" {
|
||||
blindIndex := crypto.GenerateBlindIndex(playerName, masterKey)
|
||||
event.Content = event.Content + " [BLIND:" + blindIndex + "]"
|
||||
}
|
||||
event.ServerID = "server-123"
|
||||
event.ServerName = "AMS-NODE-01"
|
||||
|
||||
if event.PlayerName != "" {
|
||||
event.PlayerNameHash = crypto.GenerateBlindIndex(event.PlayerName, masterKey)
|
||||
} else {
|
||||
event.PlayerName = "SYSTEM"
|
||||
event.PlayerNameHash = "system-blind-index"
|
||||
}
|
||||
|
||||
payload, _ := json.Marshal(event)
|
||||
|
||||
Reference in New Issue
Block a user