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

修复与 --proxyHost 冲突 #86

Merged
merged 1 commit into from
Sep 11, 2020
Merged

修复与 --proxyHost 冲突 #86

merged 1 commit into from
Sep 11, 2020

Conversation

yushijinhun
Copy link
Owner

问题概述

若在 MC 客户端使用 --proxyHost--proxyPort 参数指定 SOCKS 代理,则 authlib 访问环回地址时不会绕过代理,进而导致 authlib-injector 不可用。故障表现为,进服时报错 Failed to log in: The authentication servers are currently down for maintenance.,客户端日志报错 java.net.SocketException: Unexpected end of file from server

在原版 MC 中,--proxyHost--proxyPort--proxyUser--proxyPass 这几个参数用于设置访问 Mojang 验证服务所使用的代理,其仅在 authlib 中使用(具体来说,代理设置会被传入 YggdrasilAuthenticationService),不用于其他网络请求,亦不用于多人联机。由于这个代理设置是直接传入 URL.openConnection(Proxy) 方法的,因此不会绕行环回地址。

据目前所知,会设置这一参数的启动器仅有 HMCL。如果用户在 HMCL 中开启了 SOCKS 代理,那么 HMCL 就会向游戏添加 --proxyHost--proxyPort 参数。如果用户同时使用 authlib-injector,就会出现上述故障。

修复方案

如果启动参数包含 --proxyHost--proxyPort--proxyUser--proxyPass,则将其移除,并打印警告,告知用户 authlib-injector 不兼容 --proxyHost 等参数。

以下是我选择这一方案的原因:

由于 --proxyHost 等参数设置的代理仅供 authlib 使用,可以推测其在原版 MC 中的使用场景为:通过代理解决连接 Mojang 验证服务不稳定的问题。而在使用 authlib-injector 时,我们连接的是第三方验证服务,而不是 Mojang 验证服务,因此我们大概率不会有这个需求。

@xfl03 xfl03 merged commit 9a27867 into develop Sep 11, 2020
@yushijinhun yushijinhun deleted the fix-proxy branch September 11, 2020 14:56
@yushijinhun yushijinhun mentioned this pull request Sep 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants