Rename IPv6 server option to allow old config to use as default

This commit is contained in:
Benau 2020-03-15 10:10:05 +08:00
parent 364936e37b
commit 9860191409
5 changed files with 12 additions and 12 deletions

View File

@ -82,7 +82,7 @@ The current server configuration xml looks like this:
<firewalled-server value="true" />
<!-- Enable to allow IPv6 connection if you have a public IPv6 address. STK currently uses dual-stack mode which requires server to have both IPv4 and IPv6 and listen to same port. If STK detects your server has no public IPv6 address or port differs between IPv4 and IPv6 then it will use IPv4 only socket. For system which doesn't support dual-stack socket (like OpenBSD) you may fail to be connected by IPv4 clients. -->
<ipv6-server value="true" />
<ipv6-connection value="true" />
<!-- No server owner in lobby which can control the starting of game or kick any players. -->
<owner-less value="false" />

View File

@ -309,7 +309,7 @@ void ServerLobby::initServerStatsTable()
oss << "CREATE TABLE IF NOT EXISTS " << table_name << " (\n"
" host_id INTEGER UNSIGNED NOT NULL PRIMARY KEY, -- Unique host id in STKHost of each connection session for a STKPeer\n"
" ip INTEGER UNSIGNED NOT NULL, -- IP decimal of host\n";
if (ServerConfig::m_ipv6_server)
if (ServerConfig::m_ipv6_connection)
oss << " ipv6 TEXT NOT NULL DEFAULT '', -- IPv6 (if exists) in string of host\n";
oss << " port INTEGER UNSIGNED NOT NULL, -- Port of host\n"
" online_id INTEGER UNSIGNED NOT NULL, -- Online if of the host (0 for offline account)\n"
@ -370,7 +370,7 @@ void ServerLobby::initServerStatsTable()
oss << "CREATE VIEW IF NOT EXISTS " << full_stats_view_name << " AS\n"
<< " SELECT host_id, ip,\n"
<< " ((ip >> 24) & 255) ||'.'|| ((ip >> 16) & 255) ||'.'|| ((ip >> 8) & 255) ||'.'|| ((ip ) & 255) AS ip_readable,\n";
if (ServerConfig::m_ipv6_server)
if (ServerConfig::m_ipv6_connection)
oss << " ipv6,";
oss << " port, online_id, username, player_num,\n"
<< " " << m_server_stats_table << ".country_code AS country_code, country_flag, country_name, version, os,\n"
@ -393,7 +393,7 @@ void ServerLobby::initServerStatsTable()
oss << "CREATE VIEW IF NOT EXISTS " << current_players_view_name << " AS\n"
<< " SELECT host_id, ip,\n"
<< " ((ip >> 24) & 255) ||'.'|| ((ip >> 16) & 255) ||'.'|| ((ip >> 8) & 255) ||'.'|| ((ip ) & 255) AS ip_readable,\n";
if (ServerConfig::m_ipv6_server)
if (ServerConfig::m_ipv6_connection)
oss << " ipv6,";
oss << " port, online_id, username, player_num,\n"
<< " " << m_server_stats_table << ".country_code AS country_code, country_flag, country_name, version, os,\n"
@ -431,7 +431,7 @@ void ServerLobby::initServerStatsTable()
{
oss << "CREATE VIEW IF NOT EXISTS " << player_stats_view_name << " AS\n"
<< " SELECT a.online_id, a.username, a.ip, a.ip_readable,\n";
if (ServerConfig::m_ipv6_server)
if (ServerConfig::m_ipv6_connection)
oss << " a.ipv6,";
oss << " a.port, a.player_num,\n"
<< " a.country_code, a.country_flag, a.country_name, a.version, a.os, a.ping, a.packet_loss,\n"
@ -1248,7 +1248,7 @@ void ServerLobby::writePlayerReport(Event* event)
auto reporting_npp = reporting_peer->getPlayerProfiles()[0];
std::string query;
if (ServerConfig::m_ipv6_server)
if (ServerConfig::m_ipv6_connection)
{
query = StringUtils::insertValues(
"INSERT INTO %s "
@ -3618,7 +3618,7 @@ void ServerLobby::handleUnencryptedConnection(std::shared_ptr<STKPeer> peer,
if (m_server_stats_table.empty() || peer->isAIPeer())
return;
std::string query;
if (ServerConfig::m_ipv6_server && peer->getAddress().isIPv6())
if (ServerConfig::m_ipv6_connection && peer->getAddress().isIPv6())
{
query = StringUtils::insertValues(
"INSERT INTO %s "

View File

@ -342,7 +342,7 @@ void loadServerLobbyFromConfig()
m_server_max_players > 10)
m_server_max_players = 10;
if (m_ipv6_server)
if (m_ipv6_connection)
{
#ifndef ENABLE_IPV6
Log::warn("ServerConfig", "IPv6 support not compiled.");

View File

@ -183,8 +183,8 @@ namespace ServerConfig
"it allows for saving of server resources if your server is not "
"behind a firewall."));
SERVER_CFG_PREFIX BoolServerConfigParam m_ipv6_server
SERVER_CFG_DEFAULT(BoolServerConfigParam(true, "ipv6-server",
SERVER_CFG_PREFIX BoolServerConfigParam m_ipv6_connection
SERVER_CFG_DEFAULT(BoolServerConfigParam(true, "ipv6-connection",
"Enable to allow IPv6 connection if you have a public IPv6 address. "
"STK currently uses dual-stack mode which requires server to have both "
"IPv4 and IPv6 and listen to same port. If STK detects your server "

View File

@ -266,10 +266,10 @@ STKHost::STKHost(bool server)
ENetAddress addr = {};
if (server)
{
setIPv6Socket(ServerConfig::m_ipv6_server ? 1 : 0);
setIPv6Socket(ServerConfig::m_ipv6_connection ? 1 : 0);
#ifdef ENABLE_IPV6
if (NetworkConfig::get()->getIPType() == NetworkConfig::IP_V4 &&
ServerConfig::m_ipv6_server)
ServerConfig::m_ipv6_connection)
{
Log::warn("STKHost", "Disable IPv6 socket due to missing IPv6.");
setIPv6Socket(0);