netaddr 1.4.0 → 1.5.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of netaddr might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/ruby
2
2
 
3
- require 'lib/netaddr.rb'
3
+ require_relative "../lib/netaddr.rb"
4
4
  require 'test/unit'
5
5
 
6
6
 
@@ -83,6 +83,9 @@ class TestMethods < Test::Unit::TestCase
83
83
  assert_equal('10.0.0.0/24', merged[0].desc)
84
84
  assert_equal('10.0.0.240/28', merged[0].tag[:Subnets][5].desc)
85
85
  assert(merged[0].tag[:Subnets][5].tag[:test])
86
+
87
+ assert_equal(['10.0.0.0/8','192.168.0.0/24'], NetAddr.merge(['10.0.0.0/8', '10.0.0.0/12', '10.0.0.0/24','192.168.0.0/24','192.168.0.64/26']) )
88
+
86
89
  end
87
90
 
88
91
  def test_minimum_size
@@ -187,6 +190,22 @@ class TestMethods < Test::Unit::TestCase
187
190
  assert_equal([cidr4_4,cidr4_3,cidr4_2,cidr4_1,cidr4_5], sort5)
188
191
  end
189
192
 
193
+ def test_supernets
194
+ assert_raise(ArgumentError){ NetAddr.supernets(1) }
195
+ assert_raise(ArgumentError){ NetAddr.supernets({}) }
196
+
197
+ list4 = ['192.168.1.0', '192.168.1.1', '192.168.1.0/31', '10.1.1.0/24', '10.1.1.32/27']
198
+ list6 = ['fec0::/64', 'fec0::', 'fe80::/32', 'fe80::1']
199
+ assert_equal(['10.1.1.0/24','192.168.1.0/31'], NetAddr.supernets(list4) )
200
+ assert_equal(['fe80:0000:0000:0000:0000:0000:0000:0000/32', 'fec0:0000:0000:0000:0000:0000:0000:0000/64'], NetAddr.supernets(list6) )
201
+ assert_equal(['fe80::/32', 'fec0::/64'], NetAddr.supernets(list6, :Short => true) )
202
+
203
+ list4.push( NetAddr::CIDR.create('192.168.0.0/23') )
204
+ list6.push( NetAddr::CIDR.create('fec0::/48') )
205
+ summ = NetAddr.supernets(list4.concat(list6), :Objectify => true)
206
+ assert_equal('192.168.1.0/31', summ[0].tag[:Subnets][0].desc)
207
+ end
208
+
190
209
  def test_unshorten
191
210
  assert_equal('fec0:0000:0000:0000:0000:0000:0000:0000', NetAddr.unshorten('fec0::') )
192
211
  assert_equal('fec0:0000:0000:0000:0002:0000:0000:0001', NetAddr.unshorten('fec0::2:0:0:1') )
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/ruby
2
2
 
3
- require 'lib/netaddr.rb'
3
+ require_relative "../lib/netaddr.rb"
4
4
  require 'test/unit'
5
5
 
6
6
 
metadata CHANGED
@@ -1,68 +1,62 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: netaddr
3
- version: !ruby/object:Gem::Version
4
- version: 1.4.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.5.3
5
5
  platform: ruby
6
- authors:
6
+ authors:
7
7
  - Dustin Spinhirne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
-
12
- date: 2008-02-15 00:00:00 -06:00
13
- default_executable:
11
+ date: 2022-07-08 00:00:00.000000000 Z
14
12
  dependencies: []
15
-
16
13
  description:
17
14
  email:
18
15
  executables: []
19
-
20
16
  extensions: []
21
-
22
- extra_rdoc_files:
23
- - README
17
+ extra_rdoc_files:
18
+ - README.md
24
19
  - Errors
25
20
  - changelog
26
- files:
27
- - lib/cidr_shortcuts.rb
21
+ - license
22
+ files:
23
+ - Errors
24
+ - README.md
25
+ - changelog
28
26
  - lib/cidr.rb
29
- - lib/ip_math.rb
30
- - lib/validation_shortcuts.rb
27
+ - lib/cidr_shortcuts.rb
31
28
  - lib/eui.rb
32
- - lib/netaddr.rb
29
+ - lib/ip_math.rb
33
30
  - lib/methods.rb
31
+ - lib/netaddr.rb
34
32
  - lib/tree.rb
35
- - README
36
- - Errors
37
- - changelog
38
- has_rdoc: true
33
+ - lib/validation_shortcuts.rb
34
+ - license
35
+ - test/cidr_test.rb
36
+ - test/eui_test.rb
37
+ - test/methods_test.rb
38
+ - test/tree_test.rb
39
39
  homepage:
40
+ licenses:
41
+ - Apache-2.0
42
+ metadata: {}
40
43
  post_install_message:
41
44
  rdoc_options: []
42
-
43
- require_paths:
45
+ require_paths:
44
46
  - lib
45
- required_ruby_version: !ruby/object:Gem::Requirement
46
- requirements:
47
+ required_ruby_version: !ruby/object:Gem::Requirement
48
+ requirements:
47
49
  - - ">="
48
- - !ruby/object:Gem::Version
49
- version: "0"
50
- version:
51
- required_rubygems_version: !ruby/object:Gem::Requirement
52
- requirements:
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ requirements:
53
54
  - - ">="
54
- - !ruby/object:Gem::Version
55
- version: "0"
56
- version:
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
57
  requirements: []
58
-
59
- rubyforge_project:
60
- rubygems_version: 1.0.1
58
+ rubygems_version: 3.3.5
61
59
  signing_key:
62
- specification_version: 2
60
+ specification_version: 4
63
61
  summary: A package for manipulating network addresses.
64
- test_files:
65
- - tests/tree_test.rb
66
- - tests/methods_test.rb
67
- - tests/cidr_test.rb
68
- - tests/eui_test.rb
62
+ test_files: []
data/README DELETED
@@ -1,17 +0,0 @@
1
- =Introduction
2
-
3
- NetAddr arose through my need as a network engineer for a
4
- back-end module that could easily handle such advanced tasks
5
- as automating the subnetting/supernetting
6
- of IP space, performing calculations on IP CIDR blocks, and other
7
- various items. At that time there were no modules that could
8
- do any of the things that I needed, so I set out to create my own.
9
- Since it has proven to be fairly useful to me, I have decided to share the
10
- code with the Ruby community.
11
-
12
- I have added things that I find immediately useful for me. I am
13
- open to suggestions if there is something that I could add to make
14
- your life easier.
15
-
16
- Dustin Spinhirne
17
-