sibit 0.29.1 → 0.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 16d749128c92e0a715c1545d8cb6aa6a41a4afcbd7fc39db0e708fa87ea7383d
4
- data.tar.gz: c522bc105501aedd9f3ef6140ac99bb1b18cec23fc060ff8dd6ceed4d4e69dff
3
+ metadata.gz: 630864e9ab6ffc8c64cca7cd4e4a413f1924b756bf126c103630ff2a05146ecb
4
+ data.tar.gz: 68e15a268fc7caf94ebc9d824212daab7f4c823e282db75abfec1b1c747ab53e
5
5
  SHA512:
6
- metadata.gz: 854ede7b60a6cd9e1334341b14f1b712e002b23499a5a192d61b53380b68d3203f4d7c3d0aaa87499d59a885190345e776410e1eb133f26f85b8aaac260772ed
7
- data.tar.gz: f99cee0f4d8615d0a39ee7609c697b4238e0e867193934564d5f2d29cfffe454b630b8da0f4e7f1bda9620d57d395bdf4b365614cf318c6079b808dab330cc2f
6
+ metadata.gz: 87245d26c76ed83e20606a99217fdf81f7c3952cda04efe3b8578908166fff04d73beb41a8ce9a723c6f535a12a67aea561b819aeb72535a93443d52dce6225f
7
+ data.tar.gz: 0d777da50586ea0edc315536dfab3333ed3babbeb815d054120609a55610dd5fe90b38e80c93387f368071031c453b32e1f26c7fb079526806d3f5882a1924de
data/README.md CHANGED
@@ -88,6 +88,18 @@ It is recommended to run it with `--dry --verbose` options first,
88
88
  If everything looks correct, remove the `--dry` and run again,
89
89
  the transaction is pushed to the network.
90
90
 
91
+ To use an HTTPS proxy for all requests:
92
+
93
+ ```bash
94
+ $ sibit --proxy=host:port balance 1PfsYNygsuVL8fvBarJNQnHytkg4rGih1U
95
+ ```
96
+
97
+ The proxy address may include authentication credentials:
98
+
99
+ ```bash
100
+ $ sibit --proxy=user:password@host:port balance 1PfsYNygsuVL8fvBarJNQnHytkg4rGih1U
101
+ ```
102
+
91
103
  All operations are performed through the [Blockchain API].
92
104
  Transactions are pushed to the Bitcoin network via [this relay].
93
105
 
data/bin/sibit CHANGED
@@ -12,6 +12,7 @@ require 'retriable_proxy'
12
12
  require 'slop'
13
13
  require_relative '../lib/sibit'
14
14
  require_relative '../lib/sibit/http'
15
+ require_relative '../lib/sibit/httpproxy'
15
16
  require_relative '../lib/sibit/bitcoinchain'
16
17
  require_relative '../lib/sibit/blockchain'
17
18
  require_relative '../lib/sibit/blockchair'
data/lib/sibit/http.rb CHANGED
@@ -20,22 +20,4 @@ class Sibit
20
20
  http
21
21
  end
22
22
  end
23
-
24
- # This HTTP client with proxy.
25
- #
26
- # Author:: Yegor Bugayenko (yegor256@gmail.com)
27
- # Copyright:: Copyright (c) 2019-2025 Yegor Bugayenko
28
- # License:: MIT
29
- class HttpProxy
30
- def initialize(addr)
31
- @host, @port = addr.split(':')
32
- end
33
-
34
- def client(uri)
35
- http = Net::HTTP.new(uri.host, uri.port, @host, @port.to_i)
36
- http.use_ssl = true
37
- http.read_timeout = 240
38
- http
39
- end
40
- end
41
23
  end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ # SPDX-FileCopyrightText: Copyright (c) 2019-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
5
+
6
+ require 'net/http'
7
+
8
+ # Sibit main class.
9
+ class Sibit
10
+ # HTTP client with proxy.
11
+ #
12
+ # Accepts proxy address in format: host:port or user:password@host:port
13
+ #
14
+ # Author:: Yegor Bugayenko (yegor256@gmail.com)
15
+ # Copyright:: Copyright (c) 2019-2025 Yegor Bugayenko
16
+ # License:: MIT
17
+ class HttpProxy
18
+ def initialize(addr)
19
+ @user, @password, @host, @port = parse(addr)
20
+ end
21
+
22
+ def client(uri)
23
+ http = Net::HTTP.new(uri.host, uri.port, @host, @port.to_i, @user, @password)
24
+ http.use_ssl = true
25
+ http.read_timeout = 240
26
+ http
27
+ end
28
+
29
+ private
30
+
31
+ def parse(addr)
32
+ if addr.include?('@')
33
+ auth, hostport = addr.split('@')
34
+ user, password = auth.split(':')
35
+ host, port = hostport.split(':')
36
+ [user, password, host, port]
37
+ else
38
+ host, port = addr.split(':')
39
+ [nil, nil, host, port]
40
+ end
41
+ end
42
+ end
43
+ end
data/lib/sibit/version.rb CHANGED
@@ -9,5 +9,5 @@
9
9
  # License:: MIT
10
10
  class Sibit
11
11
  # Current version of the library.
12
- VERSION = '0.29.1'
12
+ VERSION = '0.30.0'
13
13
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sibit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.29.1
4
+ version: 0.30.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
@@ -149,6 +149,7 @@ files:
149
149
  - lib/sibit/fake.rb
150
150
  - lib/sibit/firstof.rb
151
151
  - lib/sibit/http.rb
152
+ - lib/sibit/httpproxy.rb
152
153
  - lib/sibit/json.rb
153
154
  - lib/sibit/version.rb
154
155
  - logo.svg