net-ping 2.1.0-universal-linux

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: a34897bd48557b1d173cbd15c20144da54542cb45affb25acd19637df757aa59
4
+ data.tar.gz: fc020ad255eb094dd057f552e67c36f83a00e87aa88e12837ceb3f2bf1c8673b
5
+ SHA512:
6
+ metadata.gz: ad2042764756f73d521bded4f5c636037e23f84d8e1cb11f1b0a689cb5f05c925cdaf620cd5c8ce8bf6b9dc785fd21ad0330d1c73c896435d0ec65877fe8f7da
7
+ data.tar.gz: 5c45a5a55df135b3145e6aab5b3286c27d92487e9a5ac0329ada3641659acef7a8c69a4fb8f22ac2d04b6c68627a6335fd7c9ca2c681987c35713da78472cdbe
data/CHANGES ADDED
@@ -0,0 +1,28 @@
1
+ == 2.1.0 - 08-Aug-2026
2
+ * Publish platform-specific gem metadata so Linux installs cap2 and current
3
+ Windows RubyInstaller installs win32-security for ICMP support
4
+ [#44](https://github.com/eitoball/net-ping/pull/44).
5
+ * Fix the FreeBSD ping6 timeout option
6
+ [#43](https://github.com/eitoball/net-ping/pull/43).
7
+ * Add Ruby 4.0 to the test matrix and add win32ole as an explicit Windows
8
+ dependency, since it is no longer a default gem as of Ruby 4.0
9
+ [#41](https://github.com/eitoball/net-ping/pull/41).
10
+ * Move Net::Ping::VERSION into its own file so the gemspec version can no
11
+ longer drift out of sync with it
12
+ [#37](https://github.com/eitoball/net-ping/pull/37).
13
+ * Fix `Net::Ping::External#ping6` setting a spurious "undefined method '=~'
14
+ for false" exception on success
15
+ [#39](https://github.com/eitoball/net-ping/pull/39).
16
+
17
+ == 2.0.9 - 25-Jul-2026
18
+ * Add GitHub Actions CI [#33](https://github.com/eitoball/net-ping/pull/33)
19
+ and update its supported Ruby versions [#38](https://github.com/eitoball/net-ping/pull/38).
20
+ * Replace FakeWeb with WebMock and update the test suite for current Ruby
21
+ versions [#38](https://github.com/eitoball/net-ping/pull/38).
22
+ * Skip external-ping tests when the system ping command is unavailable
23
+ [#33](https://github.com/eitoball/net-ping/pull/33).
24
+ * Fix the macOS ping6 interval option
25
+ [#40](https://github.com/eitoball/net-ping/pull/40).
26
+ * Update README wording [#30](https://github.com/eitoball/net-ping/pull/30).
27
+ * Align Net::Ping::VERSION with the gem version
28
+ [#37](https://github.com/eitoball/net-ping/pull/37).
@@ -0,0 +1,354 @@
1
+ == 2.0.1 - 5-Aug-2015
2
+ * Fix broken gemspec. PR #9 by @shockwavenn
3
+
4
+ == 2.0.0 - 5-Aug-2015
5
+ * Add ability to ping ipv6 ip. PR #4 by @deuxclique
6
+ * Minor refactoring of the ping?/pingecho aliases, and fixed a timer glitch in Net::Ping::TCP. PR#7 by @epitron
7
+
8
+ == 1.7.7 - 22-Jan-2015
9
+ * Pull request #1 from Mike George. This fixes domains which have http in them.
10
+
11
+ == 1.7.6 - 13-Dec-2014
12
+ * Changed TCP handling yet again, as it was returning false positives. Thanks
13
+ go to Marcos Piccinini for the spot.
14
+
15
+ == 1.7.5 - 2-Nov-2014
16
+ * Added packet count and intervals for external pings. Thanks go to Jack Hayter
17
+ for the patch.
18
+ * No longer report closed TCP port as active. Thanks go to Joshua Yanovski for
19
+ the spot and patch.
20
+
21
+ == 1.7.4 - 16-Apr-2014
22
+ * Remove the Timeout block for the Ping::HTTP class because it wasn't working
23
+ with JRuby. Instead, we use the builtin open_timeout and read_timeout
24
+ accessors on the underlying http request. Thanks go to Ian Heggie for the
25
+ spot.
26
+ * The Ping::HTTP#ping? more robustly parses out the port from the uri argument
27
+ if provided. In addition, the default port is again set back to 80 as a
28
+ last resort in the constructor.
29
+ * Added timeout and port tests for the Ping::HTTP class.
30
+ * If a host is unreachable explicitly set the result to false regardless of
31
+ the actual exit status. This appears to only affect Windows 7 and later.
32
+ * Reinstated the Timeout block for the Ping::ICMP class. Without it, threaded
33
+ pings could end up in an infinite loop. Thanks go to muirmanders for the spot.
34
+
35
+ == 1.7.3 - 3-Apr-2014
36
+ * Removed the Timeout block for the Ping::External class as it apparently
37
+ hasn't worked with open3 for some time. Instead, it now uses your command
38
+ line ping's timeout switch. Thanks go to Andrea Bernardo Ciddio for the
39
+ spot.
40
+ * Made ICMP pings thread safe. I think.
41
+ * Removed a redundant Timeout block in the Ping::ICMP class.
42
+ * If an ICMP ping times out, the exception attribute is set to "timeout".
43
+ * Added explicit support for AIX for the Ping::External class.
44
+ * Bumped minimum required Ruby version to 1.9.3.
45
+
46
+ == 1.7.2 - 21-Jan-2014
47
+ * Fixed a bug in the Ping::HTTP constructor where it was not honoring the
48
+ port if provided as the second argument. Thanks go to Florian Anderiasch
49
+ for the spot.
50
+ * Removed win32-open3 require in the Ping::External class since it isn't
51
+ needed in Ruby 1.9.x or later.
52
+ * Refactored the Ping::External class so that it checks the exit status rather
53
+ than try to parse output. Thanks go to Miguel Tubia for the suggestion.
54
+ * Dropped explicit support for Windows XP.
55
+ * Removed reference to win32-open3 in README.
56
+
57
+ == 1.7.1 - 26-Sep-2013
58
+ * Fixed a bug in the Ping::TCP class where it could return nil instead
59
+ of false. Thanks go to Grandy Nguyen for the patch.
60
+
61
+ == 1.7.0 - 25-Aug-2013
62
+ * Now requires Ruby 1.9.x or later.
63
+ * Replaced the main ping code for the Ping::TCP class. The timeout module
64
+ really doesn't work very well with sockets, and so a raw socket approach
65
+ combined with IO.select is now used instead.
66
+ * Updates to the doc/ping.txt file.
67
+
68
+ == 1.6.2 - 8-Aug-2013
69
+ * Fixed a bug in the ICMP ping helper module. Thanks go to Yuichi
70
+ Tsunematsu for the spot.
71
+ * The win32-security library is not just a development dependency. Thanks
72
+ again go to Yuichi Tsunematsu for the spot.
73
+ * Updated the icmp ping tests.
74
+ * Updated the gemspec for MS Windows.
75
+
76
+ == 1.6.1 - 17-Jul-2013
77
+ * Automatically set the scheme to "http" if not present when performing
78
+ HTTP pings. See https://bugs.ruby-lang.org/issues/8645 for an issue
79
+ with the uri library that led to this change. Thanks go to Preston Lee
80
+ for the spot.
81
+ * Removed the windows/system_info dependency, since it added other
82
+ dependencies just to check the Windows version. Instead, I added a
83
+ helper file that adds some needed Windows functions using FFI.
84
+ * Added Rake as a development dependency and updated the Gemfile
85
+ source because Bundler. Thanks to Jean-Philippe Doyle for the patches.
86
+ * Added some warning text to the Net::Ping::External tests for users
87
+ who are using OpenDNS. In short, you will probably get test failures
88
+ and surprising true results for bad hosts.
89
+
90
+ == 1.6.0 - 19-Mar-2013
91
+ * Split out the ldap portion of the code into its own branch.
92
+ * Don't require resolv-replace on Ruby 1.9.3 or later.
93
+ * Now gets proxy information from the http_proxy, https_proxy, and
94
+ no_proxy environment variables and uses that when making requests.
95
+ Thanks go to Kevin Olbrich for the patch.
96
+
97
+ == 1.5.3 - 29-Feb-2012
98
+ * Removed the Windows::Console dependency and replaced it with FFI since there
99
+ were only two functions needed. This had the nice side effect of making it
100
+ work with JRuby, too.
101
+ * Minor cleanup on some multi-variable assignment.
102
+ * Fixed require statements and one test for 1.9.
103
+
104
+ == 1.5.2 - 4-Nov-2011
105
+ * The Net::Ping::HTTP class now defaults to using HEAD instead of GET
106
+ for its ping test. You can alter this via the get_request accessor.
107
+ Thanks got to Balazs Kutil for the patch.
108
+ * Added the ssl_verify_mode accessor to the Net::Ping::HTTP class, which
109
+ defaults to VERIFY_NONE. This fixes possible warnings resulting from
110
+ missing SSL certificates when using https. Thanks go to Balazs Kutil
111
+ for the patch.
112
+
113
+ == 1.5.1 - 15-Sep-2011
114
+ * Use RbConfig on Ruby 1.9 and later. Thanks go to Torsten Schönebaum
115
+ for the patch.
116
+
117
+ == 1.5.0 - 3-May-2011
118
+ * Added the Net::Ping::LDAP class which allows you to perform LDAP pings.
119
+ Thanks go to Paul Gallagher for adding this.
120
+ * The duration instance variable is now reset to nil on a failed ping. Again,
121
+ thanks go to Paul Gallagher.
122
+
123
+ == 1.4.1 - 17-Mar-2011
124
+ * Incorporated changes from Lukas Zapletal that alters the icmp tests to use
125
+ your localhost instead of going outside the network.
126
+ * The http tests were similarly modified courtesy of fakeweb, which is now a
127
+ development dependency. Again, change from Lukas Zapletal.
128
+ * The icmp tests were reworked for Windows Vista and later. This required the
129
+ addition of the win32-security library as a development dependency.
130
+ * The Net::Ping::WMI class is no longer skipped on require or in tests since
131
+ JRuby now supports win32ole.
132
+
133
+ == 1.4.0 - 14-Feb-2011
134
+ * Added the redirect_limit accessor for the Net::Ping::HTTP class. This caps
135
+ the number of redirects that are allowed before a ping is considered a
136
+ failure. The default is 5.
137
+ * Changed the way in which redirects are detected. Previously I was checking
138
+ against the response class, but decided this was unreliable. I now check the
139
+ response code itself. Any code in the 300 range is considered a redirect.
140
+ * The default port for the Net::Ping::HTTP class is no longer explicitly set
141
+ to 80, but instead uses the result of the URI.parse(uri).port method by
142
+ default. Note that you can still override the port if you explicitly provide
143
+ one in the constructor.
144
+ * The Net::Ping::HTTP class now handles https URI's properly. Note that you may
145
+ get a warning about peer certificates.
146
+
147
+ == 1.3.7 - 14-Oct-2010
148
+ * Wrapped the ICMP ping in a while loop that breaks on success to prevent
149
+ the ping from failing too early. Thanks go to Benny Holmgren for the
150
+ spot and the patch.
151
+
152
+ == 1.3.6 - 4-Sep-2010
153
+ * Fixed variable naming issue in Net::Ping::External. Thanks go to taw
154
+ for the spot.
155
+ * Added a default Rake task.
156
+ * Refactored the tests for Net::Ping::External to take advantage of the
157
+ features of test-unit 2.x.
158
+
159
+ == 1.3.5 - 3-Sep-2010
160
+ * Allow for custom user agent in Net::Ping::HTTP. Thanks go to Michael
161
+ Reinsch for the patch.
162
+
163
+ == 1.3.4 - 25-Jun-2010
164
+ * Fixed a dumb platform bug. Thanks go to Jason Frey for the spot.
165
+
166
+ == 1.3.3 - 21-Jun-2010
167
+ * Bug fixes for JRuby on MS Windows. The code now explicitly checks for JRuby
168
+ in a few places to ensure it doesn't try to load unsupported libraries
169
+ on MS Windows. Thanks go to Rob Schultz for the spot and some patches.
170
+ * The Net::Ping::HTTP class will no longer fail because a root URI
171
+ is missing a trailing slash. If the URI#path is empty, it now defaults
172
+ to the root path.
173
+ * The Rakefile tasks and naming were refactored.
174
+ * Some tests were refactored to take advantage of test-unit 2.x features,
175
+ as well as make them better and more descriptive in general.
176
+
177
+ == 1.3.2 - 21-Sep-2009
178
+ * Doing a 'require "net/ping"' was not automatically loading the
179
+ Net::Ping::WMI class on MS Windows. This has been fixed. Thanks go to
180
+ Joseph M. for the spot.
181
+ * Removed all $LOAD_PATH mangling for both the library and tests.
182
+ * Fixed a bug in the Net::Ping::HTTP class where a failed redirect did
183
+ not set the @exception and @warning instance variables properly.
184
+ * The PingStatus struct returned by Net::Ping::WMI is now frozen.
185
+ * The test-unit library was switched from a runtime dependency to a
186
+ development dependency.
187
+ * Added the :gem Rake task that builds a gem.
188
+ * Updated the :gem_install task to use the :gem task as a prerequisite.
189
+ * Updated the dependencies for MS Windows.
190
+ * The Rake test tasks are now more Rakish, e.g. test:tcp instead of test_tcp.
191
+ * Renamed example file names to avoid any potential confusion with actual
192
+ test files.
193
+
194
+ == 1.3.1 - 22-Jul-2009
195
+ * Removed class aliases, e.g. use Ping::External, not PingExternal.
196
+ * Minor code change to eliminate a warning that popped up in 1.9.x.
197
+ * The win32-open3 library is removed as a dependency for Ruby 1.9.x.
198
+ * Changed license to Artistic 2.0.
199
+ * Some gemspec and README updates.
200
+
201
+ == 1.3.0 - 19-May-2009
202
+ * Added the Ping::WMI class for MS Windows. This class encapsulates the
203
+ Win32_PingStatus WMI class. Unlike other ping methods, this one returns
204
+ a struct that contains various bits of information.
205
+ * The Net::Ping::External class now ensures that handles opened by the open3
206
+ call are closed. Thanks go to Nick S. Kanakakorn for the spot and a
207
+ preliminary patch.
208
+ * The Net::Ping::ICMP class now explicitly closes the socket if the call to
209
+ the Socket.pack_sockaddr_in method fails.
210
+ * Some documentation updates.
211
+
212
+ == 1.2.3 - 13-Jan-2008
213
+ * Fixed a bug in the checksum private method where it would die on odd data
214
+ sizes. Thanks go to Jake Douglas for the spot.
215
+ * A Socket.get_sockaddr_in call in the Ping::ICMP class is no longer included
216
+ as part of the overall ping time. Thanks go again to Jake Douglas for
217
+ the spot.
218
+ * Added data_size tests to the Ping::ICMP test suite.
219
+ * Renamed and updated the test files. The test-unit 2.x gem is now a
220
+ prerequisite as a result.
221
+
222
+ == 1.2.2 - 22-Jan-2008
223
+ * Bug fix for Ping::External where it was not honoring the timeout value.
224
+ Thanks go to Chris Morris for the spot and the patch.
225
+ * Bug fix for Ping::External where non-English output could cause false
226
+ positives on MS Windows Vista or later. This library now requires the
227
+ windows-pr library on MS Windows systems as a result.
228
+ * Added the Ping::UDP.service_check and Ping::UDP.service_check= class
229
+ methods. This method controls whether or not Errno::ECONNREFUSED or
230
+ Errno::ECONNRESET are considered successful pings or not.
231
+ * The Ping::HTTP class no longer uses the resolv-replace library on MS Windows
232
+ because it was (ironically) causing timeouts.
233
+ * Changed the Ping::TCP.econnrefused method to Ping::TCP.service_check. I
234
+ changed it because I now use a similar method in Ping::UDP, but that handles
235
+ more than Errno::ECONNREFUSED. An alias is provided to provide backwards
236
+ compatibility, but it is considered deprecated and will be removed in the
237
+ 1.3.0 release.
238
+ * Removed the install.rb file. The Rakefile now handles installation.
239
+
240
+ == 1.2.1 - 6-Apr-2007
241
+ * For the Ping::External class, if a ping attempt results in 100% packet loss
242
+ it is now considered a failed ping, regardless of whether or not an error
243
+ was sent to stdout.
244
+ * Fixed the Ping::External class for OS X.
245
+ * Added a Rakefile. Installation and testing should now be run via Rake tasks.
246
+ * Minor fix for the Ping::ICMP class where I had accidentally dup'd some
247
+ aliases. This was harmless, but did cause warnings with -w.
248
+
249
+ == 1.2.0 - 5-Dec-2006
250
+ * Internal reorganization - each class now lives in its own file.
251
+ * Added the Ping::ICMP class. Thanks go to Jos Backus for contributing a
252
+ large part of the code.
253
+ * The host argument is now optional in the constructor. You can now specify
254
+ it in the ping method instead. Note that it must be specified in one place
255
+ or the other.
256
+ * Each PingXXX class is now Ping::XXX instead. However, class name aliases
257
+ have been setup for backwards compatibility for now.
258
+ * The constructor for each Ping types now yields self.
259
+ * Added the pingecho alias for the ping method for each Ping type.
260
+ * Added the Ping::HTTP#follow_redirect accessor.
261
+ * The Ping::HTTP#ping method now honors the timeout value.
262
+ * The Ping::HTTP class now follows redirects automatically, though this is
263
+ configurable with the follow_redirect accessor.
264
+ * The Ping::TCP.ecr and Ping::TCP.ecr= methods are now true class method
265
+ aliases (they were just wrappers previously).
266
+ * The Ping::UDP class now enforces a 64 character limit on data that can be
267
+ sent on a udp ping.
268
+ * Updated the gemspec. Specifically, MS Windows now has a dependency on
269
+ the win32-open3 package.
270
+ * Added inline rdoc.
271
+
272
+ == 1.1.1 - 15-Jun-2006
273
+ * Fixed a bug in PingTCP (bad variable name). Thanks go to Anoop Chandran
274
+ for the spot.
275
+ * Minor variable name refactoring.
276
+ * Minor test updates.
277
+
278
+ == 1.1.0 - 17-Jul-2005
279
+ * Fixed a bug in the PingHTTP#ping method where I was accidentally passing
280
+ the timeout value instead of the port number as the third argument to
281
+ Net::HTTP.get_response.
282
+ * The PingHTTP.new method now has a default port of 80.
283
+ * Minor doc update for PingHTTP.new.
284
+
285
+ == 1.0.1 - 22-Jun-2005
286
+ * Bug fix for the install.rb file. The gem is unaffected.
287
+
288
+ == 1.0.0 - 14-Jun-2005
289
+ * Renamed project from net-pingsimple to just net-ping.
290
+ * Added a PingHTTP subclass.
291
+ * Moved project to RubyForge.
292
+ * Added a gemspec.
293
+
294
+ == 0.3.1 - 9-Apr-2005
295
+ * Updated PingExternal to use win32/open3 on Win32 platforms.
296
+ * Minor error handling change for the PingSimple.econnrefused= method. It now
297
+ raises an ArgumentError if any values other than true or false are passed.
298
+ * PingSimple#warning and PingSimple#exception are now read-only methods.
299
+ * The warning and exception attributes are now reset to nil between each call
300
+ to ping.
301
+ * The data and data= methods are now unique to the PingUDP class.
302
+ * The time and time= methods have been changed to timeout and timeout=,
303
+ respectively.
304
+ * Removed the pingsimple.rd and pingsimple.html files. The pingsimple.txt file
305
+ has been reorganized and is now rdoc friendly.
306
+ * Added a few sample programs under the 'examples' directory.
307
+ * Some minor test updates and changes.
308
+ * Removed the INSTALL file. That information is now in the README file.
309
+ * Now requires Ruby 1.8.0 or later.
310
+
311
+ == 0.3.0 - 12-Feb-2004
312
+ * Fixed ping string for PingExternal class based on platform. The old
313
+ string was really only good for Linux and *BSD.
314
+ * Added Win32 support (requires win32_popen package).
315
+ * Added warranty info.
316
+
317
+ == 0.2.3 - 12-Aug-2003
318
+ * Fixed a bug in PingExternal that could consume file descriptors if used in a loop
319
+ * Added some initialization to avoid -w warnings
320
+ * Removed VERSION() class method. Use the constant instead
321
+ * Modified test suite slightly
322
+ * Moved rd2 docs to doc directory
323
+
324
+ == 0.2.2 - 3-Apr-2003
325
+ * Fixed handling of stdout in PingExternal
326
+
327
+ == 0.2.1 - 27-Mar-2003
328
+ * Fixed major bug with PingExternal class with regards to down hosts
329
+ * Exceptions and warnings from PingExternal are now chomp'd
330
+ * Modified test suite
331
+ * Doc updates
332
+
333
+ == 0.2.0 - 14-Feb-2003
334
+ * The default behavior of PingTCP with regards to ECONNREFUSED is now
335
+ configurable
336
+ * Added a VERSION constant and method (to the base class)
337
+ * Added a test suite (for those with testunit installed)
338
+ * Doc changes, rearrangement and general cleanup
339
+ * Manifest is now MANIFEST
340
+ * Added an INSTALL file
341
+
342
+ == 0.1.0 - 9-Dec-2002
343
+ * Added ping? alias for ping method
344
+ * Warnings now handled separately
345
+ * Corrected a mis-named variable in Ping::External
346
+ * Fixed the install.rb file
347
+ * Updated and added docs
348
+ * Renamed tarball to net-pingsimple to reflect RAA naming convention
349
+
350
+ == 0.0.1a
351
+ * Did this release ever happen?
352
+
353
+ == 0.0.1
354
+ * Initial release.
data/CLAUDE.md ADDED
@@ -0,0 +1,89 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Development commands
6
+
7
+ Install dependencies:
8
+
9
+ ```sh
10
+ bundle install
11
+ ```
12
+
13
+ Run the default suite:
14
+
15
+ ```sh
16
+ bundle exec rake test
17
+ ```
18
+
19
+ Run one protocol-specific test file through its Rake task:
20
+
21
+ ```sh
22
+ bundle exec rake test:tcp
23
+ bundle exec rake test:http
24
+ bundle exec rake test:udp
25
+ bundle exec rake test:external
26
+ bundle exec rake test:icmp
27
+ bundle exec rake test:wmi
28
+ ```
29
+
30
+ There is no lint task or linter configuration. Build the gem with
31
+ `bundle exec rake gem:create`; `bundle exec rake gem:install` builds and
32
+ installs it locally.
33
+
34
+ `test:icmp` requires elevated privileges: root or `net_raw` capability on
35
+ Unix (checked via the `cap2` gem, falling back to a root check if `cap2`
36
+ isn't available), or elevated security on Windows (via `win32-security`).
37
+ The aggregate `test` task (`test/test_net_ping.rb`) only requires the ICMP
38
+ test file when that privilege check passes. External-ping tests invoke the
39
+ system `ping` command; HTTP tests use FakeWeb/webmock except the timeout
40
+ case, which makes a real network connection.
41
+
42
+ CI (`.github/workflows/test.yml`) runs `bundle exec rake test` on
43
+ ubuntu-latest and windows-latest across Ruby 2.7-3.4.
44
+
45
+ ## Architecture
46
+
47
+ This is a Ruby gem that exposes `Net::Ping` implementations for several
48
+ reachability mechanisms:
49
+
50
+ - `lib/net/ping/ping.rb` defines the abstract `Net::Ping` base class and its
51
+ shared state: `host`, `port`, `timeout`, `exception`, `warning`, and
52
+ `duration`.
53
+ - `lib/net/ping/{tcp,udp,icmp,external,http}.rb` implement socket, raw ICMP,
54
+ system-command, and HTTP pings. `wmi.rb` is loaded only on Windows
55
+ (`File::ALT_SEPARATOR` check).
56
+ - `lib/net/ping.rb` is the all-in-one entry point (`require 'net/ping'`);
57
+ requiring a protocol file directly (e.g. `require 'net/ping/tcp'`) loads
58
+ only that implementation and reduces memory footprint.
59
+ - Each protocol has a matching `test/test_net_ping_<protocol>.rb` file. The
60
+ aggregate `test/test_net_ping.rb` requires the supported protocol suites
61
+ based on the platform/privilege checks described above.
62
+
63
+ ## Repository-specific conventions
64
+
65
+ - A subclass `ping` method calls `super(host)` first. The base implementation
66
+ validates that a host is present and resets `@exception`, `@warning`, and
67
+ `@duration` for each attempt.
68
+ - `ping` returns a truthy success value or `false`; callers inspect
69
+ `exception` after failures rather than receive connection errors. Set
70
+ `duration` only after a successful ping and leave it `nil` on failure.
71
+ `ping?` is the boolean wrapper supplied by the base class (or an explicit
72
+ alias in `External`).
73
+ - TCP and UDP treat connection refusal according to their class-level
74
+ `service_check` setting (aliased as `econnrefused`/`ecr`). Keep the
75
+ Boolean-only setter validation and test both modes when changing that
76
+ behavior.
77
+ - Preserve platform branches: `External` maps `ping`/`ping6` options to each
78
+ OS's `ping`/`ping6` syntax (Linux, AIX, BSD/macOS, Solaris, HP-UX, Windows),
79
+ ICMP requires raw-socket privileges, and WMI is Windows-only.
80
+ - HTTP tests stub requests with FakeWeb/webmock and reset proxy environment
81
+ variables in `setup`; register any new HTTP cases rather than making
82
+ ordinary tests depend on live services.
83
+
84
+ ## Repository layout notes
85
+
86
+ - `.worktrees/` contains git worktrees for in-progress branches; treat them
87
+ as separate checkouts, not part of the main tree.
88
+ - `docs/superpowers/` holds plan/spec documents from prior sessions using the
89
+ `superpowers` skill set — reference material, not source.
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
3
+ gem 'win32-security', '>= 0.2.0' if Gem.win_platform?
4
+
5
+ # No longer a default gem as of Ruby 4.0. Used by the WMI ping class.
6
+ gem 'win32ole', '>= 1.8.8' if Gem.win_platform?
7
+
8
+ gem 'cap2', '>= 0.2.2' if RUBY_PLATFORM =~ /linux/i
data/Gemfile.lock ADDED
@@ -0,0 +1,53 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ net-ping (2.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ addressable (2.9.0)
10
+ public_suffix (>= 2.0.2, < 8.0)
11
+ bigdecimal (4.1.2)
12
+ byebug (13.0.0)
13
+ reline (>= 0.6.0)
14
+ coderay (1.1.3)
15
+ crack (1.0.1)
16
+ bigdecimal
17
+ rexml
18
+ hashdiff (1.2.1)
19
+ io-console (0.8.2)
20
+ method_source (1.1.0)
21
+ power_assert (3.0.1)
22
+ pry (0.16.0)
23
+ coderay (~> 1.1)
24
+ method_source (~> 1.0)
25
+ reline (>= 0.6.0)
26
+ pry-byebug (3.12.0)
27
+ byebug (~> 13.0)
28
+ pry (>= 0.13, < 0.17)
29
+ public_suffix (7.0.5)
30
+ rake (13.4.2)
31
+ reline (0.6.3)
32
+ io-console (~> 0.5)
33
+ rexml (3.4.4)
34
+ test-unit (3.7.8)
35
+ power_assert
36
+ webmock (3.26.2)
37
+ addressable (>= 2.8.0)
38
+ crack (>= 0.3.2)
39
+ hashdiff (>= 0.4.0, < 2.0.0)
40
+
41
+ PLATFORMS
42
+ ruby
43
+ x86_64-darwin-24
44
+
45
+ DEPENDENCIES
46
+ net-ping!
47
+ pry-byebug
48
+ rake
49
+ test-unit
50
+ webmock
51
+
52
+ BUNDLED WITH
53
+ 2.5.22
data/MANIFEST ADDED
@@ -0,0 +1,25 @@
1
+ * CHANGES
2
+ * Gemfile
3
+ * MANIFEST
4
+ * Rakefile
5
+ * README
6
+ * net-ping.gemspec
7
+ * examples/example_pingexternal.rb
8
+ * examples/example_pinghttp.rb
9
+ * examples/example_pingtcp.rb
10
+ * examples/example_pingudp.rb
11
+ * lib/net/ping.rb
12
+ * lib/net/ping/icmp.rb
13
+ * lib/net/ping/tcp.rb
14
+ * lib/net/ping/udp.rb
15
+ * lib/net/ping/wmi.rb
16
+ * lib/net/ping/http.rb
17
+ * lib/net/ping/external.rb
18
+ * test/test_net_ping_external.rb
19
+ * test/test_net_ping_http.rb
20
+ * test/test_net_ping_icmp.rb
21
+ * test/test_net_ping_ldap.rb
22
+ * test/test_net_ping_tcp.rb
23
+ * test/test_net_ping_udp.rb
24
+ * test/test_net_ping_wmi.rb
25
+ * test/test_net_ping.rb
data/README.md ADDED
@@ -0,0 +1,65 @@
1
+ # net-ping
2
+ A collection of classes that provide different ways to ping computers.
3
+
4
+ ## Prerequisites
5
+ * ffi
6
+ * win32-security (installed from the Windows gem artifact)
7
+ * win32ole (installed from the Windows gem artifact)
8
+ * cap2 (installed from the Linux gem artifact)
9
+ * webmock (test only)
10
+ * test-unit (test only)
11
+
12
+ Ruby users should use Ruby 1.9.3 or later.
13
+ JRuby users should use JRuby 1.6.7 or later.
14
+
15
+ ## Installation
16
+ ```gem install net-ping```
17
+
18
+ ## Notes
19
+ Please read the documentation under the 'doc' directory. Especially pay
20
+ attention to the documentation pertaining to ECONNREFUSED and TCP pings.
21
+
22
+ Also note the documentation regarding down hosts.
23
+
24
+ ## How to require net-ping
25
+ You can do either this:
26
+
27
+ ```require 'net/ping'```
28
+
29
+ In which case you will get Net::Ping and all of its subclasses. Or,
30
+ you can load individual subclasses like this:
31
+
32
+ ```require 'net/ping/tcp'```
33
+
34
+ The former has the advantage of being easier to remember and all inclusive,
35
+ not to mention backwards compatible. The latter has the advantage of
36
+ reducing your memory footprint.
37
+
38
+ ## Known Issues
39
+ Older versions of Ruby 1.9.x may not work with UDP pings.
40
+
41
+ Older versions of JRuby will return false positives in UDP pings
42
+ because of an incorrect error class being raised. See JRuby-4896.
43
+
44
+ JRuby 1.6.7 or later is required for external pings because of a bug
45
+ in earlier versions with open3 and stream handling.
46
+
47
+ ICMP pings will not work with JRuby without some sort of third-party
48
+ library support for raw sockets in Java, such as RockSaw.
49
+
50
+ ## License
51
+ Artistic 2.0
52
+
53
+ ## Contributions
54
+ Although this library is free, please consider having your company
55
+ set up a gittip if used by your company professionally.
56
+
57
+ http://www.gittip.com/djberg96/
58
+
59
+ ## More documentation
60
+ If you installed this library via Rubygems, you can view the inline
61
+ documentation via ri or fire up 'gem server', and point your browser at
62
+ http://localhost:8808.
63
+
64
+ ## Author
65
+ Daniel J. Berger