mirror of
https://github.com/twisterarmy/twister-analytics-crawler.git
synced 2025-01-30 08:24:15 +00:00
add full peer info
This commit is contained in:
parent
84ecbdf07a
commit
777016df66
33
model/ip.php
33
model/ip.php
@ -82,7 +82,18 @@ class ModelIp extends Model {
|
||||
}
|
||||
}
|
||||
|
||||
public function addOnline($ipId, $startingHeight, $timeConnection, $timeLastSend, $timeLastReceive) {
|
||||
public function addOnline($ipId,
|
||||
$startingHeight,
|
||||
$timeConnection,
|
||||
$timeLastSend,
|
||||
$timeLastReceive,
|
||||
$bytesSent,
|
||||
$bytesReceive,
|
||||
$banscore,
|
||||
$inbound,
|
||||
$version,
|
||||
$subVersion,
|
||||
$syncNode) {
|
||||
|
||||
try {
|
||||
|
||||
@ -91,10 +102,28 @@ class ModelIp extends Model {
|
||||
`timeConnection` = ?,
|
||||
`timeLastSend` = ?,
|
||||
`timeLastReceive` = ?,
|
||||
`bytesSent` = ?,
|
||||
`bytesReceive` = ?,
|
||||
`banscore` = ?,
|
||||
`inbound` = ?,
|
||||
`version` = ?,
|
||||
`subVersion` = ?,
|
||||
`syncNode` = ?,
|
||||
|
||||
`timeAdded` = UNIX_TIMESTAMP()');
|
||||
|
||||
$query->execute([$ipId, $startingHeight, $timeConnection, $timeLastSend, $timeLastReceive]);
|
||||
$query->execute([ $ipId,
|
||||
$startingHeight,
|
||||
$timeConnection,
|
||||
$timeLastSend,
|
||||
$timeLastReceive,
|
||||
$bytesSent,
|
||||
$bytesReceive,
|
||||
$banscore,
|
||||
$inbound,
|
||||
$version,
|
||||
$subVersion,
|
||||
$syncNode]);
|
||||
|
||||
return $this->db->lastInsertId();
|
||||
|
||||
|
15
peer.php
15
peer.php
@ -83,10 +83,17 @@ if ($peers = $curlPeer->getAll()) {
|
||||
|
||||
// Update online time
|
||||
$modelIp->addOnline($ipId,
|
||||
$peer['startingheight'],
|
||||
$peer['conntime'],
|
||||
$peer['lastsend'],
|
||||
$peer['lastrecv']);
|
||||
(int) $peer['startingheight'],
|
||||
(int) $peer['conntime'],
|
||||
(int) $peer['lastsend'],
|
||||
(int) $peer['lastrecv'],
|
||||
(int) $peer['bytessent'],
|
||||
(int) $peer['bytesrecv'],
|
||||
(int) $peer['banscore'],
|
||||
(int) $peer['inbound'],
|
||||
(int) $peer['version'],
|
||||
preg_replace('/[^\d]/', '', $peer['subver']),
|
||||
(isset($peer['syncnode']) ? (int) $peer['syncnode'] : 0));
|
||||
} else {
|
||||
$modelLog->add(_('Could not extract peer address or port'));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user