check_port: add provider failover and Globalping - #3245
Conversation
|
Tested it. TL;DR it reports all ports as open. Long explanation from Claude: Globalping's rawOutput uses Measured against the live API, sending exactly the request shape in this branch: Every outcome is "open". Because Globalping is the final fallback, this fires The discriminator is "Reply from" versus "No reply from": Worth a test over both rawOutput shapes. The parsing is pure, so it needs no Second: the shipped default and the code default disagree. conf.php is user-editable and survives upgrades, so an existing install takes Third: worst-case latency. With $checkPortTimeout = 15, a failing primary plus a failing secondary plus Smaller notes:
What is right, for the record: the refactor keeps the Origin header and the Not checked: IPv6 end to end, and the failover chain driven through action.php |
|
Fixed the Globalping verdict parsing and pushed the changes.
Also verified the corrected Globalping provider against known-open and filtered ports: 3/3 live checks passed. One potentially interesting avenue for the future: Globalping has probe "pingers" distributed around the world, so selecting an appropriate probe/location could potentially reduce the latency of port checks substantially compared with an arbitrary probe. |
aa80982 to
6866338
Compare
0a43624 to
efb74a4
Compare
The Globalping provider added in #3245 read an open port out of rawOutput. Before it was corrected, the rule matched the tcp_conn=N attempt counter anywhere in the output, and Globalping prints that counter on its "No reply" lines too, so every port came back open -- including ports that never answered at all. Because Globalping runs last in the failover chain, that verdict reached the user exactly when no other provider could answer. Nothing held the corrected rule in place: the verdict was inline in check_port_globalping(), next to the HTTP call, so no test could reach it without the network. Move it to check_port_parse_globalping() in parse.php, beside check_port_parse_yougetsignal(), and cover it with the two rawOutput shapes the API actually returns -- a reply on 8.8.8.8:53 and no reply on 8.8.8.8:81 -- plus a refusal, an empty body, and output in an unfamiliar shape. Silence stays "unknown" rather than "closed": a probe that heard nothing cannot tell a filtered port from a closed one. Also check the shipped configuration against the provider registry. action.php skips any provider that is unknown or that does not claim the address family being checked, so a name that does not line up costs no error -- the provider is simply never tried, and the chain is quietly shorter than the comment in conf.php reads. Each case was confirmed to fail with the check it guards removed.
Summary
Adds configurable provider failover to the
check_portplugin and addsGlobalping as a third port-check provider.
The primary provider remains unchanged by default:
Default fallbacks are:
Provider implementations are moved out of
action.phpinto separate filesand registered through a shared provider registry. The dispatcher is
provider-agnostic: providers return
0(unknown),1(closed), or2(open),and the configured chain continues until a definitive result is available.
Globalping is used as the final fallback when earlier providers fail or return
an inconclusive result.
Testing
Tested on a live ruTorrent/rTorrent installation.
php -l.