package main import ( "time" ) type Config struct { Port int AuthCode string PeerID string Peers []string Domain string NodesEnabled bool CrawlerEnabled bool WebsiteEnabled bool LogLevel int HardCacheDuration time.Duration HardCacheEnabled bool } var defaultConfig = Config{ Port: 5000, Domain: "localhost", Peers: []string{}, AuthCode: generateStrongRandomString(64), NodesEnabled: true, CrawlerEnabled: true, WebsiteEnabled: true, LogLevel: 1, HardCacheDuration: 0, } const configFilePath = "config.ini" var config Config func main() { err := initConfig() if err != nil { printErr("Error during initialization:") return } loadNodeConfig() // go checkMasterHeartbeat() // Not currently used if config.AuthCode == "" { config.AuthCode = generateStrongRandomString(64) printInfo("Generated connection code: %s\n", config.AuthCode) saveConfig(config) } // Generate Host ID hostID, nodeErr := generateHostID() if nodeErr != nil { printErr("Failed to generate host ID: %v", nodeErr) } config.PeerID = hostID // if len(config.Peers) > 0 { // time.Sleep(2 * time.Second) // Give some time for connections to establish // startElection() // } // Start automatic update checker, not used now //go checkForUpdates() InitializeLanguage("en") // Initialize language before generating OpenSearch generateOpenSearchXML(config) go startNodeClient() runServer() }