direct-connect / go-dcpp

Hybrid Direct Connect hub written in Go.
BSD 3-Clause "New" or "Revised" License
35 stars 9 forks source link

Ping, nmdc: Error: connection closed: Âû çàáàíåíû íà ýòîì õàáå. #118

Open Kcchouette opened 4 years ago

Kcchouette commented 4 years ago
$ dcping ping "dchub://dc.krasmediafiles.ru:411" --encoding "CP1252"
2020/05/02 14:27:49 connection closed: Âû çàáàíåíû íà ýòîì õàáå.:

 [*] Íèê: _rangeban_
 [*] Äèàïàçîí IP: 163.0.0.0 - 163.255.255.255
 [*] Ïðè÷èíà: Ñïàì!
 [*] Âðåìÿ: Íàâñåãäà

{"name":"","addr":["dchub://dc.krasmediafiles.ru:411"],"soft":{"name":"Verlihub","vers":"1.1.0.3","ext":["NoHello","NoGetINFO","TLS","UserIP2","TTHSearch","ZPipe","HubINFO","BotList","MCTo","FailOver","HubTopic","OpPlus","NickRule","SearchRule","UserCommand"]},"users":0,"status":"error"}
Error: connection closed: Âû çàáàíåíû íà ýòîì õàáå.:

 [*] Íèê: _rangeban_
 [*] Äèàïàçîí IP: 163.0.0.0 - 163.255.255.255
 [*] Ïðè÷èíà: Ñïàì!
 [*] Âðåìÿ: Íàâñåãäà

dcping v0.26.0 It seems like a range ip that is banned, maybe can you deal with that?

RoLex commented 4 years ago

how can a pinger deal with bans? it is not possible. it is your job to speak with hub owner and ask to unban your ip range.

Kcchouette commented 4 years ago

@RoLex apart same question can be asked (how can I deal with hub owner if my ip range is ban?), here the goal is to avoid to have a python error and catch somewhat the ban option with custom dcping error code

RoLex commented 4 years ago

pinger is not aware of ban, there is also no special nmdc (atleast) protocol command that tells about ban and the reason. what pinger have done here is that it got suddenly disconnected (before receiving $hubinfo) from the hub and what it shows to you is the last message it received before disconnect. in nmdc it is possible to detect "bad password", "nick taken" or "redirected", but not "you are banned". the only solution here would be to pick known keywords from last message. that is exactly why dcping shows you this message, so your script can continue working with given text.

btw, there is no python present.

dennwc commented 3 years ago

I agree with @Kcchouette, even though there are no code indicating the ban, the pinger should properly deal with it and fake the "banned" error message.

We already have a few hub-specific workarounds like this in the code, adding one more special case is not a big deal. From what I can see, the last message contains _rangeban_, which can be used to easily detect it.

Re: python, there is no Python in the project, but I know Kcc uses dcping with a python wrapper by parsing the JSON from the pinger.