tcp-client 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tcp-client/address.rb +12 -7
- data/lib/tcp-client/mixin/io_timeout.rb +1 -1
- data/lib/tcp-client/ssl_socket.rb +1 -1
- data/lib/tcp-client/tcp_socket.rb +1 -1
- data/lib/tcp-client/version.rb +1 -1
- data/rakefile.rb +6 -1
- data/tcp-client.gemspec +5 -2
- data/test/tcp_client_test.rb +1 -0
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b04df2a87aaa1d7eea3322907e4f37c8ae228507474b6b59927617e12eb73d49
|
4
|
+
data.tar.gz: 4454f0e6a53984627ffc3cb681a6b496f49306040d3a2bc0bfdabdf2405595a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48e6bae6c20b9335593ca20d45f03884fd11db4fe2ff97b35766f17444f414f4cf15d5e187b02f059001e1bc819ed442cb4abd715de44bffbcac53f01dcacba5
|
7
|
+
data.tar.gz: 912f1716f2bdeeb3e9bbdff18a5232c015d15c461f4aa4ba1919af2d7836f8f56e7916ee3800e7a26633dfee3c05257849a255669f9cb6eaf1a87c475f12a459
|
data/lib/tcp-client/address.rb
CHANGED
@@ -22,13 +22,6 @@ class TCPClient
|
|
22
22
|
|
23
23
|
private
|
24
24
|
|
25
|
-
def init_from_string(str)
|
26
|
-
@hostname, port = from_string(str.to_s)
|
27
|
-
return init_from_addrinfo(Addrinfo.tcp(nil, port)) unless @hostname
|
28
|
-
@addrinfo = Addrinfo.tcp(@hostname, port)
|
29
|
-
@to_s = @hostname.index(':') ? "[#{@hostname}]:#{port}" : "#{@hostname}:#{port}"
|
30
|
-
end
|
31
|
-
|
32
25
|
def init_from_selfclass(address)
|
33
26
|
@to_s = address.to_s
|
34
27
|
@hostname = address.hostname
|
@@ -41,11 +34,23 @@ class TCPClient
|
|
41
34
|
@addrinfo = addrinfo
|
42
35
|
end
|
43
36
|
|
37
|
+
def init_from_string(str)
|
38
|
+
@hostname, port = from_string(str.to_s)
|
39
|
+
return init_from_addrinfo(Addrinfo.tcp(nil, port)) unless @hostname
|
40
|
+
@addrinfo = Addrinfo.tcp(@hostname, port)
|
41
|
+
@to_s = as_str(@hostname, port)
|
42
|
+
end
|
43
|
+
|
44
44
|
def from_string(str)
|
45
45
|
return [nil, str.to_i] unless idx = str.rindex(':')
|
46
46
|
name = str[0, idx]
|
47
47
|
name = name[1, name.size - 2] if name[0] == '[' && name[-1] == ']'
|
48
48
|
[name, str[idx + 1, str.size - idx].to_i]
|
49
49
|
end
|
50
|
+
|
51
|
+
def as_str(hostname, port)
|
52
|
+
return "[#{hostname}]:#{port}" if hostname.index(':') # IP6
|
53
|
+
"#{hostname}:#{port}"
|
54
|
+
end
|
50
55
|
end
|
51
56
|
end
|
data/lib/tcp-client/version.rb
CHANGED
data/rakefile.rb
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'rake/clean'
|
4
4
|
require 'rake/testtask'
|
5
|
+
require 'bundler/gem_tasks'
|
6
|
+
|
7
|
+
STDOUT.sync = STDERR.sync = true
|
8
|
+
|
9
|
+
CLOBBER << 'prj'
|
5
10
|
|
6
11
|
Rake::TestTask.new(:test) do |t|
|
7
12
|
t.ruby_opts = %w[-w]
|
data/tcp-client.gemspec
CHANGED
@@ -14,9 +14,12 @@ GemSpec = Gem::Specification.new do |spec|
|
|
14
14
|
limits for each method (`connect`, `read`, `write`).
|
15
15
|
DESCRIPTION
|
16
16
|
spec.author = 'Mike Blumtritt'
|
17
|
-
spec.email = 'mike.blumtritt@
|
17
|
+
spec.email = 'mike.blumtritt@pm.me'
|
18
18
|
spec.homepage = 'https://github.com/mblumtritt/tcp-client'
|
19
|
-
spec.metadata = {
|
19
|
+
spec.metadata = {
|
20
|
+
'source_code_uri' => 'https://github.com/mblumtritt/tcp-client',
|
21
|
+
'bug_tracker_uri' => 'https://github.com/mblumtritt/tcp-client/issues'
|
22
|
+
}
|
20
23
|
spec.rubyforge_project = spec.name
|
21
24
|
|
22
25
|
spec.add_development_dependency 'bundler'
|
data/test/tcp_client_test.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tcp-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Blumtritt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -58,7 +58,7 @@ description: |
|
|
58
58
|
easy to use client which can handle time limits correctly. Unlike
|
59
59
|
other implementations this client respects given/configurable time
|
60
60
|
limits for each method (`connect`, `read`, `write`).
|
61
|
-
email: mike.blumtritt@
|
61
|
+
email: mike.blumtritt@pm.me
|
62
62
|
executables: []
|
63
63
|
extensions: []
|
64
64
|
extra_rdoc_files:
|
@@ -87,7 +87,8 @@ files:
|
|
87
87
|
homepage: https://github.com/mblumtritt/tcp-client
|
88
88
|
licenses: []
|
89
89
|
metadata:
|
90
|
-
|
90
|
+
source_code_uri: https://github.com/mblumtritt/tcp-client
|
91
|
+
bug_tracker_uri: https://github.com/mblumtritt/tcp-client/issues
|
91
92
|
post_install_message:
|
92
93
|
rdoc_options: []
|
93
94
|
require_paths:
|
@@ -103,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
104
|
- !ruby/object:Gem::Version
|
104
105
|
version: 1.3.6
|
105
106
|
requirements: []
|
106
|
-
rubygems_version: 3.0.
|
107
|
+
rubygems_version: 3.0.3
|
107
108
|
signing_key:
|
108
109
|
specification_version: 4
|
109
110
|
summary: A TCP client implementation with working timeout support.
|