adds updates to peertracker as info fetching
This commit is contained in:
parent
33aaee6d4d
commit
aef17086c7
|
@ -97,7 +97,7 @@ peertracker::open();
|
|||
$_GET['info_hash'] = peertracker::$api->escape_sql($_GET['info_hash']);
|
||||
$_GET['peer_id'] = peertracker::$api->escape_sql($_GET['peer_id']);
|
||||
|
||||
$json = file_get_contents("http://localhost:4567/as_info/{$_GET['ip']}.json");
|
||||
$json = file_get_contents("http://peertracker-as.local/as_info/{$_GET['ip']}.json");
|
||||
$parsed_json = json_decode($json);
|
||||
$as_code = $parsed_json->{'country'};
|
||||
$country = $parsed_json->{'as_code'};
|
||||
|
|
|
@ -387,7 +387,7 @@ class peertracker
|
|||
}
|
||||
|
||||
// full peer update
|
||||
public static function update_peer()
|
||||
public static function update_peer($as_code, $country)
|
||||
{
|
||||
// update peer
|
||||
self::$api->query(
|
||||
|
@ -397,6 +397,7 @@ class peertracker
|
|||
"SET compact='" . self::$api->escape_sql(pack('Nn', ip2long($_GET['ip']), $_GET['port'])) .
|
||||
// dotted decimal string ip, integer port
|
||||
"', ip='{$_GET['ip']}', port={$_GET['port']}, " .
|
||||
"'as_code='{$as_code}', country={$country}, " .
|
||||
// integer state and unix timestamp updated
|
||||
"state={$_SERVER['tracker']['seeding']}, updated=" . time() .
|
||||
// that matches the given info_hash and peer_id
|
||||
|
|
Loading…
Reference in New Issue
Block a user