zyre 0.4.1 → 0.6.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 +4 -4
- checksums.yaml.gz.sig +1 -3
- data/History.md +15 -0
- data/LICENSE.txt +1 -1
- data/README.md +26 -2
- data/ext/zyre_ext/event.c +1 -1
- data/ext/zyre_ext/extconf.rb +7 -0
- data/ext/zyre_ext/zyre_ext.c +90 -1
- data/ext/zyre_ext/zyre_ext.h +1 -0
- data/lib/observability/instrumentation/zyre.rb +0 -1
- data/lib/zyre/cert.rb +0 -1
- data/lib/zyre/event/enter.rb +0 -1
- data/lib/zyre/event/evasive.rb +0 -1
- data/lib/zyre/event/exit.rb +0 -2
- data/lib/zyre/event/join.rb +0 -1
- data/lib/zyre/event/leader.rb +0 -1
- data/lib/zyre/event/leave.rb +0 -1
- data/lib/zyre/event/shout.rb +0 -1
- data/lib/zyre/event/silent.rb +1 -2
- data/lib/zyre/event/stop.rb +0 -1
- data/lib/zyre/event/whisper.rb +0 -1
- data/lib/zyre/event.rb +0 -1
- data/lib/zyre/node.rb +0 -1
- data/lib/zyre/poller.rb +0 -1
- data/lib/zyre/testing.rb +0 -1
- data/lib/zyre.rb +1 -2
- data/spec/spec_helper.rb +1 -2
- data/spec/zyre/event_spec.rb +120 -0
- data/spec/zyre/node_spec.rb +2 -2
- data/spec/zyre_spec.rb +64 -1
- data.tar.gz.sig +0 -0
- metadata +23 -23
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dec6f1a89c5683ac88460dc3cc156b79156e318052a7ea81494336e0686ec522
|
4
|
+
data.tar.gz: f1fd6cb1ba63bf1ea8054823faa26afaa0646f063da940ee3e6e1e12ead7161a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f98b88495f675531470868a0c4e7f7ec94970fd3e9415d771a3ad0d1c27bea34c7badd3e7e3a084e147611871fc45439bbb495abda72f5a6962eaf11beeb7992
|
7
|
+
data.tar.gz: a442f583bd320bf642794d6b0136057473d8a9abafef5fd1570213ee4d564dc4aa1bca48c4f3d36696c534cdba51b0ba645c68926b6f2eea072bf21a0623e818
|
checksums.yaml.gz.sig
CHANGED
@@ -1,3 +1 @@
|
|
1
|
-
|
2
|
-
�z1�)ȍ�\�f�@^��a�u���.D��̅�\�v;%��0��I���-Y;&��YN�W��(�{g���X��>�u"�5A����:�Ļ� <p�]V����D��P��t��rG���㾎?DOx�uJp��ɒ+M�~�m��K�؈�9�t{�GԾ��V����DNY�����p���}�b�l"Y�tk���*�p\qi���a͢�^fsg�zǒ�A��(���ye芣�]�9��k6)gM*=��&�אfaG�[F�]���,�z��[9V��`��ZI���?�,�?o%�M��ϥދ�J)��W$i���XL�
|
3
|
-
n3��K�/DXZԚ�B8��ۤ����G4>4s���[Q����u��)r�;ձ�]�=�G�N
|
1
|
+
\���wO):��"Y�Pw)}f(q��N�
|
data/History.md
CHANGED
@@ -1,6 +1,21 @@
|
|
1
1
|
# Release History for zyre
|
2
2
|
|
3
3
|
---
|
4
|
+
|
5
|
+
## v0.6.0 [2023-08-08] Michael Granger <ged@faeriemud.org>
|
6
|
+
|
7
|
+
Improvements:
|
8
|
+
|
9
|
+
- Reset the zyre interface list when it's fetched
|
10
|
+
|
11
|
+
|
12
|
+
## v0.5.0 [2023-02-14] Michael Granger <ged@faeriemud.org>
|
13
|
+
|
14
|
+
Improvements:
|
15
|
+
|
16
|
+
- Add Z85-encoding and -decoding.
|
17
|
+
|
18
|
+
|
4
19
|
## v0.4.1 [2021-03-16] Michael Granger <ged@faeriemud.org>
|
5
20
|
|
6
21
|
Bugfixes:
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -28,7 +28,7 @@ This example joins the Zyre network and dumps messages it sees in the 'global' g
|
|
28
28
|
node = Zyre::Node.new
|
29
29
|
node.join( 'global' )
|
30
30
|
node.start
|
31
|
-
|
31
|
+
|
32
32
|
node.each_event do |event|
|
33
33
|
event.print
|
34
34
|
end
|
@@ -135,7 +135,31 @@ development.
|
|
135
135
|
|
136
136
|
## License
|
137
137
|
|
138
|
-
|
138
|
+
This project includes code adapted from the ZeroMQ RFC project, used under
|
139
|
+
the following license:
|
140
|
+
|
141
|
+
> Copyright (c) 2010-2013 iMatix Corporation and Contributors
|
142
|
+
>
|
143
|
+
> Permission is hereby granted, free of charge, to any person obtaining a copy of
|
144
|
+
> this software and associated documentation files (the "Software"), to deal in
|
145
|
+
> the Software without restriction, including without limitation the rights to
|
146
|
+
> use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
147
|
+
> the Software, and to permit persons to whom the Software is furnished to do so,
|
148
|
+
> subject to the following conditions:
|
149
|
+
>
|
150
|
+
> The above copyright notice and this permission notice shall be included in all
|
151
|
+
> copies or substantial portions of the Software.
|
152
|
+
>
|
153
|
+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
154
|
+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
155
|
+
> FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
156
|
+
> COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
157
|
+
> IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
158
|
+
> CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
159
|
+
|
160
|
+
Everything else is:
|
161
|
+
|
162
|
+
Copyright (c) 2020-2023, Ravn Inc
|
139
163
|
All rights reserved.
|
140
164
|
|
141
165
|
Redistribution and use in source and binary forms, with or without
|
data/ext/zyre_ext/event.c
CHANGED
@@ -175,7 +175,7 @@ rzyre_zhash_from_rhash( VALUE ruby_hash )
|
|
175
175
|
|
176
176
|
/*
|
177
177
|
* call-seq:
|
178
|
-
* Zyre::Event.
|
178
|
+
* Zyre::Event.synthesize( type, peer_uuid, **fields ) -> event
|
179
179
|
*
|
180
180
|
* Create an event in memory without going through a Zyre::Node. This is useful for
|
181
181
|
* testing.
|
data/ext/zyre_ext/extconf.rb
CHANGED
@@ -9,11 +9,15 @@ have_library( 'zyre' ) or
|
|
9
9
|
abort "No zyre library!"
|
10
10
|
have_library( 'czmq' ) or
|
11
11
|
abort "No czmq library!"
|
12
|
+
have_library( 'zmq' ) or
|
13
|
+
abort "No zmq library!"
|
12
14
|
|
13
15
|
have_header( 'zyre.h' ) or
|
14
16
|
abort "No zyre.h header!"
|
15
17
|
have_header( 'czmq.h' ) or
|
16
18
|
abort "No czmq.h header!"
|
19
|
+
have_header( 'zmq.h' ) or
|
20
|
+
abort "No zmq.h header!"
|
17
21
|
have_header( 'ruby/thread.h' ) or
|
18
22
|
abort "Your Ruby is too old!"
|
19
23
|
|
@@ -23,6 +27,9 @@ have_func( 'zyre_set_beacon_peer_port', 'zyre.h' )
|
|
23
27
|
have_func( 'zyre_set_contest_in_group', 'zyre.h' )
|
24
28
|
have_func( 'zyre_set_zcert', 'zyre.h' )
|
25
29
|
|
30
|
+
have_func( 'zmq_z85_encode', 'zmq.h' )
|
31
|
+
have_func( 'zmq_z85_decode', 'zmq.h' )
|
32
|
+
|
26
33
|
have_func( 'zcert_unset_meta', 'czmq.h' )
|
27
34
|
|
28
35
|
create_header()
|
data/ext/zyre_ext/zyre_ext.c
CHANGED
@@ -5,6 +5,12 @@
|
|
5
5
|
* Authors:
|
6
6
|
* * Michael Granger <ged@FaerieMUD.org>
|
7
7
|
*
|
8
|
+
* Refs:
|
9
|
+
* - https://github.com/zeromq/zyre#api-summary
|
10
|
+
* - http://api.zeromq.org/master:zmq-z85-decode
|
11
|
+
* - http://api.zeromq.org/master:zmq-z85-encode
|
12
|
+
*
|
13
|
+
*
|
8
14
|
*/
|
9
15
|
|
10
16
|
#include "zyre_ext.h"
|
@@ -148,7 +154,7 @@ rzyre_s_zyre_version()
|
|
148
154
|
|
149
155
|
version = zyre_version();
|
150
156
|
|
151
|
-
return
|
157
|
+
return LONG2NUM( version );
|
152
158
|
}
|
153
159
|
|
154
160
|
|
@@ -170,7 +176,10 @@ rzyre_s_zyre_version()
|
|
170
176
|
static VALUE
|
171
177
|
rzyre_s_interfaces( VALUE module )
|
172
178
|
{
|
179
|
+
|
173
180
|
ziflist_t *iflist = ziflist_new();
|
181
|
+
ziflist_reload( iflist );
|
182
|
+
|
174
183
|
const VALUE rval = rb_hash_new();
|
175
184
|
const char *iface = ziflist_first( iflist );
|
176
185
|
|
@@ -180,6 +189,7 @@ rzyre_s_interfaces( VALUE module )
|
|
180
189
|
const char *netmask_s = ziflist_netmask( iflist );
|
181
190
|
const VALUE info_hash = rb_hash_new();
|
182
191
|
|
192
|
+
rzyre_log( "debug", "Getting info for %s", address_s );
|
183
193
|
rb_hash_aset( info_hash, ID2SYM(rb_intern("address")), rb_usascii_str_new_cstr(address_s) );
|
184
194
|
rb_hash_aset( info_hash, ID2SYM(rb_intern("broadcast")), rb_usascii_str_new_cstr(broadcast_s) );
|
185
195
|
rb_hash_aset( info_hash, ID2SYM(rb_intern("netmask")), rb_usascii_str_new_cstr(netmask_s) );
|
@@ -211,6 +221,77 @@ rzyre_s_disable_zsys_handler( VALUE module )
|
|
211
221
|
}
|
212
222
|
|
213
223
|
|
224
|
+
/*
|
225
|
+
* call-seq:
|
226
|
+
* Zyre.z85_encode( data ) -> string
|
227
|
+
*
|
228
|
+
* Return the specified binary +data+ as a Z85-encoded binary string. The size of the data must
|
229
|
+
* be divisible by 4. If there is a problem encoding the data, returns +nil+.
|
230
|
+
*
|
231
|
+
*/
|
232
|
+
static VALUE
|
233
|
+
rzyre_s_z85_encode( VALUE module, VALUE data )
|
234
|
+
{
|
235
|
+
#if HAVE_ZMQ_Z85_ENCODE
|
236
|
+
const char *data_str = StringValuePtr( data );
|
237
|
+
const long len = RSTRING_LEN( data );
|
238
|
+
const long res_len = (len * 1.25) + 1;
|
239
|
+
char *encoded = NULL;
|
240
|
+
VALUE result = Qnil;
|
241
|
+
|
242
|
+
if ( len % 4 ) return Qnil;
|
243
|
+
|
244
|
+
encoded = RB_ZALLOC_N( char, res_len );
|
245
|
+
zmq_z85_encode( encoded, (unsigned char *)data_str, len );
|
246
|
+
|
247
|
+
if ( encoded != NULL ) {
|
248
|
+
result = rb_usascii_str_new( encoded, res_len - 1 );
|
249
|
+
}
|
250
|
+
|
251
|
+
ruby_xfree( encoded );
|
252
|
+
|
253
|
+
return result;
|
254
|
+
#else
|
255
|
+
rb_notimplement();
|
256
|
+
#endif
|
257
|
+
}
|
258
|
+
|
259
|
+
|
260
|
+
/*
|
261
|
+
* call-seq:
|
262
|
+
* Zyre.z85_decode( string ) -> data
|
263
|
+
*
|
264
|
+
* Return the data decoded from the specified Z85-encoded binary +string+. If there is a
|
265
|
+
* problem decoding the string, returns +nil+.
|
266
|
+
*
|
267
|
+
*/
|
268
|
+
static VALUE
|
269
|
+
rzyre_s_z85_decode( VALUE module, VALUE string )
|
270
|
+
{
|
271
|
+
#if HAVE_ZMQ_Z85_DECODE
|
272
|
+
const char *data_str = StringValueCStr( string );
|
273
|
+
const long len = RSTRING_LEN( string );
|
274
|
+
const long res_len = (len * 0.8) + 1;
|
275
|
+
char *decoded = NULL;
|
276
|
+
VALUE result = Qnil;
|
277
|
+
|
278
|
+
if ( len % 5 ) return Qnil;
|
279
|
+
|
280
|
+
decoded = RB_ZALLOC_N( char, res_len );
|
281
|
+
zmq_z85_decode( (unsigned char *)decoded, data_str );
|
282
|
+
|
283
|
+
if ( decoded != NULL ) {
|
284
|
+
result = rb_str_new( decoded, res_len - 1 );
|
285
|
+
}
|
286
|
+
|
287
|
+
ruby_xfree( decoded );
|
288
|
+
|
289
|
+
return result;
|
290
|
+
#else
|
291
|
+
rb_notimplement();
|
292
|
+
#endif
|
293
|
+
}
|
294
|
+
|
214
295
|
|
215
296
|
static VALUE
|
216
297
|
rzyre_s_start_authenticator( VALUE module )
|
@@ -225,6 +306,11 @@ rzyre_s_start_authenticator( VALUE module )
|
|
225
306
|
void
|
226
307
|
Init_zyre_ext()
|
227
308
|
{
|
309
|
+
/*
|
310
|
+
* Document-module: Zyre
|
311
|
+
*
|
312
|
+
* The top level namespace for Zyre classes.
|
313
|
+
*/
|
228
314
|
rzyre_mZyre = rb_define_module( "Zyre" );
|
229
315
|
|
230
316
|
#ifdef CZMQ_BUILD_DRAFT_API
|
@@ -242,6 +328,9 @@ Init_zyre_ext()
|
|
242
328
|
rb_define_singleton_method( rzyre_mZyre, "interfaces", rzyre_s_interfaces, 0 );
|
243
329
|
rb_define_singleton_method( rzyre_mZyre, "disable_zsys_handler", rzyre_s_disable_zsys_handler, 0 );
|
244
330
|
|
331
|
+
rb_define_singleton_method( rzyre_mZyre, "z85_encode", rzyre_s_z85_encode, 1 );
|
332
|
+
rb_define_singleton_method( rzyre_mZyre, "z85_decode", rzyre_s_z85_decode, 1 );
|
333
|
+
|
245
334
|
// :TODO: Allow for startup of the zauth agent. This will require enough of a
|
246
335
|
// subset of CZMQ that I hesitate to do it in Zyre. Maybe better to just write a
|
247
336
|
// decent CZMQ library instead?
|
data/ext/zyre_ext/zyre_ext.h
CHANGED
data/lib/zyre/cert.rb
CHANGED
data/lib/zyre/event/enter.rb
CHANGED
data/lib/zyre/event/evasive.rb
CHANGED
data/lib/zyre/event/exit.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
# -*- ruby -*-
|
2
|
-
# frozen_string_literal: true
|
3
2
|
|
4
3
|
require 'zyre/event' unless defined?( Zyre::Event )
|
5
4
|
|
@@ -11,7 +10,6 @@ class Zyre::Event::Exit < Zyre::Event
|
|
11
10
|
return "%s (%s) has left the network" % [
|
12
11
|
self.peer_uuid,
|
13
12
|
self.peer_name,
|
14
|
-
self.headers,
|
15
13
|
]
|
16
14
|
end
|
17
15
|
|
data/lib/zyre/event/join.rb
CHANGED
data/lib/zyre/event/leader.rb
CHANGED
data/lib/zyre/event/leave.rb
CHANGED
data/lib/zyre/event/shout.rb
CHANGED
data/lib/zyre/event/silent.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
# -*- ruby -*-
|
2
|
-
# frozen_string_literal: true
|
3
2
|
|
4
3
|
require 'zyre/event' unless defined?( Zyre::Event )
|
5
4
|
|
@@ -8,7 +7,7 @@ class Zyre::Event::Silent < Zyre::Event
|
|
8
7
|
|
9
8
|
### Provide the details of the inspect message.
|
10
9
|
def inspect_details
|
11
|
-
return "%s (%s) isn't responding to pings" % [
|
10
|
+
return "%s %s (%s) isn't responding to pings" % [
|
12
11
|
self.peer_uuid,
|
13
12
|
self.peer_name,
|
14
13
|
self.headers,
|
data/lib/zyre/event/stop.rb
CHANGED
data/lib/zyre/event/whisper.rb
CHANGED
data/lib/zyre/event.rb
CHANGED
data/lib/zyre/node.rb
CHANGED
data/lib/zyre/poller.rb
CHANGED
data/lib/zyre/testing.rb
CHANGED
data/lib/zyre.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
# -*- ruby -*-
|
2
|
-
# frozen_string_literal: true
|
3
2
|
|
4
3
|
if ENV['COVERAGE'] || ENV['CI']
|
5
4
|
require 'simplecov'
|
@@ -49,7 +48,7 @@ RSpec.configure do |config|
|
|
49
48
|
config.profile_examples = 5
|
50
49
|
config.run_all_when_everything_filtered = true
|
51
50
|
config.shared_context_metadata_behavior = :apply_to_host_groups
|
52
|
-
|
51
|
+
config.warnings = true
|
53
52
|
|
54
53
|
config.before( :suite ) do
|
55
54
|
Zyre::Testing.check_fdmax
|
data/spec/zyre/event_spec.rb
CHANGED
@@ -199,5 +199,125 @@ RSpec.describe( Zyre::Event ) do
|
|
199
199
|
|
200
200
|
end
|
201
201
|
|
202
|
+
|
203
|
+
|
204
|
+
describe "inspect output" do
|
205
|
+
|
206
|
+
let( :peer_uuid ) { '8D9B6F67-2B40-4E56-B352-39029045B568' }
|
207
|
+
let( :peer_name ) { 'node1' }
|
208
|
+
let( :peer_addr ) { 'in-proc:/synthesized' }
|
209
|
+
|
210
|
+
|
211
|
+
it "has useful inspect output for ENTER events" do
|
212
|
+
event = described_class.synthesize( :ENTER,
|
213
|
+
peer_uuid, peer_name: peer_name, peer_addr: peer_addr,
|
214
|
+
headers: {'Content-type' => 'application/msgpack'} )
|
215
|
+
|
216
|
+
expect( event.inspect ).to include( peer_uuid )
|
217
|
+
expect( event.inspect ).to include( peer_name )
|
218
|
+
expect( event.inspect ).to include( peer_addr )
|
219
|
+
expect( event.inspect ).to match( /has entered the network/i )
|
220
|
+
expect( event.inspect ).to match( /Content-type/i )
|
221
|
+
expect( event.inspect ).to match( %r{application/msgpack}i )
|
222
|
+
end
|
223
|
+
|
224
|
+
|
225
|
+
it "has useful inspect output for EVASIVE events" do
|
226
|
+
event = described_class.synthesize( :EVASIVE, peer_uuid, peer_name: peer_name )
|
227
|
+
|
228
|
+
expect( event.inspect ).to include( peer_uuid )
|
229
|
+
expect( event.inspect ).to include( peer_name )
|
230
|
+
expect( event.inspect ).to match( /is being evasive/i )
|
231
|
+
end
|
232
|
+
|
233
|
+
|
234
|
+
it "has useful inspect output for EXIT events" do
|
235
|
+
event = described_class.synthesize( :EXIT, peer_uuid, peer_name: peer_name )
|
236
|
+
|
237
|
+
expect( event.inspect ).to include( peer_uuid )
|
238
|
+
expect( event.inspect ).to include( peer_name )
|
239
|
+
expect( event.inspect ).to match( /has left the network/i )
|
240
|
+
end
|
241
|
+
|
242
|
+
|
243
|
+
it "has useful inspect output for JOIN events" do
|
244
|
+
event = described_class.synthesize( :JOIN,
|
245
|
+
peer_uuid, group: 'CHANNEL1', peer_name: peer_name )
|
246
|
+
|
247
|
+
expect( event.inspect ).to include( peer_uuid )
|
248
|
+
expect( event.inspect ).to include( peer_name )
|
249
|
+
expect( event.inspect ).to include( 'CHANNEL1' )
|
250
|
+
expect( event.inspect ).to match( /joined/i )
|
251
|
+
end
|
252
|
+
|
253
|
+
|
254
|
+
it "has useful inspect output for LEADER events" do
|
255
|
+
event = described_class.synthesize( :LEADER,
|
256
|
+
peer_uuid, group: 'CHANNEL1', peer_name: peer_name )
|
257
|
+
|
258
|
+
expect( event.inspect ).to include( peer_uuid )
|
259
|
+
expect( event.inspect ).to include( peer_name )
|
260
|
+
expect( event.inspect ).to include( 'CHANNEL1' )
|
261
|
+
expect( event.inspect ).to match( /has been elected leader of/i )
|
262
|
+
end
|
263
|
+
|
264
|
+
|
265
|
+
it "has useful inspect output for LEAVE events" do
|
266
|
+
event = described_class.synthesize( :LEAVE,
|
267
|
+
peer_uuid, group: 'CHANNEL1', peer_name: peer_name )
|
268
|
+
|
269
|
+
expect( event.inspect ).to include( peer_uuid )
|
270
|
+
expect( event.inspect ).to include( peer_name )
|
271
|
+
expect( event.inspect ).to include( 'CHANNEL1' )
|
272
|
+
expect( event.inspect ).to match( /left/i )
|
273
|
+
end
|
274
|
+
|
275
|
+
|
276
|
+
it "has useful inspect output for SHOUT events" do
|
277
|
+
message = 'Hey guys, who wants to play Valheim?'
|
278
|
+
event = described_class.synthesize( :SHOUT,
|
279
|
+
peer_uuid, group: 'CHANNEL1', msg: message,
|
280
|
+
peer_name: peer_name )
|
281
|
+
|
282
|
+
expect( event.inspect ).to include( peer_uuid )
|
283
|
+
expect( event.inspect ).to include( peer_name )
|
284
|
+
expect( event.inspect ).to include( 'CHANNEL1' )
|
285
|
+
expect( event.inspect ).to match( / on /i )
|
286
|
+
expect( event.inspect ).to include( message )
|
287
|
+
end
|
288
|
+
|
289
|
+
|
290
|
+
it "has useful inspect output for SILENT events" do
|
291
|
+
event = described_class.synthesize( :SILENT, peer_uuid, peer_name: peer_name )
|
292
|
+
|
293
|
+
expect( event.inspect ).to include( peer_uuid )
|
294
|
+
expect( event.inspect ).to include( peer_name )
|
295
|
+
expect( event.inspect ).to match( /isn't responding to pings/i )
|
296
|
+
end
|
297
|
+
|
298
|
+
|
299
|
+
it "has useful inspect output for STOP events" do
|
300
|
+
event = described_class.synthesize( :STOP, peer_uuid )
|
301
|
+
|
302
|
+
expect( event.inspect ).to match( /node is stopping/i )
|
303
|
+
end
|
304
|
+
|
305
|
+
|
306
|
+
it "has useful inspect output for WHISPER events" do
|
307
|
+
target = SecureRandom.uuid
|
308
|
+
message = "Hey #{target}, want to play Valheim?"
|
309
|
+
event = described_class.synthesize( :WHISPER,
|
310
|
+
peer_uuid, msg: message,
|
311
|
+
peer_name: peer_name )
|
312
|
+
|
313
|
+
expect( event.inspect ).to include( peer_uuid )
|
314
|
+
expect( event.inspect ).to include( peer_name )
|
315
|
+
expect( event.inspect ).to match( /whisper from/i )
|
316
|
+
expect( event.inspect ).to include( message )
|
317
|
+
end
|
318
|
+
|
319
|
+
end
|
320
|
+
|
321
|
+
|
202
322
|
end
|
203
323
|
|
data/spec/zyre/node_spec.rb
CHANGED
@@ -44,7 +44,7 @@ RSpec.describe( Zyre::Node ) do
|
|
44
44
|
|
45
45
|
|
46
46
|
it "can set headers" do
|
47
|
-
|
47
|
+
_node1 = started_node do |n|
|
48
48
|
n.set_header( 'Protocol-version', '2' )
|
49
49
|
end
|
50
50
|
node2 = started_node
|
@@ -56,7 +56,7 @@ RSpec.describe( Zyre::Node ) do
|
|
56
56
|
|
57
57
|
|
58
58
|
it "can set headers from a hash" do
|
59
|
-
|
59
|
+
_node1 = started_node do |n|
|
60
60
|
n.headers = {
|
61
61
|
protocol_version: 2,
|
62
62
|
content_type: 'application/messagepack'
|
data/spec/zyre_spec.rb
CHANGED
@@ -5,7 +5,7 @@ require_relative 'spec_helper'
|
|
5
5
|
require 'zyre'
|
6
6
|
|
7
7
|
|
8
|
-
RSpec.describe Zyre do
|
8
|
+
RSpec.describe( Zyre ) do
|
9
9
|
|
10
10
|
|
11
11
|
# Pattern for matching IPv4 addresses
|
@@ -63,5 +63,68 @@ RSpec.describe Zyre do
|
|
63
63
|
expect( described_class.has_draft_apis? ).to eq( true ).or( eq false )
|
64
64
|
end
|
65
65
|
|
66
|
+
|
67
|
+
describe "Z85 encoding/decoding" do
|
68
|
+
|
69
|
+
# From the 32/Z85 reference code:
|
70
|
+
# https://github.com/zeromq/rfc/blob/master/src/spec_32.c
|
71
|
+
let( :test_data_1 ) do
|
72
|
+
[0x86, 0x4F, 0xD2, 0x6F, 0xB5, 0x59, 0xF7, 0x5B].pack('C*')
|
73
|
+
end
|
74
|
+
let( :test_data_2 ) do
|
75
|
+
[
|
76
|
+
0x8E, 0x0B, 0xDD, 0x69, 0x76, 0x28, 0xB9, 0x1D,
|
77
|
+
0x8F, 0x24, 0x55, 0x87, 0xEE, 0x95, 0xC5, 0xB0,
|
78
|
+
0x4D, 0x48, 0x96, 0x3F, 0x79, 0x25, 0x98, 0x77,
|
79
|
+
0xB4, 0x9C, 0xD9, 0x06, 0x3A, 0xEA, 0xD3, 0xB7
|
80
|
+
].pack('C*')
|
81
|
+
end
|
82
|
+
|
83
|
+
|
84
|
+
it "can round-trip an empty string" do
|
85
|
+
result = described_class.z85_decode( described_class.z85_encode(''.b) )
|
86
|
+
expect( result ).to eq( ''.b )
|
87
|
+
end
|
88
|
+
|
89
|
+
|
90
|
+
it "fails if the data to be encoded is not bounded at 4 bytes" do
|
91
|
+
expect( described_class.z85_encode(test_data_1[0, 3]) ).to be_nil
|
92
|
+
end
|
93
|
+
|
94
|
+
|
95
|
+
it "can round-trip 4-byte-bounded data" do
|
96
|
+
encoded = described_class.z85_encode( test_data_1 )
|
97
|
+
|
98
|
+
expect( encoded ).to eq( 'HelloWorld' )
|
99
|
+
expect( encoded.encoding ).to eq( Encoding::US_ASCII )
|
100
|
+
|
101
|
+
decoded = described_class.z85_decode( encoded )
|
102
|
+
|
103
|
+
expect( decoded ).to eq( test_data_1 )
|
104
|
+
expect( decoded.encoding ).to eq( Encoding::ASCII_8BIT )
|
105
|
+
end
|
106
|
+
|
107
|
+
|
108
|
+
it "can round-trip a ZMQ Curve test key" do
|
109
|
+
encoded = described_class.z85_encode( test_data_2 )
|
110
|
+
|
111
|
+
expect( encoded ).to eq( 'JTKVSB%%)wK0E.X)V>+}o?pNmC{O&4W4b!Ni{Lh6' )
|
112
|
+
expect( encoded.encoding ).to eq( Encoding::US_ASCII )
|
113
|
+
|
114
|
+
decoded = described_class.z85_decode( encoded )
|
115
|
+
|
116
|
+
expect( decoded ).to eq( test_data_2 )
|
117
|
+
expect( decoded.encoding ).to eq( Encoding::ASCII_8BIT )
|
118
|
+
end
|
119
|
+
|
120
|
+
|
121
|
+
it "fails if the data to be decoded is not bounded at 5 bytes" do
|
122
|
+
encoded = 'JTKVSB%%)wK0E.X)V>+}o?pNmC{O&4W4b!Ni{Lh6'
|
123
|
+
|
124
|
+
expect( described_class.z85_decode(encoded[0..-2]) ).to be_nil
|
125
|
+
end
|
126
|
+
|
127
|
+
end
|
128
|
+
|
66
129
|
end
|
67
130
|
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zyre
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Granger
|
@@ -10,9 +10,9 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
MIID+
|
14
|
-
|
15
|
-
|
13
|
+
MIID+DCCAmCgAwIBAgIBBTANBgkqhkiG9w0BAQsFADAiMSAwHgYDVQQDDBdnZWQv
|
14
|
+
REM9RmFlcmllTVVEL0RDPW9yZzAeFw0yMzAxMTYxNzE2MDlaFw0yNDAxMTYxNzE2
|
15
|
+
MDlaMCIxIDAeBgNVBAMMF2dlZC9EQz1GYWVyaWVNVUQvREM9b3JnMIIBojANBgkq
|
16
16
|
hkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAvyVhkRzvlEs0fe7145BYLfN6njX9ih5H
|
17
17
|
L60U0p0euIurpv84op9CNKF9tx+1WKwyQvQP7qFGuZxkSUuWcP/sFhDXL1lWUuIl
|
18
18
|
M4uHbGCRmOshDrF4dgnBeOvkHr1fIhPlJm5FO+Vew8tSQmlDsosxLUx+VB7DrVFO
|
@@ -23,17 +23,17 @@ cert_chain:
|
|
23
23
|
ozilJg4aar2okb/RA6VS87o+d7g6LpDDMMQjH4G9OPnJENLdhu8KnPw/ivSVvQw7
|
24
24
|
N2I4L/ZOIe2DIVuYH7aLHfjZDQv/mNgpAgMBAAGjOTA3MAkGA1UdEwQCMAAwCwYD
|
25
25
|
VR0PBAQDAgSwMB0GA1UdDgQWBBRyjf55EbrHagiRLqt5YAd3yb8k4DANBgkqhkiG
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
+
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
26
|
+
9w0BAQsFAAOCAYEARYCeUVBWARNKqF0cvNnLJvFf4hdW2+Rtc7NfC5jQvX9a1oom
|
27
|
+
sfVvS96eER/9cbrphu+vc59EELw4zT+RY3/IesnoE7CaX6zIOFmSmG7K61OHsSLR
|
28
|
+
KqMygcWwyuPXT2JG7JsGHuxbzgaRWe29HbSjBbLYxiMH8Zxh4tKutxzKF7jb0Ggq
|
29
|
+
KAf9MH5LwG8IHVIfV5drT14PvgR3tcvmrn1timPyJl+eZ3LNnm9ofOCweuZCq1cy
|
30
|
+
4Q8LV3vP2Cofy9q+az3DHdaUGlmMiZZZqKixDr1KSS9nvh0ZrKMOUL1sWj/IaxrQ
|
31
|
+
RV3y6td14q49t+xnbj00hPlbW7uE2nLJLt2NAoXiE1Nonndz1seB2c6HL79W9fps
|
32
|
+
E/O12pQjCp/aPUZMt8/8tKW31RIy/KP8XO6OTJNWA8A/oNEI0g5p/LmmEtJKWYr1
|
33
|
+
WmEdESlpWhzFECctefIF2lsN9vaOuof57RM77t2otrtcscDtNarIqjZsIyqtDvtL
|
34
|
+
DttITiit0Vwz7bY0
|
35
35
|
-----END CERTIFICATE-----
|
36
|
-
date:
|
36
|
+
date: 2023-08-08 00:00:00.000000000 Z
|
37
37
|
dependencies:
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
39
|
name: loggability
|
@@ -42,6 +42,9 @@ dependencies:
|
|
42
42
|
- - "~>"
|
43
43
|
- !ruby/object:Gem::Version
|
44
44
|
version: '0.18'
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.18.2
|
45
48
|
type: :runtime
|
46
49
|
prerelease: false
|
47
50
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -49,26 +52,23 @@ dependencies:
|
|
49
52
|
- - "~>"
|
50
53
|
- !ruby/object:Gem::Version
|
51
54
|
version: '0.18'
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: 0.18.2
|
52
58
|
- !ruby/object:Gem::Dependency
|
53
59
|
name: rake-deveiate
|
54
60
|
requirement: !ruby/object:Gem::Requirement
|
55
61
|
requirements:
|
56
62
|
- - "~>"
|
57
63
|
- !ruby/object:Gem::Version
|
58
|
-
version: '0.
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 0.15.1
|
64
|
+
version: '0.22'
|
62
65
|
type: :development
|
63
66
|
prerelease: false
|
64
67
|
version_requirements: !ruby/object:Gem::Requirement
|
65
68
|
requirements:
|
66
69
|
- - "~>"
|
67
70
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0.
|
69
|
-
- - ">="
|
70
|
-
- !ruby/object:Gem::Version
|
71
|
-
version: 0.15.1
|
71
|
+
version: '0.22'
|
72
72
|
- !ruby/object:Gem::Dependency
|
73
73
|
name: rake-compiler
|
74
74
|
requirement: !ruby/object:Gem::Requirement
|
@@ -222,7 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
222
222
|
- !ruby/object:Gem::Version
|
223
223
|
version: '0'
|
224
224
|
requirements: []
|
225
|
-
rubygems_version: 3.
|
225
|
+
rubygems_version: 3.4.10
|
226
226
|
signing_key:
|
227
227
|
specification_version: 4
|
228
228
|
summary: A ZRE library for Ruby.
|
metadata.gz.sig
CHANGED
Binary file
|