コード例 #1
0
def view_seed_nodes():
    headers = ['seed host', 'status', 'provided by']
    data = seednodes.get_seeds_view_data(chain, cached=True)
    headers *= (len(data[0]) // len(headers))

    peers = seednodes.get_seeds_as_peers(chain)
    points = network_utils.get_world_map_points_from_peers(peers)
    countries = defaultdict(int)
    for pt in points:
        try:
            countries[pt['country_iso'].lower()] += 1
        except Exception:
            pass

    seeds_status = seednodes.check_all_seeds_cached(chain)
    online_seeds = [seed for seed, status in seeds_status.items() if status == 'online']
    config_ini = '\n'.join('seed-node = {}'.format(seed) for seed in online_seeds)
    config_ini_list = '[{}]'.format(', '.join('"{}"'.format(seed) for seed in online_seeds))

    return render_template('tableview_naked.html',
                           title='{} seed nodes'.format(chain),
                           subtitle='Please edit <a href="https://github.com/wackou/bts_tools/blob/master/bts_tools/seednodes.py#L32">the file directly on github</a> to submit changes '
                                    '<a href="https://help.github.com/articles/editing-files-in-another-user-s-repository/">(HOWTO)</a>',
                           headers=headers,
                           points=points,
                           countries=countries,
                           data=data, order='[[1, "desc"]]', nrows=100, sortable=True,
                           config_ini=config_ini, config_ini_list=config_ini_list)
コード例 #2
0
def view_seed_nodes():
    headers = ['seed host', 'status', 'provided by']
    data = seednodes.get_seeds_view_data(chain, cached=True)
    headers *= (len(data[0]) // len(headers))

    peers = seednodes.get_seeds_as_peers(chain)
    points = network_utils.get_world_map_points_from_peers(peers)
    countries = defaultdict(int)
    for pt in points:
        countries[pt['country_iso'].lower()] += 1

    seeds_status = seednodes.check_all_seeds_cached(chain)
    online_seeds = [
        seed for seed, status in seeds_status.items() if status == 'online'
    ]
    config_ini = '\n'.join('seed-node = {}'.format(seed)
                           for seed in online_seeds)
    config_ini_list = '[{}]'.format(', '.join('"{}"'.format(seed)
                                              for seed in online_seeds))

    return render_template('tableview_naked.html',
                           title='{} seed nodes'.format(chain),
                           headers=headers,
                           points=points,
                           countries=countries,
                           data=data,
                           order='[[1, "desc"]]',
                           nrows=100,
                           sortable=True,
                           config_ini=config_ini,
                           config_ini_list=config_ini_list)
コード例 #3
0
def view_seed_nodes():
    headers = ['seed host', 'status', 'provided by']
    data = seednodes.get_seeds_view_data(chain)
    headers *= (len(data[0]) // len(headers))

    peers = seednodes.get_seeds_as_peers(chain)
    points = network_utils.get_world_map_points_from_peers(peers)
    countries = defaultdict(int)
    for pt in points:
        countries[pt['country_iso'].lower()] += 1

    return render_template('tableview_naked.html',
                           title='{} seed nodes'.format(chain),
                           headers=headers,
                           points=points,
                           countries=countries,
                           data=data, order='[]', nrows=100, sortable=False)