ruby-ip2 0.10.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.
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (C) 2009-2010 Brian Candler <http://www.deploy2.net/>
4
+ # Licensed under the same terms as ruby. See LICENCE.txt and COPYING.txt
5
+
6
+ class IP
7
+ # Create an instance from an alternative array format:
8
+ # [context, protocol, address, prefix_length]
9
+ def self.from_cpal(cpal)
10
+ new([cpal[1], cpal[2], cpal[3], cpal[0]])
11
+ end
12
+
13
+ # Return an alternative 4-element array format with the routing context
14
+ # as the first element. Useful for grouping by context.
15
+ # cpal = [context, proto, address, prefix_length]
16
+ def to_cpal
17
+ [@ctx, self.class::PROTO, @addr, @pfxlen]
18
+ end
19
+
20
+ # As cpal but with a hex string for the address part
21
+ def to_cphl
22
+ [@ctx, self.class::PROTO, to_hex, @pfxlen]
23
+ end
24
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (C) 2009-2010 Brian Candler <http://www.deploy2.net/>
4
+ # Licensed under the same terms as ruby. See LICENCE.txt and COPYING.txt
5
+
6
+ require 'socket'
7
+
8
+ class IP
9
+ # Return the address family, Socket::AF_INET or Socket::AF_INET6
10
+ def af
11
+ self.class::AF
12
+ end
13
+
14
+ # Convert to a packed sockaddr structure
15
+ def to_sockaddr(port = 0)
16
+ Socket.pack_sockaddr_in(port, to_addr)
17
+ end
18
+
19
+ class V4
20
+ AF = Socket::AF_INET
21
+ PROTO_TO_CLASS[AF] = self
22
+
23
+ # Avoid the string conversion when building sockaddr. Unfortunately this
24
+ # fails 32-bit machines with 1.8.6 for addrs >= 0x80000000. There is
25
+ # also no corresponding Socket.pack_sockaddr_in6 we could use for V6.
26
+
27
+ # def to_sockaddr(port=0)
28
+ # Socket.pack_sockaddr_in(port, to_i)
29
+ # end
30
+ end
31
+
32
+ class V6
33
+ AF = Socket::AF_INET6
34
+ PROTO_TO_CLASS[AF] = self
35
+ end
36
+ end
@@ -0,0 +1,3 @@
1
+ class IP
2
+ VERSION = '0.10.0'
3
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = 'ruby-ip2'
5
+ spec.version = '0.10.0'
6
+ spec.authors = ['Brian Candler', 'Martin Schmidt', 'Mike Simkins']
7
+ spec.email = ['software@g7m3.com']
8
+
9
+ spec.summary = 'IP Address Manipulation Library'
10
+ spec.description = 'Context Aware IP Address Manipulation Library'
11
+ spec.homepage = 'https://github.com/g7m3/ruby-ip2'
12
+ spec.license = 'Ruby'
13
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
14
+
15
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
16
+
17
+ spec.metadata['homepage_uri'] = spec.homepage
18
+ spec.metadata['source_code_uri'] = 'https://github.com/g7m3/ruby-ip2'
19
+ spec.metadata['changelog_uri'] = 'https://github.com/g7m3/ruby-ip2/blob/master/CHANGELOG.md'
20
+
21
+ spec.add_development_dependency 'bundler', '>= 1.7', '< 3'
22
+ spec.add_development_dependency 'minitest', '~> 5.14'
23
+ spec.add_development_dependency 'rake', '>= 12.3.3'
24
+ spec.add_development_dependency 'coveralls', '~> 0.8'
25
+
26
+ spec.add_dependency 'activemodel', '~> 6.0'
27
+
28
+ # Specify which files should be added to the gem when it is released.
29
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
30
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
31
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
32
+ end
33
+ spec.bindir = 'exe'
34
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
35
+ spec.require_paths = ['lib']
36
+ end
metadata ADDED
@@ -0,0 +1,139 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruby-ip2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.10.0
5
+ platform: ruby
6
+ authors:
7
+ - Brian Candler
8
+ - Martin Schmidt
9
+ - Mike Simkins
10
+ autorequire:
11
+ bindir: exe
12
+ cert_chain: []
13
+ date: 2020-08-25 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: bundler
17
+ requirement: !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - ">="
20
+ - !ruby/object:Gem::Version
21
+ version: '1.7'
22
+ - - "<"
23
+ - !ruby/object:Gem::Version
24
+ version: '3'
25
+ type: :development
26
+ prerelease: false
27
+ version_requirements: !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ version: '1.7'
32
+ - - "<"
33
+ - !ruby/object:Gem::Version
34
+ version: '3'
35
+ - !ruby/object:Gem::Dependency
36
+ name: minitest
37
+ requirement: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '5.14'
42
+ type: :development
43
+ prerelease: false
44
+ version_requirements: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '5.14'
49
+ - !ruby/object:Gem::Dependency
50
+ name: rake
51
+ requirement: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 12.3.3
56
+ type: :development
57
+ prerelease: false
58
+ version_requirements: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: 12.3.3
63
+ - !ruby/object:Gem::Dependency
64
+ name: coveralls
65
+ requirement: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '0.8'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: '0.8'
77
+ - !ruby/object:Gem::Dependency
78
+ name: activemodel
79
+ requirement: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: '6.0'
84
+ type: :runtime
85
+ prerelease: false
86
+ version_requirements: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - "~>"
89
+ - !ruby/object:Gem::Version
90
+ version: '6.0'
91
+ description: Context Aware IP Address Manipulation Library
92
+ email:
93
+ - software@g7m3.com
94
+ executables: []
95
+ extensions: []
96
+ extra_rdoc_files: []
97
+ files:
98
+ - ".gitignore"
99
+ - ".rubocop.yml"
100
+ - ".travis.yml"
101
+ - COPYING.txt
102
+ - Gemfile
103
+ - LICENSE.txt
104
+ - README.rdoc
105
+ - Rakefile
106
+ - lib/ip.rb
107
+ - lib/ip/base.rb
108
+ - lib/ip/cpal.rb
109
+ - lib/ip/socket.rb
110
+ - lib/ip/version.rb
111
+ - ruby-ip2.gemspec
112
+ homepage: https://github.com/g7m3/ruby-ip2
113
+ licenses:
114
+ - Ruby
115
+ metadata:
116
+ allowed_push_host: https://rubygems.org
117
+ homepage_uri: https://github.com/g7m3/ruby-ip2
118
+ source_code_uri: https://github.com/g7m3/ruby-ip2
119
+ changelog_uri: https://github.com/g7m3/ruby-ip2/blob/master/CHANGELOG.md
120
+ post_install_message:
121
+ rdoc_options: []
122
+ require_paths:
123
+ - lib
124
+ required_ruby_version: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ version: 2.3.0
129
+ required_rubygems_version: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ requirements: []
135
+ rubygems_version: 3.1.4
136
+ signing_key:
137
+ specification_version: 4
138
+ summary: IP Address Manipulation Library
139
+ test_files: []