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

[Bug] Failed to connect to LAN Server if the dispatch server accessAddress is set to LAN Address #836

Closed
LaoSparrow opened this issue May 12, 2022 · 15 comments
Labels
bug Something isn't working

Comments

@LaoSparrow
Copy link

LaoSparrow commented May 12, 2022

Describe the bug
Failed to connect to LAN Server if the dispatch server accessAddress is set to LAN Address

Which branch did you use?
development branch v1.1.1 - commit 98066f5

Client version
OSRELWin2.6.0 (Global)

Env
mongodb-win32-x86_64-windows-5.0.8

Eclipse Adoptium
openjdk 17.0.2 2022-01-18
OpenJDK Runtime Environment Temurin-17.0.2+8 (build 17.0.2+8)
OpenJDK 64-Bit Server VM Temurin-17.0.2+8 (build 17.0.2+8, mixed mode, sharing)

Traffic Hijacker
GrassClipper-v0.9.8 - mitmproxy

Details
客户端在通过局域网连接时会报错代码4206,而在修改 config.json -> server -> dispatch -> accessAddress 为proxy.py内任意(不确定)一个域名后便可成功从局域网连接。
(同时把 config.json -> server -> game -> accessAddress 修改为局域网IP地址)

Client failed to connect to a local lan server and gives out error code 4206, but after changing "config.json -> server -> dispatch -> accessAddress" to any domain (not sure) in the domain list of "proxy.py". The client will then be able to connect to the server
(Also changed "config.json -> server -> game -> accessAddress" to my LAN address)

Screenshots
屏幕截图 2022-05-12 152237
屏幕截图 2022-05-12 151523
屏幕截图 2022-05-12 151611

@LaoSparrow LaoSparrow added the bug Something isn't working label May 12, 2022
@LaoSparrow
Copy link
Author

Server Log:

[15:19:30] [INFO] Welcome to Grasscutter
[15:19:30] [INFO] To proper exit this console, use [Ctrl + C] and enter N not Y.
[15:19:30] [INFO]
[15:19:30] [INFO] Initializing...
[15:19:30] [WARN] mitmdump not found, server only mode.
[15:19:30] [INFO] Starting MongoDB daemon...
[15:19:30] [INFO] Starting server...
15:19:31 INFO:Grasscutter 正在启动 Grasscutter...
15:19:31 INFO:ResourceLoader Loaded 47 FetterCharacterCardDatas.
15:19:31 INFO:ResourceLoader Loaded 300 AvatarTalentDatas.
15:19:31 INFO:ResourceLoader Loaded 400 AvatarSkillDatas.
15:19:31 INFO:ResourceLoader Loaded 4088 FetterDatas.
15:19:31 INFO:ResourceLoader Loaded 73 AvatarSkillDepotDatas.
15:19:31 INFO:ResourceLoader Loaded 167 MonsterDescribeDatas.
15:19:32 INFO:ResourceLoader Loaded 657 RewardPreviewDatas.
15:19:32 INFO:ResourceLoader Loaded 39 TowerFloorDatas.
15:19:32 INFO:ResourceLoader Loaded 2 TowerScheduleDatas.
15:19:32 INFO:ResourceLoader Loaded 1 AvatarCostumeDatas.
15:19:32 INFO:ResourceLoader Loaded 699 DungeonDatas.
15:19:32 INFO:ResourceLoader Loaded 10 AvatarFetterLevelDatas.
15:19:32 INFO:ResourceLoader Loaded 24 DailyDungeonDatas.
15:19:32 INFO:ResourceLoader Loaded 3032 NpcDatas.
15:19:32 INFO:ResourceLoader Loaded 66 ReliquaryMainPropDatas.
15:19:32 INFO:ResourceLoader Loaded 200 MonsterCurveDatas.
15:19:32 INFO:ResourceLoader Loaded 717 SceneDatas.
15:19:32 INFO:ResourceLoader Loaded 90 AvatarLevelDatas.
15:19:32 INFO:ResourceLoader Loaded 4065 RewardDatas.
15:19:32 INFO:ResourceLoader Loaded 6889 ItemDatas.
15:19:32 INFO:ResourceLoader Loaded 336 AvatarPromoteDatas.
15:19:32 INFO:ResourceLoader Loaded 335 ReliquaryAffixDatas.
15:19:32 INFO:ResourceLoader Loaded 90 WeaponLevelDatas.
15:19:32 INFO:ResourceLoader Loaded 1195 ShopGoodsDatas.
15:19:32 INFO:ResourceLoader Loaded 297 CombineDatas.
15:19:32 INFO:ResourceLoader Loaded 117 TowerLevelDatas.
15:19:32 INFO:ResourceLoader Loaded 939 WeaponPromoteDatas.
15:19:32 INFO:ResourceLoader Loaded 9 AvatarFlycloakDatas.
15:19:32 INFO:ResourceLoader Loaded 6626 GadgetDatas.
15:19:32 INFO:ResourceLoader Loaded 100 AvatarCurveDatas.
15:19:32 INFO:ResourceLoader Loaded 42 ReliquarySetDatas.
15:19:32 INFO:ResourceLoader Loaded 100 WeaponCurveDatas.
15:19:32 INFO:ResourceLoader Loaded 744 EquipAffixDatas.
15:19:32 INFO:ResourceLoader Loaded 8 WorldLevelDatas.
15:19:32 INFO:ResourceLoader Loaded 60 PlayerLevelDatas.
15:19:32 INFO:ResourceLoader Loaded 101 ReliquaryLevelDatas.
15:19:32 INFO:ResourceLoader Loaded 2420 ProudSkillDatas.
15:19:32 INFO:ResourceLoader Loaded 568 MonsterDatas.
15:19:32 INFO:ResourceLoader Loaded 78 AvatarDatas.
15:19:32 INFO:SLF4JLogger Cluster created with settings {hosts=[localhost:27017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms'}
15:19:33 INFO:SLF4JLogger Opened connection [connectionId{localValue:1, serverValue:2}] to localhost:27017
15:19:33 INFO:SLF4JLogger Opened connection [connectionId{localValue:2, serverValue:1}] to localhost:27017
15:19:33 INFO:SLF4JLogger Monitor thread successfully connected to server with description ServerDescription{address=localhost:27017, type=STANDALONE, state=CONNECTED, ok=true, minWireVersion=0, maxWireVersion=13, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=17430200}
15:19:33 INFO:SLF4JLogger Opened connection [connectionId{localValue:3, serverValue:3}] to localhost:27017
15:19:33 INFO:GameServerPacketHandler Registered 120 PacketHandlers
15:19:33 INFO:GachaManager Banners successfully loaded.
15:19:33 INFO:ShopManager Shop data successfully loaded.
15:19:33 INFO:ShopManager ShopChest data successfully loaded.
15:19:33 INFO:ShopManager ShopChestBatchUse data successfully loaded.
15:19:33 INFO:StdSchedulerFactory Using default implementation for ThreadExecutor
15:19:33 INFO:SimpleThreadPool Job execution threads will use class loader of thread: main
15:19:33 INFO:SchedulerSignalerImpl Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl
15:19:33 INFO:QuartzScheduler Quartz Scheduler v.2.3.2 created.
15:19:33 INFO:RAMJobStore RAMJobStore initialized.
15:19:33 INFO:QuartzScheduler Scheduler meta-data: Quartz Scheduler (v2.3.2) 'DefaultQuartzScheduler' with instanceId 'NON_CLUSTERED'
Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
NOT STARTED.
Currently in standby mode.
Number of jobs executed: 0
Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads.
Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered.

15:19:33 INFO:StdSchedulerFactory Quartz scheduler 'DefaultQuartzScheduler' initialized from default resource file in Quartz package: 'quartz.properties'
15:19:33 INFO:StdSchedulerFactory Quartz scheduler version: 2.3.2
15:19:33 INFO:QuartzScheduler Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started.
15:19:33 INFO:DropManager Drop data successfully loaded.
15:19:33 INFO:ExpeditionManager Expedition reward successfully loaded.
15:19:33 INFO:Log Logging initialized @2641ms to org.eclipse.jetty.util.log.Slf4jLog
15:19:33 INFO:Server jetty-9.4.35.v20201120; built: 2020-11-20T21:17:03.964Z; git: bdc54f03a5e0a7e280fab27f55c3c75ee8da89fb; jvm 17.0.2+8
15:19:33 INFO:SslContextFactory x509=X509@608b35fa(keystore_entry,h=[mydomain.com, localhost],w=[]) for Server@13a268cd[provider=null,keyStore=file:///C:/Apps/GenshinGrassCutter/keystore.p12,trustStore=null]
15:19:33 INFO:AbstractConnector Started ServerConnector@5ed25612{SSL, (ssl, http/1.1)}{0.0.0.0:443}
15:19:33 INFO:Server Started @2929ms
15:19:33 INFO:Express Server listening on http://localhost:443
15:19:33 INFO:DispatchServer [Dispatch] 服务器已在端口 443 上启动
15:19:33 INFO:Grasscutter 加载完成!输入 "help" 查看命令列表
15:19:33 INFO:GameServer Grasscutter 是免费开源软件,遵循 AGPL-3.0 license。如果你是付费购买的,那你已经被骗了。项目地址:https://github.com/Grasscutters/Grasscutter
15:19:33 INFO:GameServer 游戏服务器已在端口 443 上启动
15:19:58 INFO:DispatchServer [Dispatch] Client 192.168.0.102 request: query_region_list
15:19:59 INFO:DispatchServer [Dispatch] 客户端 192.168.0.102 正在尝试使用 token 登录
15:19:59 INFO:DispatchServer [Dispatch] 客户端 192.168.0.102 已通过 token 登录,UID 为 10001
15:19:59 INFO:DispatchServer [Dispatch] 客户端 192.168.0.102 交换 token 成功

@LaoSparrow
Copy link
Author

Mitmproxy Log:
Loading script C:\Apps\GenshinGrassClipper\proxy\proxy.py
Proxy server listening at http://*:8080
127.0.0.1:54477: client connect
127.0.0.1:54477: server connect privacy.xboxlive.com:443 (13.67.168.246:443)
127.0.0.1:54480: client connect
127.0.0.1:54480: server connect privacy.xboxlive.com:443 (13.67.168.246:443)
127.0.0.1:54491: client connect
127.0.0.1:54491: server connect dispatchosglobal.yuanshen.com:443 (172.65.240.113:443)
127.0.0.1:54491: server connect 192.168.0.102:443
127.0.0.1:54491: GET https://192.168.0.102/query_region_list?version=OSRELWin2.6.0&lang=3&platform=3&binary=1&time=2…
<< 200 OK 3.02k
127.0.0.1:54491: client disconnect
127.0.0.1:54491: server disconnect dispatchosglobal.yuanshen.com:443 (172.65.240.113:443)
127.0.0.1:54491: server disconnect 192.168.0.102:443
127.0.0.1:54494: client connect
127.0.0.1:54495: client connect
127.0.0.1:54496: client connect
127.0.0.1:54497: client connect
127.0.0.1:54498: client connect
127.0.0.1:54499: client connect
127.0.0.1:54500: client connect
127.0.0.1:54494: server connect webstatic-sea.hoyoverse.com:443 (163.181.77.228:443)
127.0.0.1:54495: server connect webstatic-sea.hoyoverse.com:443 (163.181.77.228:443)
127.0.0.1:54496: server connect log-upload-os.mihoyo.com:443 (13.225.94.64:443)
127.0.0.1:54497: server connect hk4e-sdk-os-static.hoyoverse.com:443 (163.181.77.211:443)
127.0.0.1:54498: server connect sdk-os-static.hoyoverse.com:443 (163.181.77.229:443)
127.0.0.1:54494: server connect 192.168.0.102:443
127.0.0.1:54499: server connect hk4e-sdk-os-static.hoyoverse.com:443 (163.181.77.211:443)
127.0.0.1:54495: server connect 192.168.0.102:443
127.0.0.1:54500: server connect hk4e-sdk-os.hoyoverse.com:443 (13.224.160.87:443)
127.0.0.1:54496: server connect 192.168.0.102:443
127.0.0.1:54495: GET https://192.168.0.102/admin/mi18n/plat_oversea/m2020030410/m2020030410-version.json
<< 404 Not Found 109b
127.0.0.1:54494: GET https://192.168.0.102/admin/mi18n/plat_oversea/m2020030410/m2020030410-version.json
<< 404 Not Found 109b
127.0.0.1:54497: server connect 192.168.0.102:443
127.0.0.1:54496: POST https://192.168.0.102/sdk/dataUpload
<< 200 OK 10b
127.0.0.1:54497: GET https://192.168.0.102/hk4e_global/mdk/shield/api/loadConfig?client=3&game_key=hk4e_global
<< 200 OK 533b
127.0.0.1:54499: server connect 192.168.0.102:443
127.0.0.1:54498: server connect 192.168.0.102:443
127.0.0.1:54495: GET https://192.168.0.102/admin/mi18n/plat_oversea/m2020030410/m2020030410-version.json
<< 404 Not Found 109b
127.0.0.1:54494: GET https://192.168.0.102/admin/mi18n/plat_oversea/m2020030410/m2020030410-version.json
<< 404 Not Found 109b
127.0.0.1:54500: server connect 192.168.0.102:443
127.0.0.1:54515: client connect
127.0.0.1:54496: POST https://192.168.0.102/sdk/dataUpload
<< 200 OK 10b
127.0.0.1:54499: GET https://192.168.0.102/hk4e_global/combo/granter/api/getConfig?app_id=4&channel_id=1&client_type…
<< 200 OK 392b
127.0.0.1:54498: GET https://192.168.0.102/combo/box/api/config/sdk/combo?biz_key=hk4e_global&client_type=3
<< 200 OK 140b
127.0.0.1:54500: POST https://192.168.0.102/hk4e_global/combo/granter/api/compareProtocolVersion?
<< 200 OK 209b
127.0.0.1:54494: GET https://192.168.0.102/admin/mi18n/plat_oversea/m2020030410/m2020030410-version.json
<< 404 Not Found 109b
127.0.0.1:54495: GET https://192.168.0.102/admin/mi18n/plat_oversea/m2020030410/m2020030410-version.json
<< 404 Not Found 109b
127.0.0.1:54515: server connect hk4e-sdk-os.hoyoverse.com:443 (13.224.160.87:443)
127.0.0.1:54496: POST https://192.168.0.102/sdk/dataUpload
<< 200 OK 10b
127.0.0.1:54515: server connect 192.168.0.102:443
127.0.0.1:54515: POST https://192.168.0.102/hk4e_global/mdk/shield/api/verify?
<< 200 OK 559b
127.0.0.1:54497: client disconnect
127.0.0.1:54494: client disconnect
127.0.0.1:54495: client disconnect
127.0.0.1:54498: client disconnect
127.0.0.1:54499: client disconnect
127.0.0.1:54515: client disconnect
127.0.0.1:54500: client disconnect
127.0.0.1:54496: client disconnect
127.0.0.1:54497: server disconnect hk4e-sdk-os-static.hoyoverse.com:443 (163.181.77.211:443)
127.0.0.1:54497: server disconnect 192.168.0.102:443
127.0.0.1:54494: server disconnect webstatic-sea.hoyoverse.com:443 (163.181.77.228:443)
127.0.0.1:54494: server disconnect 192.168.0.102:443
127.0.0.1:54495: server disconnect webstatic-sea.hoyoverse.com:443 (163.181.77.228:443)
127.0.0.1:54495: server disconnect 192.168.0.102:443
127.0.0.1:54498: server disconnect sdk-os-static.hoyoverse.com:443 (163.181.77.229:443)
127.0.0.1:54498: server disconnect 192.168.0.102:443
127.0.0.1:54499: server disconnect hk4e-sdk-os-static.hoyoverse.com:443 (163.181.77.211:443)
127.0.0.1:54499: server disconnect 192.168.0.102:443
127.0.0.1:54515: server disconnect hk4e-sdk-os.hoyoverse.com:443 (13.224.160.87:443)
127.0.0.1:54515: server disconnect 192.168.0.102:443
127.0.0.1:54500: server disconnect hk4e-sdk-os.hoyoverse.com:443 (13.224.160.87:443)
127.0.0.1:54500: server disconnect 192.168.0.102:443
127.0.0.1:54496: server disconnect log-upload-os.mihoyo.com:443 (13.225.94.64:443)
127.0.0.1:54496: server disconnect 192.168.0.102:443
127.0.0.1:54518: client connect
127.0.0.1:54520: client connect
127.0.0.1:54521: client connect
127.0.0.1:54518: server connect log-upload-os.mihoyo.com:443 (13.225.94.64:443)
127.0.0.1:54520: server connect abtest-api-data-sg.hoyoverse.com:443 (13.225.94.107:443)
127.0.0.1:54521: server connect hk4e-sdk-os.hoyoverse.com:443 (13.224.160.87:443)
127.0.0.1:54518: server connect 192.168.0.102:443
127.0.0.1:54518: POST https://192.168.0.102/sdk/dataUpload
<< 200 OK 10b
127.0.0.1:54520: server connect 192.168.0.102:443
127.0.0.1:54521: server connect 192.168.0.102:443
127.0.0.1:54520: POST https://192.168.0.102/data_abtest_api/config/experiment/list
<< 200 OK 155b
127.0.0.1:54518: POST https://192.168.0.102/sdk/dataUpload
<< 200 OK 10b
127.0.0.1:54521: POST https://192.168.0.102/hk4e_global/combo/granter/login/v2/login?
<< 200 OK 243b
127.0.0.1:54518: client disconnect
127.0.0.1:54520: client disconnect
127.0.0.1:54521: client disconnect
127.0.0.1:54518: server disconnect log-upload-os.mihoyo.com:443 (13.225.94.64:443)
127.0.0.1:54518: server disconnect 192.168.0.102:443
127.0.0.1:54520: server disconnect abtest-api-data-sg.hoyoverse.com:443 (13.225.94.107:443)
127.0.0.1:54520: server disconnect 192.168.0.102:443
127.0.0.1:54521: server disconnect hk4e-sdk-os.hoyoverse.com:443 (13.224.160.87:443)
127.0.0.1:54521: server disconnect 192.168.0.102:443
127.0.0.1:54527: client connect
127.0.0.1:54529: client connect
127.0.0.1:54527: server connect log-upload-os.mihoyo.com:443 (13.225.94.64:443)
127.0.0.1:54529: server connect hk4e-sdk-os.hoyoverse.com:443 (13.224.160.87:443)
127.0.0.1:54527: server connect 192.168.0.102:443
127.0.0.1:54527: POST https://192.168.0.102/sdk/dataUpload
<< 200 OK 10b
127.0.0.1:54529: server connect 192.168.0.102:443
127.0.0.1:54529: GET https://192.168.0.102/hk4e_global/mdk/agreement/api/getAgreementInfos?biz_key=hk4e_global&count…
<< 200 OK 63b
127.0.0.1:54527: client disconnect
127.0.0.1:54529: client disconnect
127.0.0.1:54527: server disconnect log-upload-os.mihoyo.com:443 (13.225.94.64:443)
127.0.0.1:54527: server disconnect 192.168.0.102:443
127.0.0.1:54529: server disconnect hk4e-sdk-os.hoyoverse.com:443 (13.224.160.87:443)
127.0.0.1:54529: server disconnect 192.168.0.102:443
127.0.0.1:54533: client connect
127.0.0.1:54533: server connect log-upload-os.mihoyo.com:443 (13.225.94.64:443)
127.0.0.1:54535: client connect
127.0.0.1:54535: server connect 192.168.0.102:443
127.0.0.1:54533: server connect 192.168.0.102:443
127.0.0.1:54533: POST https://192.168.0.102/sdk/dataUpload
<< 200 OK 10b
127.0.0.1:54535: server disconnect 192.168.0.102:443
127.0.0.1:54535: client disconnect
127.0.0.1:54533: client disconnect
127.0.0.1:54538: client connect
127.0.0.1:54533: server disconnect log-upload-os.mihoyo.com:443 (13.225.94.64:443)
127.0.0.1:54533: server disconnect 192.168.0.102:443
127.0.0.1:54538: server connect log-upload-os.mihoyo.com:443 (13.225.94.64:443)
127.0.0.1:54538: server connect 192.168.0.102:443
127.0.0.1:54538: POST https://192.168.0.102/sdk/dataUpload
<< 200 OK 10b
127.0.0.1:54538: client disconnect
127.0.0.1:54538: server disconnect log-upload-os.mihoyo.com:443 (13.225.94.64:443)
127.0.0.1:54538: server disconnect 192.168.0.102:443
127.0.0.1:54541: client connect
127.0.0.1:54541: server connect 192.168.0.102:443
127.0.0.1:54541: server disconnect 192.168.0.102:443
127.0.0.1:54541: client disconnect
127.0.0.1:54543: client connect
127.0.0.1:54543: server connect 192.168.0.102:443
127.0.0.1:54543: server disconnect 192.168.0.102:443
127.0.0.1:54543: client disconnect
127.0.0.1:54548: client connect
127.0.0.1:54548: server connect 192.168.0.102:443
127.0.0.1:54548: POST https://192.168.0.102/log
<< 200 OK 10b
127.0.0.1:54548: client disconnect
127.0.0.1:54548: server disconnect 192.168.0.102:443
127.0.0.1:54550: client connect
127.0.0.1:54550: server connect 192.168.0.102:443
127.0.0.1:54550: POST https://192.168.0.102/crash/dataUpload
<< 200 OK 10b
127.0.0.1:54550: client disconnect
127.0.0.1:54550: server disconnect 192.168.0.102:443
127.0.0.1:54556: client connect
127.0.0.1:54556: server connect 192.168.0.102:443
127.0.0.1:54556: POST https://192.168.0.102/log
<< 200 OK 10b
127.0.0.1:54556: client disconnect
127.0.0.1:54556: server disconnect 192.168.0.102:443
127.0.0.1:54558: client connect
127.0.0.1:54558: server connect 192.168.0.102:443
127.0.0.1:54558: POST https://192.168.0.102/crash/dataUpload
<< 200 OK 10b
127.0.0.1:54558: client disconnect
127.0.0.1:54558: server disconnect 192.168.0.102:443
127.0.0.1:54560: client connect
127.0.0.1:54560: server connect log-upload-os.mihoyo.com:443 (13.225.94.64:443)
127.0.0.1:54560: server connect 192.168.0.102:443
127.0.0.1:54560: POST https://192.168.0.102/sdk/dataUpload
<< 200 OK 10b
127.0.0.1:54560: client disconnect
127.0.0.1:54560: server disconnect log-upload-os.mihoyo.com:443 (13.225.94.64:443)
127.0.0.1:54560: server disconnect 192.168.0.102:443
127.0.0.1:54563: client connect
127.0.0.1:54563: server connect 192.168.0.102:443
127.0.0.1:54563: POST https://192.168.0.102/log
<< 200 OK 10b
127.0.0.1:54563: client disconnect
127.0.0.1:54563: server disconnect 192.168.0.102:443
127.0.0.1:54565: client connect
127.0.0.1:54565: server connect 192.168.0.102:443
127.0.0.1:54565: POST https://192.168.0.102/crash/dataUpload
<< 200 OK 10b
127.0.0.1:54565: client disconnect
127.0.0.1:54565: server disconnect 192.168.0.102:443
127.0.0.1:54567: client connect
127.0.0.1:54567: server connect self.events.data.microsoft.com:443 (52.182.143.208:443)
127.0.0.1:63110: client connect
127.0.0.1:63110: error establishing server connection: [Errno 11001] getaddrinfo failed
127.0.0.1:63110: GET http://ipv6.msftconnecttest.com/connecttest.txt
<< [Errno 11001] getaddrinfo failed
127.0.0.1:63110: client disconnect
127.0.0.1:54480: server disconnect privacy.xboxlive.com:443 (13.67.168.246:443)
127.0.0.1:54480: client disconnect
127.0.0.1:54477: server disconnect privacy.xboxlive.com:443 (13.67.168.246:443)
127.0.0.1:54477: client disconnect
127.0.0.1:54567: server disconnect self.events.data.microsoft.com:443 (52.182.143.208:443)
127.0.0.1:54567: client disconnect

@LaoSparrow
Copy link
Author

My current config.json:
{
"folderStructure": {
"resources": "./resources/",
"data": "./data/",
"packets": "./packets/",
"keys": "./keys/",
"scripts": "./resources/scripts/",
"plugins": "./plugins/"
},
"databaseInfo": {
"connectionUri": "mongodb://localhost:27017",
"collection": "grasscutter"
},
"language": {
"language": "zh_CN",
"fallback": "en_US"
},
"account": {
"autoCreate": false,
"defaultPermissions": []
},
"server": {
"debugLevel": "NONE",
"runMode": "HYBRID",
"dispatch": {
"bindAddress": "0.0.0.0",
"accessAddress": "hk4e-sdk-os.mihoyo.com",
"bindPort": 443,
"accessPort": 443,
"encryption": {
"useEncryption": true,
"useInRouting": true,
"keystore": "./keystore.p12",
"keystorePassword": "123456"
},
"policies": {
"cors": {
"enabled": false,
"allowedOrigins": [
"*"
]
}
},
"regions": [],
"defaultName": "Grasscutter"
},
"game": {
"bindAddress": "0.0.0.0",
"accessAddress": "192.168.0.102",
"bindPort": 443,
"accessPort": 443,
"gameOptions": {
"inventoryLimits": {
"weapons": 2000,
"relics": 2000,
"materials": 2000,
"furniture": 2000,
"all": 30000
},
"avatarLimits": {
"singlePlayerTeam": 4,
"multiplayerTeam": 4
},
"worldEntityLimit": 1000,
"watchGachaConfig": false,
"enableShopItems": true,
"staminaUsage": true,
"rates": {
"adventureExp": 1.0,
"mora": 1.0,
"leyLines": 1.0
},
"databaseInfo": {
"connectionUri": "mongodb://localhost:27017",
"collection": "grasscutter"
}
},
"joinOptions": {
"welcomeEmotes": [
2007,
1002,
4010
],
"welcomeMessage": "Welcome to a Grasscutter server.",
"welcomeMail": {
"title": "Welcome to Grasscutter!",
"content": "Hi there!\r\nFirst of all, welcome to Grasscutter. If you have any issues, please let us know so that Lawnmower can help you! \r\n\r\nCheck out our:\r\n\u003ctype\u003d"browser" text\u003d"Discord" href\u003d"https://discord.gg/T5vZU6UyeG\"/\u003e\n",
"sender": "Lawnmower",
"items": [
{
"itemId": 13509,
"itemCount": 1,
"itemLevel": 1
},
{
"itemId": 201,
"itemCount": 99999,
"itemLevel": 1
}
]
}
},
"serverAccount": {
"avatarId": 10000007,
"nameCardId": 210001,
"adventureRank": 1,
"worldLevel": 0,
"nickName": "Server",
"signature": "Welcome to Grasscutter!"
}
}
},
"version": 1
}

@LaoSparrow
Copy link
Author

Not sure is this related to #51 or #833 or not

@LaoSparrow LaoSparrow changed the title [Bug] Failed to connect to LAN Server if it is started with default config [Bug] Failed to connect to LAN Server if the dispatch server accessAddress is set to LAN Address May 12, 2022
@BedamatiMohanty
Copy link

Use chocolatey and see the version of the tools you are using. your build file needs to point to correct ip else it will fail. see failover mech error in any IT book or computer book.

@LaoSparrow
Copy link
Author

我意识到我说的不是很清楚,现在给几张图来表达我的意思
I realised that I did not tell the situation clearly. I may give out some diagrams to express my idea.

客户端在这种情况下能成功登录但是进不去服务器
Client can login but failed to enter server in this situation
Diagram1

但是当修改accessAddress为米哈游任意一个域名后,又非常奇妙的能成功进入到服务器里
But when you changed the "accessAddress" to any domain of mihoyo(hoyoverse), the client will be able to enter the server magically
Diagram2

@diona-katzlein
Copy link

that same with me, Server Online, user can request login.
Grasscutter Logs:
11:40:24 INFO:DispatchServer [Dispatch] Client 127.0.0.1 is trying to log in
11:40:24 INFO:DefaultAuthenticationHandler [Dispatch] Client 127.0.0.1 logged in as 10002
11:40:24 INFO:DispatchServer [Dispatch] Client 127.0.0.1 succeed to exchange combo token

but still got error 4206

@BedamatiMohanty
Copy link

https://www.inverse.com/gaming/genshin-impact-servers-down-error-code-4206-status

refer to this if you are using gaming as a app else use nosql and add norton+ another antivirus in your webbrowser. Else you need to have hoxhunt installed as an additional tool. This error comes if there is an external attempt for malware ex: trojan.

@BedamatiMohanty
Copy link

https://www.inverse.com/gaming/genshin-impact-servers-down-error-code-4206-status

refer to this if you are using gaming as a app else use nosql and add norton+ another antivirus in your webbrowser. Else you need to have hoxhunt installed as an additional tool. This error comes if there is an external attempt for malware ex: trojan.

*Also dont try to login to another system unless you are authorized. Please note it could result in plagirsm and legal issues. So try to deploy only in your local systems.

@mingjun97
Copy link
Contributor

Here is my guess: If you use LAN IP address. The mitmproxy may not perform Man-in-the-Middle(MitM) decipher and then cipher your request(this will tamper the SSL certifacte actually). Which essentially means that in this case, the certificat passed to your Mobile device is the keystore.p12 which comes with grasscutter instead of the one from mitmproxy. If you config your accessAddress to the domain name that appeared in the mitmproxy list, mitmproxy will handle it. I think this make sence in your scenario.

Poential solution for you:

  1. Trust keystore.p12 in your mobile devices. (Not sure this gonna to work, but this solution is targetting the root cause of your problem)
  2. Maybe add 192.168.* in your mitmproxy config. (Again, not sure if this gonna to work).
  3. Just leave it as it, i.e. use domain name for accessAddress.

一点猜测: 如果你使用内网IP,mitmproxy在这种情况下可能不会去接管这个请求。结果就是你的请求返回的结果,是使用了grasscutter附带SSL证书,而非之前信任过的mitm证书。如果你把accessAddress设置成米哈游的域名,mitm就能够接管这个请求而后替换证书了。

可能的解决方案:

  1. 在你的移动设备上信任grasscutter的keystore.12(我不确定这个能不能实现)
  2. 尝试让mitmproxy能够接管192.168.*的请求。
  3. 就这样吧,反正你现在能用。

@mingjun97
Copy link
Contributor

For moderator: I don't think this is a bug. It might be a misconfiguration for proxy server.

@wayoungofustc
Copy link

For moderator: I don't think this is a bug. It might be a misconfiguration for proxy server.

There are so many users using mitmproxy as proxyServer from readme.md.
It is not so nice blame users not knowing what mitmproxy will do and how to deal with the troubles.

@mingjun97
Copy link
Contributor

For moderator: I don't think this is a bug. It might be a misconfiguration for proxy server.

There are so many users using mitmproxy as proxyServer from readme.md. It is not so nice blame users not knowing what mitmproxy will do and how to deal with the troubles.

I was not trying to blame the users. Myself also on the mitmproxy. I don't get the point for you to blame me. I did explain the reason for his error and provide solutions. The message for moderator is just try to remove the bug tag or inform this issue should be fine to close, I do think this will save the moderator's time.

@LaoSparrow
Copy link
Author

LaoSparrow commented May 16, 2022

For moderator: I don't think this is a bug. It might be a misconfiguration for proxy server.

找到解决方法了,好像确实是因为mitm配置的问题。在向proxy.py添加以下代码后,就能成功在accessAddress被设置为局域网IP的情况下连接了
Finally I found a solution and it seems that it does due to a misconfiguration for mitm. After adding the following scripts to proxy.py, the client can now enter the server successfully in case the accessAddress is set to LAN address.

    def http_connect(self, flow: http.HTTPFlow) -> None:
        REMOTE_HOST = ctx.options.ip
        REMOTE_PORT = ctx.options.port

        if flow.request.host == REMOTE_HOST:
            if ctx.options.use_https:
                flow.request.scheme = "https"
            else:
                flow.request.scheme = "http"
            flow.request.host = REMOTE_HOST
            flow.request.port = REMOTE_PORT

屏幕截图 2022-05-16 191908

(其实不是很懂mitmproxy,照着葫芦画瓢式地怼了上去,不知道哪里起效了)
(Actually I am not quite familiar with mitmproxy. I just copy and paste and modified some part of it, not knowing where is the actual functioning part)

Update:
好像上面的修改对结果没有影响,下面的才是真正原因
It seems that the above changes does not affect the result, the followings are the real causes

同时修改mitmproxy启动参数以去掉 --allow-hosts 过滤
Also modifying the start up args of mitmproxy to remove the --allow-hosts filter

屏幕截图 2022-05-16 191829

我对这种奇妙的现象一无所知,不过我觉得这个bug标签可以去掉了
I dont know why this weird thing happens, but I think the bug label can be removed

@LaoSparrow
Copy link
Author

I will post this issue to GrassClipper and close this issue at there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants