net: hardcoded seeds (primarily for browser).
This commit is contained in:
parent
e823222e45
commit
614a952015
21
lib/net/seeds/index.js
Normal file
21
lib/net/seeds/index.js
Normal file
@ -0,0 +1,21 @@
|
||||
/*!
|
||||
* seeds.js - seeds for bcoin
|
||||
* Copyright (c) 2017, Christopher Jeffrey (MIT License).
|
||||
* https://github.com/bcoin-org/bcoin
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var main = require('./main');
|
||||
var testnet = require('./testnet');
|
||||
|
||||
exports.get = function get(type) {
|
||||
switch (type) {
|
||||
case 'main':
|
||||
return main;
|
||||
case 'testnet':
|
||||
return testnet;
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
};
|
||||
1170
lib/net/seeds/main.js
Normal file
1170
lib/net/seeds/main.js
Normal file
File diff suppressed because it is too large
Load Diff
9
lib/net/seeds/testnet.js
Normal file
9
lib/net/seeds/testnet.js
Normal file
@ -0,0 +1,9 @@
|
||||
module.exports = [
|
||||
'thfsmmn2jbitcoin.onion',
|
||||
'it2pj4f7657g3rhi.onion',
|
||||
'nkf5e6b7pl4jfd4a.onion',
|
||||
'4zhkir2ofl7orfom.onion',
|
||||
't6xj6wilh4ytvcs7.onion',
|
||||
'i6y6ivorwakd7nw3.onion',
|
||||
'ubqj4rsu3nqtxmtp.onion'
|
||||
];
|
||||
30
scripts/seeds.sh
Executable file
30
scripts/seeds.sh
Executable file
@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
dir=$(dirname "$(which "$0")")
|
||||
url_main='https://raw.githubusercontent.com/bitcoin/bitcoin/master/contrib/seeds/nodes_main.txt'
|
||||
url_testnet='https://raw.githubusercontent.com/bitcoin/bitcoin/master/contrib/seeds/nodes_test.txt'
|
||||
|
||||
getseeds() {
|
||||
echo "$(curl -s "$1")"
|
||||
}
|
||||
|
||||
tojs() {
|
||||
local data=$(cat)
|
||||
local body=$(echo "$data" | head -n -1)
|
||||
local last=$(echo "$data" | tail -n 1)
|
||||
echo 'module.exports = ['
|
||||
echo "$body" | while read line; do
|
||||
if echo "$line" | grep '^#' > /dev/null; then
|
||||
continue
|
||||
fi
|
||||
if echo "$line" | grep '^ *$' > /dev/null; then
|
||||
continue
|
||||
fi
|
||||
echo " '${line}',"
|
||||
done
|
||||
echo " '${last}'"
|
||||
echo '];'
|
||||
}
|
||||
|
||||
getseeds "$url_main" | tojs > "${dir}/../lib/net/seeds/main.js"
|
||||
getseeds "$url_testnet" | tojs > "${dir}/../lib/net/seeds/testnet.js"
|
||||
Loading…
Reference in New Issue
Block a user