Refactor core configuration and UUID handling

- Changed UUIDLength type from byte to int in core/config/consts.go
- Introduced MetaDir constant in core/config/consts.go
- Added corestate package with initial state management and UUID handling
- Implemented GetNodeUUID and SetNodeUUID functions for UUID file management
- Created RunManager and RunFileManager for runtime directory management
- Updated GeneralServer to use new configuration structure
- Removed deprecated init package and replaced with main entry point
- Added color utility functions for logging
- Enhanced UUID generation functions in utils package
- Updated update logic to handle new configuration structure
- Added routines for cleaning temporary runtime directories
- Introduced response formatting for API responses
This commit is contained in:
alex
2025-07-09 01:21:34 +03:00
parent 8d01314ded
commit 9919f77c90
31 changed files with 1186 additions and 275 deletions

21
core/logs/color.go Normal file
View File

@@ -0,0 +1,21 @@
package logs
import "fmt"
func SetBlack(s string) string { return fmt.Sprintf("\033[30m%s\033[0m", s) }
func SetRed(s string) string { return fmt.Sprintf("\033[31m%s\033[0m", s) }
func SetGreen(s string) string { return fmt.Sprintf("\033[32m%s\033[0m", s) }
func SetYellow(s string) string { return fmt.Sprintf("\033[33m%s\033[0m", s) }
func SetBlue(s string) string { return fmt.Sprintf("\033[34m%s\033[0m", s) }
func SetMagenta(s string) string { return fmt.Sprintf("\033[35m%s\033[0m", s) }
func SetCyan(s string) string { return fmt.Sprintf("\033[36m%s\033[0m", s) }
func SetWhite(s string) string { return fmt.Sprintf("\033[37m%s\033[0m", s) }
func SetBrightBlack(s string) string { return fmt.Sprintf("\033[90m%s\033[0m", s) }
func SetBrightRed(s string) string { return fmt.Sprintf("\033[91m%s\033[0m", s) }
func SetBrightGreen(s string) string { return fmt.Sprintf("\033[92m%s\033[0m", s) }
func SetBrightYellow(s string) string { return fmt.Sprintf("\033[93m%s\033[0m", s) }
func SetBrightBlue(s string) string { return fmt.Sprintf("\033[94m%s\033[0m", s) }
func SetBrightMagenta(s string) string { return fmt.Sprintf("\033[95m%s\033[0m", s) }
func SetBrightCyan(s string) string { return fmt.Sprintf("\033[96m%s\033[0m", s) }
func SetBrightWhite(s string) string { return fmt.Sprintf("\033[97m%s\033[0m", s) }