diff --git a/.gitignore b/.gitignore index 9be79d14..7bb065de 100644 --- a/.gitignore +++ b/.gitignore @@ -117,4 +117,7 @@ src/servers/Scripts/*/ScriptLoader.cpp # cotire generated files/folders cotire/ -*_cotire.cmake \ No newline at end of file +*_cotire.cmake + +*objects.txt +*exports.def \ No newline at end of file diff --git a/bin/config/global.ini.default b/bin/config/global.ini.default index 90adfc7c..072d3f7c 100644 --- a/bin/config/global.ini.default +++ b/bin/config/global.ini.default @@ -2,7 +2,7 @@ Host = 127.0.0.1 Port = 3306 Database = sapphire -Username = sapphire +Username = root Password = SyncThreads = 2 AsyncThreads = 2 @@ -12,6 +12,7 @@ ServerSecret = default DataPath = C:\\SquareEnix\\FINAL FANTASY XIV - A Realm Reborn\\game\\sqpack [GlobalNetwork] +; Values definining how Users and other servers will access - these have to be set to your public IP when running a public server ZoneHost = 127.0.0.1 ZonePort = 54992 diff --git a/bin/config/lobby.ini.default b/bin/config/lobby.ini.default index 8d81d75d..077e947c 100644 --- a/bin/config/lobby.ini.default +++ b/bin/config/lobby.ini.default @@ -1,4 +1,8 @@ [Lobby] WorldID = 67 AllowNoSessionConnect = false -WorldName = Sapphire \ No newline at end of file +WorldName = Sapphire + +[LobbyNetwork] +ListenIp = 0.0.0.0 +ListenPort = 54994 \ No newline at end of file diff --git a/bin/config/rest.ini.default b/bin/config/rest.ini.default index 564a6cee..d51b4967 100644 --- a/bin/config/rest.ini.default +++ b/bin/config/rest.ini.default @@ -1,2 +1,6 @@ [CharacterCreation] -DefaultGMRank = 255 \ No newline at end of file +DefaultGMRank = 255 + +[RestNetwork] +ListenIp = 0.0.0.0 +ListenPort = 80 \ No newline at end of file diff --git a/bin/config/zone.ini.default b/bin/config/zone.ini.default index 3dba125d..7631e9eb 100644 --- a/bin/config/zone.ini.default +++ b/bin/config/zone.ini.default @@ -9,6 +9,10 @@ HotSwap = true [Network] DisconnectTimeout = 20 +[ZoneNetwork] +ListenIp = 0.0.0.0 +ListenPort = 54992 + [General] ; Sent on login - each line must be shorter than 307 characters, split lines with ';' MotD = Welcome to Sapphire!;This is a very good server;You can change these messages by editing General.MotD in config/zone.ini \ No newline at end of file diff --git a/src/servers/sapphire_api/main.cpp b/src/servers/sapphire_api/main.cpp index d4fac57b..bd84343e 100644 --- a/src/servers/sapphire_api/main.cpp +++ b/src/servers/sapphire_api/main.cpp @@ -95,12 +95,11 @@ bool loadSettings( int32_t argc, char* argv[] ) if( arg == "ip" ) { - // todo: ip addr in config - m_pConfig->setValue< std::string >( "GlobalNetwork.RestHost", val ); + m_pConfig->setValue< std::string >( "RestNetwork.ListenIp", val ); } else if( arg == "p" || arg == "port" ) { - m_pConfig->setValue< std::string >( "GlobalNetwork.RestPort", val ); + m_pConfig->setValue< std::string >( "RestNetwork.ListenPort", val ); } else if( arg == "exdpath" || arg == "datapath" ) { @@ -164,7 +163,8 @@ bool loadSettings( int32_t argc, char* argv[] ) if( !loader.initDbs() ) return false; - server.config.port = static_cast< uint16_t >( std::stoul( m_pConfig->getValue< std::string >( "GlobalNetwork.RestPort", "80" ) ) ); + server.config.port = static_cast< uint16_t >( std::stoul( m_pConfig->getValue< std::string >( "RestNetwork.ListenPort", "80" ) ) ); + server.config.address = m_pConfig->getValue< std::string >( "RestNetwork.ListenIp", "0.0.0.0" ); g_log.info( "Database: Connected to " + info.host + ":" + std::to_string( info.port ) ); @@ -756,9 +756,6 @@ int main( int argc, char* argv[] ) if( !loadSettings( argc, argv ) ) throw std::exception(); - server.config.port = stoi( m_pConfig->getValue< std::string >( "GlobalNetwork.RestPort", "80" ) ); - g_log.info( "Starting API server at port " + m_pConfig->getValue< std::string >( "GlobalNetwork.RestPort", "80" ) + "..." ); - server.resource["^/ZoneName/([0-9]+)$"]["GET"] = &getZoneName; server.resource["^/sapphire-api/lobby/createAccount"]["POST"] = &createAccount; server.resource["^/sapphire-api/lobby/login"]["POST"] = &login; @@ -781,6 +778,8 @@ int main( int argc, char* argv[] ) server.start(); } ); + g_log.info( "API server running on " + m_pConfig->getValue< std::string >( "RestNetwork.ListenIp", "0.0.0.0" ) + ":" + m_pConfig->getValue< std::string >( "RestNetwork.ListenPort", "80" ) ); + //Wait for server to start so that the client can connect this_thread::sleep_for( chrono::seconds( 1 ) ); diff --git a/src/servers/sapphire_lobby/ServerLobby.cpp b/src/servers/sapphire_lobby/ServerLobby.cpp index ff59fd84..a623a4e5 100644 --- a/src/servers/sapphire_lobby/ServerLobby.cpp +++ b/src/servers/sapphire_lobby/ServerLobby.cpp @@ -75,7 +75,7 @@ namespace Core { Network::HivePtr hive( new Network::Hive() ); Network::addServerToHive< Network::GameConnection >( m_ip, m_port, hive ); - g_log.info( "Lobbyserver ready for connections." ); + g_log.info( "Lobby server running on " + m_pConfig->getValue< std::string >( "LobbyNetwork.ListenIp", "0.0.0.0" ) + ":" + m_pConfig->getValue< std::string >( "LobbyNetwork.ListenPort", "80" ) ); boost::thread_group worker_threads; worker_threads.create_thread( boost::bind( &Network::Hive::Run, hive.get() ) ); @@ -109,11 +109,11 @@ namespace Core { if( arg == "ip" ) { // todo: ip addr in config - m_pConfig->setValue< std::string >( "GlobalNetwork.LobbyHost", val ); + m_pConfig->setValue< std::string >( "LobbyNetwork.ListenIp", val ); } else if( arg == "p" || arg == "port" ) { - m_pConfig->setValue< std::string >( "GlobalNetwork.LobbyPort", val ); + m_pConfig->setValue< std::string >( "LobbyNetwork.LobbyPort", val ); } else if( arg == "worldip" || arg == "worldip" ) { @@ -131,8 +131,8 @@ namespace Core { } } - m_port = m_pConfig->getValue< uint16_t >( "GlobalNetwork.LobbyPort", 54994 ); - m_ip = m_pConfig->getValue< std::string >( "GlobalNetwork.LobbyHost", "0.0.0.0" ); + m_port = m_pConfig->getValue< uint16_t >( "LobbyNetwork.ListenPort", 54994 ); + m_ip = m_pConfig->getValue< std::string >( "LobbyNetwork.ListenIp", "0.0.0.0" ); g_restConnector.restHost = m_pConfig->getValue< std::string >( "GlobalNetwork.RestHost" ) + ":" + m_pConfig->getValue< std::string >( "GlobalNetwork.RestPort" ); g_restConnector.serverSecret = m_pConfig->getValue< std::string >( "GlobalParameters.ServerSecret" ); diff --git a/src/servers/sapphire_zone/ServerZone.cpp b/src/servers/sapphire_zone/ServerZone.cpp index 87b23a4f..a63a9fff 100644 --- a/src/servers/sapphire_zone/ServerZone.cpp +++ b/src/servers/sapphire_zone/ServerZone.cpp @@ -85,11 +85,11 @@ bool Core::ServerZone::loadSettings( int32_t argc, char* argv[] ) if( arg == "ip" ) { // todo: ip addr in config - pConfig->setValue< std::string >( "GlobalNetwork.ZoneIP", val ); + pConfig->setValue< std::string >( "ZoneNetwork.ListenIp", val ); } else if( arg == "p" || arg == "port" ) { - pConfig->setValue< std::string >( "GlobalNetwork.ZonePort", val ); + pConfig->setValue< std::string >( "ZoneNetwork.ListenPort", val ); } else if( arg == "exdpath" || arg == "datapath" ) { @@ -145,8 +145,8 @@ bool Core::ServerZone::loadSettings( int32_t argc, char* argv[] ) if( !loader.initDbs() ) return false; - m_port = pConfig->getValue< uint16_t >( "GlobalNetwork.ZonePort", 54992 ); - m_ip = pConfig->getValue< std::string >( "GlobalNetwork.ZoneIP", "0.0.0.0" ); + m_port = pConfig->getValue< uint16_t >( "ZoneNetwork.ListenPort", 54992 ); + m_ip = pConfig->getValue< std::string >( "ZoneNetwork.ListenIp", "0.0.0.0" ); return true; } @@ -184,8 +184,7 @@ void Core::ServerZone::run( int32_t argc, char* argv[] ) std::vector< std::thread > thread_list; thread_list.emplace_back( std::thread( std::bind( &Network::Hive::Run, hive.get() ) ) ); - pLog->info( "Server listening on port: " + std::to_string( m_port ) ); - pLog->info( "Ready for connections..." ); + pLog->info( "Zone server running on " + m_ip + ":" + std::to_string( m_port ) ); mainLoop();