Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(Core/Packet): Support RelayPacket in Auth and World servers #19998

Closed
wants to merge 2 commits into from

Conversation

pangolp
Copy link
Contributor

@pangolp pangolp commented Sep 20, 2024

Changes Proposed:

This PR proposes changes to:

  • Core (units, players, creatures, game systems).

Issues Addressed:

  • Closes

Tests Performed:

This PR has been:

  • Tested in-game by the author.

How to Test the Changes:

This code is necessary to be able to use the following tool. I upload it so that we can discuss it, because I really doubt that it can be modularized, however, its author assures that with this tool, the ping can be considerably reduced by creating mirror servers.
https://github.com/masterking32/WoW-Server-Relay

How to Test AzerothCore PRs

When a PR is ready to be tested, it will be marked as [WAITING TO BE TESTED].

You can help by testing PRs and writing your feedback here on the PR's page on GitHub. Follow the instructions here:

http://www.azerothcore.org/wiki/How-to-test-a-PR

REMEMBER: when testing a PR that changes something generic (i.e. a part of code that handles more than one specific thing), the tester should not only check that the PR does its job (e.g. fixing spell XXX) but especially check that the PR does not cause any regression (i.e. introducing new bugs).

For example: if a PR fixes spell X by changing a part of code that handles spells X, Y, and Z, we should not only test X, but we should test Y and Z as well.

@github-actions github-actions bot added CORE Related to the core file-cpp Used to trigger the matrix build labels Sep 20, 2024
@pangolp
Copy link
Contributor Author

pangolp commented Sep 20, 2024

@masterking32 Maybe you can explain to me better everything related to this code, since it is your creation, I just adapted it. If it could be modularized, I would have done it, but I think it would be difficult to really do.

@pangolp pangolp changed the title Support RelayPacket in Auth and World servers chore(Core/Packet): Support RelayPacket in Auth and World servers Sep 20, 2024
@kissingers
Copy link
Contributor

https://github.com/masterking32/WoW-Server-Relay
This is a nodejs script, so if the relay server have Performance issues for large sessions?
If use C++ or C# as a demo code do the relay server may be better , so that the relay server can not only realy work , but also further development of the user connection for additional processing , with the client agent , can achieve a lot of features

@sudlud
Copy link
Member

sudlud commented Sep 20, 2024

@walkline

@walkline
Copy link
Contributor

AzerothCore already supports Proxy Protocol v2, and you can use HAProxy, Envoy, Traefik, and many other tools that support Proxy Protocol to achieve the same result as this specific relay. And remember to set up the firewall correctly.

@pangolp
Copy link
Contributor Author

pangolp commented Sep 20, 2024

AzerothCore already supports Proxy Protocol v2, and you can use HAProxy, Envoy, Traefik, and many other tools that support Proxy Protocol to achieve the same result as this specific relay. And remember to set up the firewall correctly.

If it is true that the emulator already supports something similar to this, then there is a lack of documentation, because I as a contributor have no idea how to create relay servers currently without this content. At least @masterking32 made the changes to the emulator, and also provided the tool in node.js, so we can use it. Can't both systems coexist at the end of the day? And if it is not possible, then someone should explain how to create other servers and be able to connect to the main server.

@pangolp
Copy link
Contributor Author

pangolp commented Sep 20, 2024

https://github.com/masterking32/WoW-Server-Relay This is a nodejs script, so if the relay server have Performance issues for large sessions? If use C++ or C# as a demo code do the relay server may be better , so that the relay server can not only realy work , but also further development of the user connection for additional processing , with the client agent , can achieve a lot of features

I just took someone else's work to make it work with this emulator. In fact, if I could do it in module form, I wouldn't even have created the pull request, so I can't really answer that question.

@Nyeriah
Copy link
Member

Nyeriah commented Sep 20, 2024

AzerothCore already supports Proxy Protocol v2, and you can use HAProxy, Envoy, Traefik, and many other tools that support Proxy Protocol to achieve the same result as this specific relay. And remember to set up the firewall correctly.

Considering this I feel like we don't need this implementation in the core.

@pangolp
Copy link
Contributor Author

pangolp commented Sep 20, 2024

Considering this I feel like we don't need this implementation in the core.

And how do we replicate multiple servers and thus be able to offer them the possibility of having less latency in different places? Nobody has explained how to do that. Here at least, it would be something optional and tied to another tool that nobody has even tested. I think that first, we should see the differences and in any case, we could determine if it is necessary or not.

According to its creator, he got these results. Which, at the very least, is somewhat curious. And we could take it into account.

screenshot_5593_2024-04-27_15 58 57

@kissingers
Copy link
Contributor

Indeed, there is a lack of a simple example of how to implement proxy v2. For me, the idea is not to use an off-the-shelf proxy, but to extend some additional features to control user connections and deny unwanted access. For example, obtaining the device's machine code through a client login utility and verifying the uniqueness of the player's device on the proxy.

@pangolp
Copy link
Contributor Author

pangolp commented Sep 20, 2024

If there is another way to do this, I'm sure we can close it without any problems, but so far, I wouldn't know how to do this same job without this code and this tool. Now, if you give me an example and we publish it on the wiki, and we get better or similar results, great, we can close it without any problems. But at least let's make sure that there is documentation and some way to get better or equal results.

@Nyeriah
Copy link
Member

Nyeriah commented Sep 20, 2024

I just took someone else's work to make it work with this emulator. In fact, if I could do it in module form, I wouldn't even have created the pull request, so I can't really answer that question.

Probably best to leave it to the author in that case as they can answer the questions submitted by the reviewers and also resolve any issues the implementation brings, like vulnerabilities.

@pangolp
Copy link
Contributor Author

pangolp commented Sep 20, 2024

I totally agree. I'm trying to get the author to speak up and explain any doubts you may have on the subject. What's more, if we need to make changes to the code, I'll listen to you and I'm open to suggestions.

@kissingers
Copy link
Contributor

I want a simple high performance proxy sample code and then some modifications on that. Don't do as js, js is prone to performance problems at high concurrency

masterking32 added a commit to masterking32/WoW-Server-Relay that referenced this pull request Sep 20, 2024
@pangolp
Copy link
Contributor Author

pangolp commented Sep 20, 2024

I want a simple high performance proxy sample code and then some modifications on that. Don't do as js, js is prone to performance problems at high concurrency

Tell me how I can obtain this same thing, without this tool, and I will gladly close this pull request myself and agree with you.

@walkline
Copy link
Contributor

walkline commented Sep 20, 2024

You’re both right that there’s a lack of documentation on this part. However, if you’re familiar with proxying and networking, there aren’t many AC-specific details you need to know to implement this.

If you’re interested, here’s a high-level overview of how you can achieve the same:

  1. Install HAProxy on the servers where your players will connect.
  2. On those servers, configure HAProxy similar to the configuration provided in this PR: feat(Core/Network): Add Proxy Protocol v2 support. #18839 (see How to test section).
  3. Run both the auth and world servers with the EnableProxyProtocol enabled in their configurations.
  4. Set up your firewall to allow only the proxy servers to connect to the world server and auth server.

If you need more details, feel free to reach out to me on Discord.

@pangolp
Copy link
Contributor Author

pangolp commented Sep 21, 2024

You’re both right that there’s a lack of documentation on this part. However, if you’re familiar with proxying and networking, there aren’t many AC-specific details you need to know to implement this.

If you’re interested, here’s a high-level overview of how you can achieve the same:

  1. Install HAProxy on the servers where your players will connect.
  2. On those servers, configure HAProxy similar to the configuration provided in this PR: feat(Core/Network): Add Proxy Protocol v2 support. #18839 (see How to test section).
  3. Run both the auth and world servers with the EnableProxyProtocol enabled in their configurations.
  4. Set up your firewall to allow only the proxy servers to connect to the world server and auth server.

If you need more details, feel free to reach out to me on Discord.

Perfect, I'll get in touch with you. That part is clear to me.
What I don't know is whether we will get similar or better results than these.
Not about security, I understand.

@tarawow
Copy link

tarawow commented Sep 21, 2024

This system is not just a security possibility. Its efficiency is much higher, like the need to spend heavy costs for a powerful virtual server in a suitable location for players to play with low ping.
With this system, every person is able to prepare a virtual server in his own country and using js host from other locations at a low cost to provide a private server with low ping to the players, and the result is the expansion of the locations covered by a private server.
I tested it. In normal mode, the ping was 550 from USA to Iran, but with a js host and connection from relay, the ping changed to 82, and this is a great possibility, although it is suitable for my security.

@pangolp
Copy link
Contributor Author

pangolp commented Sep 21, 2024

This system is not just a security possibility. Its efficiency is much higher, like the need to spend heavy costs for a powerful virtual server in a suitable location for players to play with low ping. With this system, every person is able to prepare a virtual server in his own country and using js host from other locations at a low cost to provide a private server with low ping to the players, and the result is the expansion of the locations covered by a private server. I tested it. In normal mode, the ping was 550 from USA to Iran, but with a js host and connection from relay, the ping changed to 82, and this is a great possibility, although it is suitable for my security.

This testimony, I think, is really very good. As for security, I trust that the author will maintain and the community can help him in this regard, all the updates, respect for the tool developed in node. Also, it is something optional, nobody is forcing anyone to use it if they do not want to.

@tarawow
Copy link

tarawow commented Sep 21, 2024

Think that you are in Argentina and you have players from China, how can they communicate with the server with proper ping!?
There are many ways
1: Get a hardware server from Europe where players from China and Argentina can play with a medium or high ping.
2: Get a server from Argentina and don't worry about Chinese players
3: Use relay so that all players from any location can play together

This possibility is very useful. By providing several node js hosts with the right resources, you can attract players from anywhere for a server, isn't this a great feature??

@kissingers
Copy link
Contributor

Think that you are in Argentina and you have players from China, how can they communicate with the server with proper ping!? There are many ways 1: Get a hardware server from Europe where players from China and Argentina can play with a medium or high ping. 2: Get a server from Argentina and don't worry about Chinese players 3: Use relay so that all players from any location can play together

This possibility is very useful. By providing several node js hosts with the right resources, you can attract players from anywhere for a server, isn't this a great feature??

This is good, but I want to do more control of the client on the proxy server, so it is best that the proxy is not an off-the-shelf software, but a component that can be developed twice!

@pangolp
Copy link
Contributor Author

pangolp commented Sep 21, 2024

Think that you are in Argentina and you have players from China, how can they communicate with the server with proper ping!? There are many ways 1: Get a hardware server from Europe where players from China and Argentina can play with a medium or high ping. 2: Get a server from Argentina and don't worry about Chinese players 3: Use relay so that all players from any location can play together

This possibility is very useful. By providing several node js hosts with the right resources, you can attract players from anywhere for a server, isn't this a great feature??

I think so, that's why I created the pull request.

@pangolp
Copy link
Contributor Author

pangolp commented Sep 21, 2024

Think that you are in Argentina and you have players from China, how can they communicate with the server with proper ping!? There are many ways 1: Get a hardware server from Europe where players from China and Argentina can play with a medium or high ping. 2: Get a server from Argentina and don't worry about Chinese players 3: Use relay so that all players from any location can play together
This possibility is very useful. By providing several node js hosts with the right resources, you can attract players from anywhere for a server, isn't this a great feature??

This is good, but I want to do more control of the client on the proxy server, so it is best that the proxy is not an off-the-shelf software, but a component that can be developed twice!

That's something the owner of the code might be able to explain to you. It's beyond my knowledge.

@sudlud
Copy link
Member

sudlud commented Sep 21, 2024

In my opinion the already implemented proxy protocol v2 can already serve as a high performance proxy server as @walkline stated in a comment above.
It's seems to be pretty easy to set up and configure, enabling just requires enabling an option in worldserver / authserver config.

It is a standardized protocol which I would usually prefer before any custom implementation that tries to fulfill the exact same use case.

Probably I'm missing something here, but I don't feel like the AC core has any benefits of adding an additional (non-standardized) proxy protocol.

@kissingers
Copy link
Contributor

In my opinion the already implemented proxy protocol v2 can already serve as a high performance proxy server as @walkline stated in a comment above. It's seems to be pretty easy to set up and configure, enabling just requires enabling an option in worldserver / authserver config.

It is a standardized protocol which I would usually prefer before any custom implementation that tries to fulfill the exact same use case.

Probably I'm missing something here, but I don't feel like the AC core has any benefits of adding an additional (non-standardized) proxy protocol.

I think this is the right way to go, standardization is important, so while this PR is nice, it shouldn't be part of AZ.
But at the moment the standardization gives examples that can only be implemented with off-the-shelf agents via configuration files, is it possible to make a sample code in C++ or C# etc. that can be implemented by compilation? This will facilitate secondary development.

@pangolp
Copy link
Contributor Author

pangolp commented Sep 21, 2024

Can someone show me an example where the ping decreases and what are the values it gets? Because so far we have an example of a person who tested this code and managed to decrease going ping from 500 to 80. With the current protocol that we have and how can we do tests?

@walkline
Copy link
Contributor

Can someone show me an example where the ping decreases and what are the values it gets? Because so far we have an example of a person who tested this code and managed to decrease going ping from 500 to 80. With the current protocol that we have and how can we do tests?

Unless you host your server in Iran, you won’t see the same ping improvement. If you didn’t know, Iran is currently an authoritarian country, and its government sometimes makes poor decisions, such as providing drones and ballistic missiles to other countries that ultimately use them to bomb my city.

As a result, most countries have imposed sanctions on Iran, which, along with internal policies, have impacted the ping to services in Iran. This is why it's crucial for Iranian services to have alternative routing paths if they have clients in the western (not only) world.

I believe the country you're living in doesn't face the same issues, so you probably wouldn’t see such drastic ping improvements.

@Nyeriah
Copy link
Member

Nyeriah commented Sep 21, 2024

There already is an alternative so we should just stick to it. If guides are needed maybe we can work on that. Closing this now as I’m sorry but changing packet protocols is something we don’t need. Thanks for the PR but can’t be accepted. If you wish to use this alternative I suggest using a patch similar to TC users seeing the module author does offer that.

@Nyeriah Nyeriah closed this Sep 21, 2024
@pangolp
Copy link
Contributor Author

pangolp commented Sep 21, 2024

There already is an alternative so we should just stick to it. If guides are needed maybe we can work on that. Closing this now as I’m sorry but changing packet protocols is something we don’t need. Thanks for the PR but can’t be accepted. If you wish to use this alternative I suggest using a patch similar to TC users seeing the module author does offer that.

I think they make a mistake, but I have no arguments for defending the debate because it is not my project or idea either. I just adapted the code and made it compatible. The rest is borne by the author of the same. It may serve someone anyway even if it's closed.

The guide thing on the wiki, it wouldn't really be bad, because if I had to do something similar to this, I wouldn't know how to do it. In my opinion, all I think is that I would have waited a little longer and done tests, given that we have the result of this code and the complementary tool, but we don't have any evidence about the current existing code, which determines that it can replace that.
Thank you in any case to those who participated in this debate and gave their opinion to respect, I regret the result.

@pangolp pangolp deleted the RelayPacket branch September 21, 2024 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CORE Related to the core file-cpp Used to trigger the matrix build
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants