mirror of
https://github.com/lalanza808/monero.fail.git
synced 2025-08-21 02:58:06 -04:00
add caching, remove nodes (only show peers on map)
This commit is contained in:
parent
b7a2ae440d
commit
268912d0c1
3 changed files with 25 additions and 51 deletions
|
@ -1,10 +1,14 @@
|
|||
import sys
|
||||
import socket
|
||||
import pickle
|
||||
from os import path
|
||||
|
||||
from requests import get as r_get
|
||||
from levin.section import Section
|
||||
from levin.bucket import Bucket
|
||||
from levin.ctypes import *
|
||||
from levin.constants import LEVIN_SIGNATURE
|
||||
from requests import get as r_get
|
||||
|
||||
from xmrnodes import config
|
||||
|
||||
|
||||
|
@ -54,6 +58,18 @@ def is_onion(url: str):
|
|||
else:
|
||||
return False
|
||||
|
||||
# Use hacky filesystem cache since i dont feel like shipping redis
|
||||
def rw_cache(key_name, data=None):
|
||||
pickle_file = path.join(config.DATA_DIR, f'{key_name}.pkl')
|
||||
if data:
|
||||
with open(pickle_file, 'wb') as f:
|
||||
f.write(pickle.dumps(data))
|
||||
return data
|
||||
else:
|
||||
with open(pickle_file, 'rb') as f:
|
||||
pickled_data = pickle.load(f)
|
||||
return pickled_data
|
||||
|
||||
def retrieve_peers(host, port):
|
||||
try:
|
||||
print(f'[.] Connecting to {host}:{port}')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue