zold 0.1.3 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: '09d7ef8c23b73e35bcd86811676ae8a855ac6b9a'
4
- data.tar.gz: 92e5aff241b697d01a276952ce9f4d67864129a9
3
+ metadata.gz: dacc55ede1e95bcc4a68e0465956222384e56dfa
4
+ data.tar.gz: dc19e682137b6ea95c7d84f356bfbed274b5d15d
5
5
  SHA512:
6
- metadata.gz: f7d03ae4fdf096522955be27b77b9a3634646b11744e75c63dce2694f6ecf2d16ce6ffd2d9305e63e11193a694f34a0d95f5364f34d5dd5e88e709d4f43c526f
7
- data.tar.gz: fbc256f233ded7b10cc702dc883acd568f17c8ee4dc12001b4efc3c48df677c7ec54d16db1c832c75e6045c69608f99e57fd78d7b496b18034711e0b28c27171
6
+ metadata.gz: d3ce870271599965d9647053d6510c8fafdc6b17cc8c10d6b11dbeeac97514b48d263faac20a3b05fbf0aa983752a4c2b8a2a7bef233de435d836bc29bd96d63
7
+ data.tar.gz: 41f5d7a05d611188cbc8ee970f908d716b2b9651157ab1fa4df093e8b16622b26742e829fd07d57bb34f38c7717477065c6669ac1a7364899d7eb2410f9dc2aa
data/README.md CHANGED
@@ -100,7 +100,7 @@ SHA-256: "eba36e52e1ee674d198f486e07c8496853ffc8879e7fe25329523177646a96a0"
100
100
  ```
101
101
 
102
102
  The node attempts to try different sufficies until one of them produces
103
- SHA-256 hash that ends with `00000000` (eight zeros). For example, this
103
+ SHA-256 hash that ends with `0000000` (seven zeros). For example, this
104
104
  suffix `11edb424c` works (it took 212 minutes to find it on 2.3GHz Intel Core i7):
105
105
 
106
106
  ```
data/bin/zold CHANGED
@@ -66,6 +66,8 @@ Available commands:
66
66
  Push all/some local wallets or the ones required
67
67
  #{Rainbow('node').green} port
68
68
  Run node at the given TCP port
69
+ #{Rainbow('score').green} host port strength
70
+ Generate score for the given host and port
69
71
  Available options:"
70
72
  o.string '-d', '--dir',
71
73
  'The directory where wallets are stored (default: current directory)',
@@ -219,6 +221,24 @@ Available options:"
219
221
  remotes: remotes,
220
222
  log: log
221
223
  ).run(args)
224
+ when 'score'
225
+ require_relative '../lib/zold/score'
226
+ if args.length != 3
227
+ raise 'Exactly three args required: host, port, strength'
228
+ end
229
+ host = args[0]
230
+ raise "Invalid host name: #{host}" unless host =~ /[a-z0-9\.-]+/
231
+ port = args[1].to_i
232
+ raise "Invalid TCP port: #{port}" if port <= 0 || port > 65535
233
+ strength = args[2].to_i
234
+ raise "Invalid strength: #{strength}" if strength <= 0 || strength > 8
235
+ score = Zold::Score.new(
236
+ Time.now, host, port, strength: strength
237
+ )
238
+ loop do
239
+ log.info(score.to_s)
240
+ score = score.next
241
+ end
222
242
  else
223
243
  raise "Command '#{command}' is not supported"
224
244
  end
@@ -19,8 +19,7 @@
19
19
  # SOFTWARE.
20
20
 
21
21
  require 'slop'
22
- require_relative '../node/front.rb'
23
- require_relative '../log.rb'
22
+ require_relative '../score'
24
23
  require_relative '../node/front'
25
24
 
26
25
  # NODE command.
@@ -47,6 +46,9 @@ module Zold
47
46
  default: '127.0.0.1'
48
47
  o.string '--home', 'Home directory (default: current directory)',
49
48
  default: Dir.pwd
49
+ o.integer '--strength',
50
+ "The strength of the score (default: #{Score::DEFAULT_STRENGTH})",
51
+ default: Score::DEFAULT_STRENGTH
50
52
  o.integer '--threads',
51
53
  'How many threads to use for scores finding (default: 8)',
52
54
  default: 8
@@ -68,7 +70,10 @@ module Zold
68
70
  FileUtils.mkdir_p(opts[:home])
69
71
  Zold::Front.set(:home, opts[:home])
70
72
  farm = Farm.new(log: @log)
71
- farm.start(opts[:host], opts[:port], threads: opts[:threads])
73
+ farm.start(
74
+ opts[:host], opts[:port],
75
+ threads: opts[:threads], strength: opts[:strength]
76
+ )
72
77
  Zold::Front.set(:farm, farm)
73
78
  @log.debug('Starting up the web front...')
74
79
  begin
data/lib/zold/version.rb CHANGED
@@ -23,5 +23,5 @@
23
23
  # Copyright:: Copyright (c) 2018 Yegor Bugayenko
24
24
  # License:: MIT
25
25
  module Zold
26
- VERSION = '0.1.3'.freeze
26
+ VERSION = '0.2'.freeze
27
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zold
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: '0.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-12 00:00:00.000000000 Z
11
+ date: 2018-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber