# Path: bts_tools/network_utils.py
# @copy_cached_value
# @cachetools.func.lfu_cache(8192)
# def get_geoip_info(ip_addr):
#     try:
#         cred = core.config.get('credentials', {})['geoip2']  # check that we have a geoip2 section in config.yaml
#         client = geoip2.webservice.Client(cred['user'], cred['password'])
#     except KeyError as e:
#         raise ValueError('No geoip2 user and password defined in config.yaml') from e
# 
# 
#     log.debug('getting geoip2 info for for {}'.format(ip_addr))
#     response = client.city(ip_addr)
# 
#     pt = {'country': response.country.name,
#           'country_iso': response.country.iso_code,
#           'lat': response.location.latitude,
#           'lon': response.location.longitude
#           }
# 
#     log.debug('  {} -- {} ({}, {})'.format(ip_addr, pt['country'], pt['lat'], pt['lon']))
#     return pt
# 
# @cachetools.func.ttl_cache(maxsize=8192, ttl=3600)
# def resolve_dns(host):
#     if ':' in host:
#         ip, port = host.split(':')
#         return '%s:%s' % (resolve_dns(ip), port)
#     try:
#         return socket.gethostbyname(host)
#     except socket.gaierror:
#         log.warning('Cannot resolve host "{}"'.format(host))
#         return host


from bts_tools.network_utils import get_geoip_info, resolve_dns
from collections import defaultdict, deque
import socket
import time
import threading
import logging
        ('seed.jamzed.pl:2001',              '',   'jamzed',         ''),
        ('seed.curiesteem.com:2001',         '',   'curie',          ''),
        ('seed.steemit.lu:2001',             'lu', 'lux-witness',    'https://steemit.com/@lux-witness'),
        ('seed.steem.prcolaco.com:2001',     'pt', 'prc',            'https://steemit.com/witness-category/@prc/prc-witness-proposal-after-creating-dsound-and-attending-steemfest-2-i-want-more'),
        ('seed1.cryptobot.news:2001',        '',   'libertyranger',  ''),
        ('46.4.37.176:2001',                 'de', 'yuriks2000',     'https://steemit.com/witness-category/@yuriks2000/new-witness-announcement-steemapp-dev-team-yuriks2000-is-on-board'),
        ('seed.chainchopper.com:2001',       'us', 'justinadams',    'https://steemit.com/witness/@justinadams/the-people-can-we-get-a-witness-first-things-1st'),
        ('steem-seed.furion.me:2001',        'de', 'furion',         'https://steemit.com/@furion'),
        ('seed1.cervantes.one:2001',         'de', 'cervantes',      'https://steemit.com/spanish/@cervantes/proyecto-cervantes-2018-bienvenidos-a-un-nuevo-comienzo-lleno-de-evolucion'),
        ('steem-seed.freshterrain.com:2001', 'au', 'piquet',         'https://steemit.com/@piquet'),
        ('seed.xeldal.com:12150',            '',   'xeldal',         'https://steemit.com/witness-category/@xeldal/xeldal-witness-information'),
        ('seed.brandonfrye.us:2001',         '',   'brandonfrye',    'https://steemit.com/witness-category/@brandonfrye/brandon-frye-steem-witness-application'),
        ('seed.firepower.ltd:2001',          '',   'firepower',      'https://steemit.com/steem/@firepower/india-steem-meetup-3-an-awesome-meetup-in-mangalore-the-city-where-it-all-began'),
        ('steemseed.koinbot.org:2001',       'kr', 'koinbot',        'https://steemit.com/witness-category/@koinbot/koinbot-steem-witness-application'),
        ('seed01.steemulant.com:2001',       '',   'quochuy',        'https://steemit.com/witness-category/@quochuy/new-steem-witness-announcement-greetings-from-quochuy'),
        ('136.243.80.197:2001',              'us', 'steem-bounty',   'https://steemit.com/witness-category/@steem-bounty/announcing-our-new-steem-bounty-witness'), 
        ('witness.chitty.tech:2001',         'de', 'chitty',         'https://witness.chitty.tech'),
        ('134.255.253.142:2001',             'de', 'maxlxl',  ''),
        ('seed.therealwolf.me:2001',         'fi', 'therealwolf',    'https://steemit.com/witness-update/@therealwolf/witness-essentials-hf20-ready'),
        ('seed.yabapmatt.com:2001',          'de', 'yabapmatt',      'https://steemit.com/witness-category/@yabapmatt/yabapmatt-s-monster-1-year-steemiversary-witness-update')
    ],
    'ppy': [
        ('seed.ppy.blckchnd.com:6112',     '', 'blckchnd', ''),
        ('5.9.18.213:18828',               '', 'pfunk', ''),
        ('31.171.244.121:7777',            '', 'taconator', ''),
        ('seed.peerplaysdb.com:9777',      '', 'jesta', ''),
        ('ppy.esteem.ws:7777',             '', 'good-karma', ''),
        ('peerplays.roelandp.nl:9777',     '', 'roelandp', ''),
        ('ppy-seed.xeldal.com:19777',      '', 'xeldal', ''),
        ('seed.peerplaysnodes.com:9777',   '', 'wackou', ''),

# Path: bts_tools/network_utils.py
# @copy_cached_value
# @cachetools.func.lfu_cache(8192)
# def get_geoip_info(ip_addr):
#     try:
#         cred = core.config.get('credentials', {})['geoip2']  # check that we have a geoip2 section in config.yaml
#         client = geoip2.webservice.Client(cred['user'], cred['password'])
#     except KeyError as e:
#         raise ValueError('No geoip2 user and password defined in config.yaml') from e
# 
# 
#     log.debug('getting geoip2 info for for {}'.format(ip_addr))
#     response = client.city(ip_addr)
# 
#     pt = {'country': response.country.name,
#           'country_iso': response.country.iso_code,
#           'lat': response.location.latitude,
#           'lon': response.location.longitude
#           }
# 
#     log.debug('  {} -- {} ({}, {})'.format(ip_addr, pt['country'], pt['lat'], pt['lon']))
#     return pt
# 
# @cachetools.func.ttl_cache(maxsize=8192, ttl=3600)
# def resolve_dns(host):
#     if ':' in host:
#         ip, port = host.split(':')
#         return '%s:%s' % (resolve_dns(ip), port)
#     try:
#         return socket.gethostbyname(host)
#     except socket.gaierror:
#         log.warning('Cannot resolve host "{}"'.format(host))
#         return host


# Path: bts_tools/seednodes.py
from bts_tools.network_utils import get_geoip_info, resolve_dns
from collections import defaultdict, deque
import socket
import time
import threading
import logging

        ('seed.jamzed.pl:2001',              '',   'jamzed',         ''),
        ('seed.curiesteem.com:2001',         '',   'curie',          ''),
        ('seed.steemit.lu:2001',             'lu', 'lux-witness',    'https://steemit.com/@lux-witness'),
        ('seed.steem.prcolaco.com:2001',     'pt', 'prc',            'https://steemit.com/witness-category/@prc/prc-witness-proposal-after-creating-dsound-and-attending-steemfest-2-i-want-more'),
        ('seed1.cryptobot.news:2001',        '',   'libertyranger',  ''),
        ('46.4.37.176:2001',                 'de', 'yuriks2000',     'https://steemit.com/witness-category/@yuriks2000/new-witness-announcement-steemapp-dev-team-yuriks2000-is-on-board'),
        ('seed.chainchopper.com:2001',       'us', 'justinadams',    'https://steemit.com/witness/@justinadams/the-people-can-we-get-a-witness-first-things-1st'),
        ('steem-seed.furion.me:2001',        'de', 'furion',         'https://steemit.com/@furion'),
        ('seed1.cervantes.one:2001',         'de', 'cervantes',      'https://steemit.com/spanish/@cervantes/proyecto-cervantes-2018-bienvenidos-a-un-nuevo-comienzo-lleno-de-evolucion'),
        ('steem-seed.freshterrain.com:2001', 'au', 'piquet',         'https://steemit.com/@piquet'),
        ('seed.xeldal.com:12150',            '',   'xeldal',         'https://steemit.com/witness-category/@xeldal/xeldal-witness-information'),
        ('seed.brandonfrye.us:2001',         '',   'brandonfrye',    'https://steemit.com/witness-category/@brandonfrye/brandon-frye-steem-witness-application'),
        ('seed.firepower.ltd:2001',          '',   'firepower',      'https://steemit.com/steem/@firepower/india-steem-meetup-3-an-awesome-meetup-in-mangalore-the-city-where-it-all-began'),
        ('steemseed.koinbot.org:2001',       'kr', 'koinbot',        'https://steemit.com/witness-category/@koinbot/koinbot-steem-witness-application'),
        ('seed01.steemulant.com:2001',       '',   'quochuy',        'https://steemit.com/witness-category/@quochuy/new-steem-witness-announcement-greetings-from-quochuy'),
        ('136.243.80.197:2001',              'us', 'steem-bounty',   'https://steemit.com/witness-category/@steem-bounty/announcing-our-new-steem-bounty-witness'), 
        ('witness.chitty.tech:2001',         'de', 'chitty',         'https://witness.chitty.tech'),
        ('134.255.253.142:2001',             'de', 'maxlxl',  ''),
        ('seed.therealwolf.me:2001',         'fi', 'therealwolf',    'https://steemit.com/witness-update/@therealwolf/witness-essentials-hf20-ready'),
        ('seed.yabapmatt.com:2001',          'de', 'yabapmatt',      'https://steemit.com/witness-category/@yabapmatt/yabapmatt-s-monster-1-year-steemiversary-witness-update')
    ],
    'ppy': [
        ('seed.ppy.blckchnd.com:6112',     '', 'blckchnd', ''),
        ('5.9.18.213:18828',               '', 'pfunk', ''),
        ('31.171.244.121:7777',            '', 'taconator', ''),
        ('seed.peerplaysdb.com:9777',      '', 'jesta', ''),
        ('ppy.esteem.ws:7777',             '', 'good-karma', ''),
        ('peerplays.roelandp.nl:9777',     '', 'roelandp', ''),
        ('ppy-seed.xeldal.com:19777',      '', 'xeldal', ''),
        ('seed.peerplaysnodes.com:9777',   '', 'wackou', ''),

        ('peerplays-seed.privex.io:7777',  '', 'someguy123/privex', ''),