diff options
author | Patric Stout <truebrain@openttd.org> | 2021-04-27 11:51:00 +0200 |
---|---|---|
committer | Patric Stout <github@truebrain.nl> | 2021-07-16 19:50:29 +0200 |
commit | 8adade26ed0354e5357803cf19ea9839c2eb785c (patch) | |
tree | 08c73e20a16ea19ee1545de8df6c4b1095c08707 /src/network/core/config.cpp | |
parent | 55eed246b842d372cd32784c1afcc904aef67f65 (diff) | |
download | openttd-8adade26ed0354e5357803cf19ea9839c2eb785c.tar.xz |
Feature: allow the use of STUN to connect client and server together
This method doesn't require port-forwarding to be used, and works for
most common NAT routers in home setups. But, for sure it doesn't work
for all setups, and not everyone will be able to use this.
Diffstat (limited to 'src/network/core/config.cpp')
-rw-r--r-- | src/network/core/config.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/network/core/config.cpp b/src/network/core/config.cpp index c5fe3adbd..6e7f8a11c 100644 --- a/src/network/core/config.cpp +++ b/src/network/core/config.cpp @@ -39,9 +39,19 @@ const char *NetworkCoordinatorConnectionString() } /** + * Get the connection string for the STUN server from the environment variable OTTD_STUN_CS, + * or when it has not been set a hard coded default DNS hostname of the production server. + * @return The STUN server's connection string. + */ +const char *NetworkStunConnectionString() +{ + return GetEnv("OTTD_STUN_CS", "stun.openttd.org"); +} + +/** * Get the connection string for the content server from the environment variable OTTD_CONTENT_SERVER_CS, * or when it has not been set a hard coded default DNS hostname of the production server. - * @return The game coordinator's connection string. + * @return The content server's connection string. */ const char *NetworkContentServerConnectionString() { @@ -51,7 +61,7 @@ const char *NetworkContentServerConnectionString() /** * Get the connection string for the content mirror from the environment variable OTTD_CONTENT_MIRROR_CS, * or when it has not been set a hard coded default DNS hostname of the production server. - * @return The game coordinator's connection string. + * @return The content mirror's connection string. */ const char *NetworkContentMirrorConnectionString() { |