buschtelefon 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -0
- data/README.md +4 -0
- data/lib/buschtelefon/gossip.rb +1 -7
- data/lib/buschtelefon/net_tattler.rb +6 -5
- data/lib/buschtelefon/remote_tattler.rb +1 -1
- data/lib/buschtelefon/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f97ac74a59e40f443954b18c858d246268a48a0f
|
4
|
+
data.tar.gz: f417f27ecc8f99c09de25b25a69d85dab46dba03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c685fb7c0adbb17d41cea04bdef2c5f94f50ad9bfb5ce63e8886493251e0bdd096514232138da92691f6581c9807e4256dfa9c34c09d24c8961ef769eab6619
|
7
|
+
data.tar.gz: 83ae7243238be220fd6dc57428df6961f3859388999e0afcec3a3d024c0df33d654af770c80e286371aeb3c3921634acf82348cd78f0cf581f77a52bd8281de6
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## 0.3.0
|
4
|
+
|
5
|
+
* `NetTattler` now yields a `Gossip` instead of a raw message string.
|
6
|
+
* `Gossip` now uses float unix timestamps
|
7
|
+
|
8
|
+
## 0.2.0
|
9
|
+
|
10
|
+
* Host port of `NetTattler` is now optional
|
11
|
+
* `NetTattler` makes a brain dump to a `RemoteTattler` if it
|
12
|
+
receives [`"\x05"`](https://en.wikipedia.org/wiki/Enquiry_character)
|
13
|
+
* `Tattler` exposes its brain as `#knowledge`
|
14
|
+
* There are now some Cucumber tests
|
15
|
+
|
16
|
+
## 0.1.0
|
17
|
+
|
18
|
+
* Initial release
|
data/README.md
CHANGED
@@ -35,6 +35,7 @@ Or install it yourself as:
|
|
35
35
|
You can setup your local tattling meshnet the following way:
|
36
36
|
|
37
37
|
```ruby
|
38
|
+
require 'buschtelefon'
|
38
39
|
include Buschtelefon
|
39
40
|
|
40
41
|
aunt_may = NetTattler.new
|
@@ -47,6 +48,9 @@ Thread.new { aunt_may.listen }
|
|
47
48
|
Thread.new { aunt_ruth.listen }
|
48
49
|
|
49
50
|
aunt_may.feed(Gossip.new('Did you hear about the cool company "Renuo"?'))
|
51
|
+
|
52
|
+
puts aunt_may.knowledge
|
53
|
+
puts aunt_ruth.knowledge
|
50
54
|
```
|
51
55
|
|
52
56
|
## Development
|
data/lib/buschtelefon/gossip.rb
CHANGED
@@ -3,18 +3,12 @@ module Buschtelefon
|
|
3
3
|
attr_reader :created_at, :message
|
4
4
|
|
5
5
|
def initialize(message)
|
6
|
-
@created_at =
|
6
|
+
@created_at = Time.now.to_f
|
7
7
|
@message = message
|
8
8
|
end
|
9
9
|
|
10
10
|
def ==(other)
|
11
11
|
@message == other.message
|
12
12
|
end
|
13
|
-
|
14
|
-
private
|
15
|
-
|
16
|
-
def unix_timestamp_ms
|
17
|
-
(Time.now.to_f * 1000).to_i
|
18
|
-
end
|
19
13
|
end
|
20
14
|
end
|
@@ -14,20 +14,21 @@ module Buschtelefon
|
|
14
14
|
puts "Started UDP server on #{@port}..."
|
15
15
|
|
16
16
|
Socket.udp_server_loop(@port) do |message, message_source|
|
17
|
-
puts "Got \"#{message}\" from #{message_source}"
|
17
|
+
# puts "Got \"#{message}\" from #{message_source}"
|
18
18
|
if message == "\x05"
|
19
19
|
handle_knowledge_inquiry(message_source)
|
20
20
|
else
|
21
|
-
|
22
|
-
|
21
|
+
gossip = Gossip.new(message)
|
22
|
+
handle_incoming_gossip(gossip)
|
23
|
+
yield(gossip) if block_given?
|
23
24
|
end
|
24
25
|
end
|
25
26
|
end
|
26
27
|
|
27
28
|
private
|
28
29
|
|
29
|
-
def
|
30
|
-
feed(
|
30
|
+
def handle_incoming_gossip(gossip)
|
31
|
+
feed(gossip)
|
31
32
|
end
|
32
33
|
|
33
34
|
def handle_knowledge_inquiry(message_source)
|
data/lib/buschtelefon/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: buschtelefon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josua Schmid
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -106,6 +106,7 @@ files:
|
|
106
106
|
- ".rspec"
|
107
107
|
- ".ruby-version"
|
108
108
|
- ".travis.yml"
|
109
|
+
- CHANGELOG.md
|
109
110
|
- Gemfile
|
110
111
|
- LICENSE.txt
|
111
112
|
- README.md
|