BytexDigital / BytexDigital.Steam

Wrapper library of SteamKit2 for simpler usage of specific APIs such as downloading apps and workshop content from Steam
Other
12 stars 3 forks source link

Question: Does it uses nearest Steam login server or a certain one? #12

Closed GoldJohnKing closed 2 years ago

GoldJohnKing commented 2 years ago

Hi, I'm a user in China Mainland and we all know there's difficulty for Chinese people connecting to oversea servers. The good news is, Steam has servers in China Mainland, so we still can connect to Steam without a VPN or so.

There's a project FASTER using your SteamCLI library. When I click "Download", it first needs to login to Steam, and it stucks here. However, with a VPN, it's able to login.

I can always login Steam via SteamCMD even without an VPN, so I wonder if your library uses a certain steam server to login? If so, could you please make it possible to use nearest Steam login server?

Thanks.

RyanTT commented 2 years ago

Hello,

I can't make any promises, but I'll look into whether the library can support this.

In theory, it should already use the closest/by Steam proposed Servers, but China most likely requires special handling.

RyanTT commented 2 years ago

I'm afraid without access to a chinese account myself, I find it hard to debug this issue.

I have an idea on how this could end up working, but I have no way of testing these changes myself.

RyanTT commented 2 years ago

My assumption is that the current implementation fetches an incorrect list of CM servers, hence the internal Steam client is unable to connect because of chinese firewall restrictions.

However, when I use a chinese cell_id and steamrealm=steamchina, like in the following examples, I assume I am getting the correct list of servers?

https://api.steampowered.com/ISteamDirectory/GetCMList/v0001/?cellid=148&format=vdf&launcher=7&steamrealm=steamchina

https://api.steampowered.com/IContentServerDirectoryService/GetServersForSteamPipe/v1/?cell_id=148&max_servers=20

RyanTT commented 2 years ago

I've hardcoded this test client with a (presumably) chinese cell_id and to use the chinese Steam servers. Could you check whether you are able to sign in with it? It will attempt to download CUP Weapons.

You can start it the following way from Powershell:

.\BytexDigital.Steam.TestClient.exe "USERNAME" "PASSWORD"

http://aki.cx/ce5ae0e1d1.zip

GoldJohnKing commented 2 years ago

Really sorry for replying soooo late, being really busy these months...

My assumption is that the current implementation fetches an incorrect list of CM servers, hence the internal Steam client is unable to connect because of chinese firewall restrictions.

However, when I use a chinese cell_id and steamrealm=steamchina, like in the following examples, I assume I am getting the correct list of servers?

https://api.steampowered.com/ISteamDirectory/GetCMList/v0001/?cellid=148&format=vdf&launcher=7&steamrealm=steamchina

https://api.steampowered.com/IContentServerDirectoryService/GetServersForSteamPipe/v1/?cell_id=148&max_servers=20

Yes, these seems the correct server list.

I've hardcoded this test client with a (presumably) chinese cell_id and to use the chinese Steam servers. Could you check whether you are able to sign in with it? It will attempt to download CUP Weapons.

You can start it the following way from Powershell:

.\BytexDigital.Steam.TestClient.exe "USERNAME" "PASSWORD"

http://aki.cx/ce5ae0e1d1.zip

However, I am unable to login with the exe above, it does not connect.

image

GoldJohnKing commented 2 years ago

I'm afraid without access to a chinese account myself, I find it hard to debug this issue.

I have an idea on how this could end up working, but I have no way of testing these changes myself.

I guess there's no difference between Chinese and Global account, the major difference should be where we login Steam.

RyanTT commented 2 years ago

I updated the test clients code in the development branch to connect to a specific chinese server that's apparently in Shanghai, but for me it just results in a disconnect loop too.

I believe, unfortunately, that the library I use cannot handle SteamChina yet (apart from specifying which Steam server to use, I don't see any way of switching into a "SteamChina" mode), or more likely, I just don't understand SteamChina enough 😅

GoldJohnKing commented 2 years ago

I updated the test clients code in the development branch to connect to a specific chinese server that's apparently in Shanghai, but for me it just results in a disconnect loop too.

I believe, unfortunately, that the library I use cannot handle SteamChina yet (apart from specifying which Steam server to use, I don't see any way of switching into a "SteamChina" mode), or more likely, I just don't understand SteamChina enough 😅

This link: https://api.steampowered.com/ISteamDirectory/GetCMList/v0001/?cellid=148&format=vdf&launcher=7&steamrealm=steamchina

When we use steamrealm=steamchina or we do not specify the parameter, the URL returns with no serverlist items, only serverlist_websockets. image

While we use steamrealm=steamglobal, then it returns with both serverlist and serverlist_websockets. image

I guess this might be the issue? Does the library you use handle only serverlist but not serverlist_websockets?

Another reason could be that Steam China is used only for our internal censored Steam platform, it can not be used to login global account, we should always force steamrealm=steamglobal.

RyanTT commented 2 years ago

The code in dev branch for the test client uses one specific server via the WebSocket protocol located in China, however a connection is not possible. The server list is correctly fetched and processed, but no connection to any of those servers in China is possible as far as I can tell

GoldJohnKing commented 2 years ago

The code in dev branch for the test client uses one specific server via the WebSocket protocol located in China, however a connection is not possible. The server list is correctly fetched and processed, but no connection to any of those servers in China is possible as far as I can tell

That's really, really strange... 😖

Then I guess I can only use a proxy for it... 😭 Thanks a lot for your efforts!