pickynode 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/pickynode.rb +8 -10
- data/pickynode.gemspec +0 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 702cd10448727e96f341a26c08c971bb0f17bd97
|
4
|
+
data.tar.gz: 489e7d774e5c27e96595f26e262b24c7c13d68b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc42867734de71d7f6febfe971511df2eff482d85e75d638b76bd17059d25e65ef01d5e10762777943def956abe2c4bca6c04e279594804efc8a12d5d7ec5d23
|
7
|
+
data.tar.gz: 56f4542daf463e1404314e251e298b255ca22f82ab54f844f7e5b4b520a2df75c771cd4f931fdc82c6143f577aefecf0f045dadd39597b1f6fef71254e11f914
|
data/README.md
CHANGED
data/lib/pickynode.rb
CHANGED
@@ -9,7 +9,7 @@ require 'uri'
|
|
9
9
|
# Allows you to easily add/ban/connect/disconnect nodes
|
10
10
|
# based on User Agent.
|
11
11
|
class Pickynode
|
12
|
-
VERSION = '0.1.
|
12
|
+
VERSION = '0.1.4'
|
13
13
|
|
14
14
|
def initialize(opts = {})
|
15
15
|
@opts = opts
|
@@ -18,11 +18,10 @@ class Pickynode
|
|
18
18
|
def add(filter, limit = nil)
|
19
19
|
return unless filter
|
20
20
|
|
21
|
-
|
21
|
+
validate_limit(limit)
|
22
22
|
|
23
23
|
count = 0
|
24
|
-
bitnode_addr_types.each do |k,
|
25
|
-
next unless v.include?(filter)
|
24
|
+
bitnode_addr_types.select { |_, v| v.include?(filter) }.each do |k, _|
|
26
25
|
run_cmd(%(bitcoin-cli addnode "#{k}" "add"))
|
27
26
|
count += 1
|
28
27
|
break if limit == count
|
@@ -42,11 +41,10 @@ class Pickynode
|
|
42
41
|
def connect(filter, limit = nil)
|
43
42
|
return unless filter
|
44
43
|
|
45
|
-
|
44
|
+
validate_limit(limit)
|
46
45
|
|
47
46
|
count = 0
|
48
|
-
bitnode_addr_types.each do |k,
|
49
|
-
next unless v.include?(filter)
|
47
|
+
bitnode_addr_types.select { |_, v| v.include?(filter) }.each do |k, _|
|
50
48
|
run_cmd(%(bitcoin-cli addnode "#{k}" "onetry"))
|
51
49
|
count += 1
|
52
50
|
break if limit == count
|
@@ -130,8 +128,8 @@ class Pickynode
|
|
130
128
|
`bitcoin-cli getpeerinfo`
|
131
129
|
end
|
132
130
|
|
133
|
-
def
|
134
|
-
return
|
135
|
-
limit > 0
|
131
|
+
def validate_limit(limit)
|
132
|
+
return unless limit
|
133
|
+
raise 'Limit must be greater than 0' unless limit > 0
|
136
134
|
end
|
137
135
|
end
|
data/pickynode.gemspec
CHANGED
@@ -5,7 +5,6 @@ require File.expand_path(File.join('..', 'lib', 'pickynode'), __FILE__)
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = 'pickynode'
|
7
7
|
s.version = Pickynode::VERSION
|
8
|
-
s.date = '2017-05-19'
|
9
8
|
s.summary = 'Manage connections to your bitcoin node'
|
10
9
|
s.description = "Some people are picky about the \
|
11
10
|
bitcoin nodes they connect to."
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pickynode
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Ellithorpe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05
|
11
|
+
date: 2017-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: awesome_print
|