<?php
// Connectivity test — SSH echo to a partner host with round-trip latency.
// GET ?id=HOST2  (GET avoids the bodyless-POST issue on this nginx setup).
header('Content-Type: application/json');
header('Cache-Control: no-store, no-cache');
require_once dirname(__DIR__) . '/include/partnership.php';

$id = trim($_GET['id'] ?? '');
if (!preg_match('/^host\d+$/i', $id)) {
    echo json_encode(['ok' => false, 'error' => 'Invalid host id']);
    exit;
}

echo json_encode(vv_pt_ping($id));
