-
Notifications
You must be signed in to change notification settings - Fork 501
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
SteamUser LoginID customization #217
Conversation
```obfustucated_private_ip``` is being used by Steam to tell which connection is made from the same client / application. Using the same value for second logon will cause first session to disconnect with ```EResult.LogonSessionReplaced```. In some scenarios we may actually want to establish second independent connection to the same account. This is especially useful for sharing the account between SteamKit-based Bot and Steam Client at the same time. By default old logic is kept, I only made it possible to override it if ```LoginID``` is supplied in ```LogOnDetails```, shouldn't cause any problems or regressions. Thank you.
Current coverage is
|
Not sure I like the idea of manually setting this field... I would have thought of setting an At the very least, make |
Setting
|
My thinking with I'm hesitant to throw garbage at the CMs after we did it for so long with the Machine ID, and then that came back to bite us later. |
The usage of We can always come back to this later and think of better solution, e.g. randomizing private IPs as you suggested. For now I don't know how customizing that property would cause any possible side-effects. I wouldn't send you a pull request if I didn't carefully test that option before. Thing is that setting If I had any better solution to the problem I'm facing, I'd suggest that instead. For now I think this pull request is OK, and if we ever find any obstacle because of custom
|
We're not in a rush, lets write The Right Code™ that doesn't involve deprecating poorly designed fields in the future. |
Randomizing IP is not a solution, it'll actually cause even more problems than it solves. I'm not sure if you understand that. By accepting the way how it is done now, we're making it possible for programmer to set that property based on whatever algorithm he wishes, which includes a possibility for him to randomize a local IP and apply obfuscation mask. If we change it to get random IP address on each login (if let's say You're overcomplicating things and trying to invent idiot-proof solution rather than only implementing the way for own logic. I can't even imagine how complicated it would become if we stored list of unique randomly generated local IPs for each account, connected with what, steam user object? Programmer can make new one, how he'll be able to set old randomly generated IP to new object? How hard it would be for programmer to tell if that session should be unique or not? What if he wants to start one unique session and one non-unique? What if he wants to start 1 session that should share IP with steam client, 2 independent ones and 2 shared? This pull request is as bad, as Valve's logic for their network to base unique sessions on that obfuscated IP property. We can either accept it in current form, which is nice, short, easy to understand, and leaves programmer with full control how he wants to apply it to his project, or cause idiot-proof mess which would dramatically decrease code readibility, would be unreliable, and would require dozen of properties to be able to adapt the logic to many different situations. I do understand the importance of good code, I do understand that this pull request considers a hack, but based on my knowledge and my own projects I say, that this is the best way for now and we shouldn't try to implement something that will overcomplicate things only to take responsibility from programmer and try to do things for him. We don't know how he wants to use the property, hence we should make it available for him, and not consider that "we know better", because we don't. I'm not the only one that made LoginID customizable. Just my 5 cents, if you don't have any better idea and still don't agree with me, I think there's little to be done and we can close this pull request, because it's unlikely that I can convince you to my opinion. |
I'm not saying that we need to settle on a specific design immediately (such as randomizing the IP), just that there should be some discussion about the correct method. Frankly, I like the idea of being able to specify any sort of "login id", but I'm curious of the consequences of doing so since the field is aptly named |
That's why I did my own review of all possible drawbacks before suggesting the pull request. The original property is based on I did try various different combinations, including I don't want to fake IP address for many different reasons. The most important is that if in fact Valve uses that property for something more advanced, I don't know, SteamGuard stuff for example, I prefer to send CMs invalid IP that will be deemed invalid and won't be used at some point during executing request, rather than allowing the fake IP to pass all the checks and cause possibly wrong situations such as false alarm of being logged from unknown PC etc. Programmer can (and should) apply his own logic to that |
Why is it that you can assign an integer |
Of course I can, but I don't want to, for reasons I stated above. I could add another propety like |
Bump. |
/// Gets or sets the LoginID. This number is used for identifying logon session. Null value will cause this to be automatically generated. | ||
/// </summary> | ||
/// <value>The LoginID.</value> | ||
public uint? LoginID { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the XML documentation should be a little more clear about the purpose of the field. It should mention something about being related to multiple signon for a single account.
Additionally,
will cause this to be automatically generated
Isn't very clear. I think it should specify that it's generated based off the machine's primary bind address, otherwise consumers might believe that it's generated automatically in such a way that users shouldn't need to worry about unique values for this field.
Done, I think the documentation covers the purpose of the field precisely now. |
@@ -301,13 +313,19 @@ public void LogOn( LogOnDetails details ) | |||
|
|||
SteamID steamId = new SteamID( details.AccountID, details.AccountInstance, Client.ConnectedUniverse, EAccountType.Individual ); | |||
|
|||
uint localIp = NetHelpers.GetIPAddress( this.Client.LocalIP ); | |||
if ( details.LoginID == null ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Replace == null
with .HasValue
to be explicit about what is happening. (Roslyn does this when compiling anyway.)
LGTM, just pray that Valve don't start enforcing that the value is an IP Address. |
As requested, I also inversed order to be more readable (HasValue is better than !HasValue) |
Allow specifying "LoginID" at logon.
Thank you 👍 . If there is anything more that I can ask for, I'd be very grateful if new SK release is planned to come out soon, but that highly depends on your release schedule, so I can only kindly ask for it (always better to use official version rather than self-compiled fork or hack). Cheers! |
@Netshroud was preparing some things for a 1.7.0 release, I imagine we just need to merge a few pending PRs and we can release it. |
Great to hear it, thank you! 👍 |
There you go. 😄 |
Much appreciated 👍 |
obfustucated_private_ip
is being used by Steam to tell which connection is made from the same client / application. Using the same value for second logon will cause first session to disconnect withEResult.LogonSessionReplaced
. In some scenarios we may actually want to establish second independent connection to the same account. This is especially useful for sharing the account between SteamKit-based Bot and Steam Client at the same time.By default old logic is kept, I only made it possible to override it if
LoginID
is supplied inLogOnDetails
, shouldn't cause any problems or regressions.Thank you.