mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
Utility to create pnSeed array
This commit is contained in:
parent
2835080e16
commit
9126e08739
9
contrib/seeds/README
Normal file
9
contrib/seeds/README
Normal file
@ -0,0 +1,9 @@
|
||||
Utility to generate the pnSeed[] array that is compiled into the client
|
||||
(see src/net.cpp).
|
||||
|
||||
The 600 seeds compiled into the 0.8 release were created from sipa's DNS seed data, like this:
|
||||
|
||||
curl -s http://bitcoin.sipa.be/seeds.txt | head -1000 | makeseeds.py
|
||||
|
||||
The input to makeseeds.py is assumed to be approximately sorted from most-reliable to least-reliable,
|
||||
with IP:port first on each line (lines that don't match IPv4:port are ignored).
|
32
contrib/seeds/makeseeds.py
Executable file
32
contrib/seeds/makeseeds.py
Executable file
@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Generate pnSeed[] from Pieter's DNS seeder
|
||||
#
|
||||
|
||||
NSEEDS=600
|
||||
|
||||
import re
|
||||
import sys
|
||||
from subprocess import check_output
|
||||
|
||||
def main():
|
||||
lines = sys.stdin.readlines()
|
||||
|
||||
ips = []
|
||||
pattern = re.compile(r"^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3}):8333")
|
||||
for line in lines:
|
||||
m = pattern.match(line)
|
||||
if m is None:
|
||||
continue
|
||||
ip = 0
|
||||
for i in range(0,4):
|
||||
ip = ip + (int(m.group(i+1)) << (8*(i)))
|
||||
if ip == 0:
|
||||
continue
|
||||
ips.append(ip)
|
||||
|
||||
for row in range(0, min(NSEEDS,len(ips)), 8):
|
||||
print " " + ", ".join([ "0x%08x"%i for i in ips[row:row+8] ]) + ","
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
Loading…
Reference in New Issue
Block a user