tella_peer 0.0.1
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 +7 -0
- data/.gitignore +18 -0
- data/.rbenv-version +1 -0
- data/.rspec +3 -0
- data/Gemfile +19 -0
- data/Guardfile +8 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/bin/client.rb +94 -0
- data/client.thor +53 -0
- data/lib/tella_peer.rb +67 -0
- data/lib/tella_peer/connection.rb +133 -0
- data/lib/tella_peer/connections.rb +171 -0
- data/lib/tella_peer/message.rb +107 -0
- data/lib/tella_peer/message_types.rb +9 -0
- data/lib/tella_peer/ping.rb +14 -0
- data/lib/tella_peer/pong.rb +45 -0
- data/lib/tella_peer/public/.DS_Store +0 -0
- data/lib/tella_peer/public/css/bootstrap.css +6315 -0
- data/lib/tella_peer/public/css/bootstrap.min.css +875 -0
- data/lib/tella_peer/public/img/glyphicons-halflings-white.png +0 -0
- data/lib/tella_peer/public/img/glyphicons-halflings.png +0 -0
- data/lib/tella_peer/public/js/bootstrap.js +2291 -0
- data/lib/tella_peer/public/js/bootstrap.min.js +7 -0
- data/lib/tella_peer/query.rb +13 -0
- data/lib/tella_peer/reply.rb +72 -0
- data/lib/tella_peer/status_page.rb +22 -0
- data/lib/tella_peer/version.rb +3 -0
- data/lib/tella_peer/views/index.erb +160 -0
- data/lib/vash.rb +110 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/tella_peer/message_spec.rb +81 -0
- data/spec/tella_peer/ping_spec.rb +14 -0
- data/spec/tella_peer/pong_spec.rb +32 -0
- data/spec/tella_peer/reply_spec.rb +36 -0
- data/tella_peer.gemspec +23 -0
- metadata +115 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
describe TellaPeer::Ping do
|
|
2
|
+
let(:message) do
|
|
3
|
+
TellaPeer::Ping.new
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
it { expect(message.type).to be TellaPeer::MessageTypes::PING }
|
|
7
|
+
it { expect(message.payload_length).to be 0 }
|
|
8
|
+
|
|
9
|
+
context '#ping_to_pong' do
|
|
10
|
+
let(:pong) { message.ping_to_pong }
|
|
11
|
+
|
|
12
|
+
it { expect(pong.message_id).to eq message.message_id }
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
describe TellaPeer::Pong do
|
|
2
|
+
let(:message) do
|
|
3
|
+
pong = TellaPeer::Pong.new
|
|
4
|
+
pong.port = 1234
|
|
5
|
+
pong.ip = [0,255,128,129]
|
|
6
|
+
pong
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
it { expect(message.type).to be TellaPeer::MessageTypes::PONG }
|
|
10
|
+
|
|
11
|
+
it { expect(message).to respond_to :port }
|
|
12
|
+
it { expect(message).to respond_to :ip }
|
|
13
|
+
|
|
14
|
+
it { expect(message.payload_length).to eq 6 }
|
|
15
|
+
|
|
16
|
+
context '#new' do
|
|
17
|
+
context 'building a pong message' do
|
|
18
|
+
let(:packed_message) { message.pack }
|
|
19
|
+
let(:read_message) do
|
|
20
|
+
TellaPeer::Pong.new(packed_message[0..22].unpack(TellaPeer::Message::HEADER_PACKER), packed_message[23..-1])
|
|
21
|
+
end
|
|
22
|
+
it 'payload size is 6 bytes' do
|
|
23
|
+
expect(packed_message[23..-1].length).to eq 6
|
|
24
|
+
end
|
|
25
|
+
[:message_id, :ttl, :hops, :payload_length, :ip, :port].each do |prop|
|
|
26
|
+
it "maintains #{prop}" do
|
|
27
|
+
expect(read_message.send(prop)).to eq message.send(prop)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
describe TellaPeer::Reply do
|
|
2
|
+
let(:message_text) { "Keith Stone -- stonek2@cs.washington.edu"}
|
|
3
|
+
let(:message) do
|
|
4
|
+
reply = TellaPeer::Reply.new
|
|
5
|
+
reply.port = 1234
|
|
6
|
+
reply.ip = [0,255,128,129]
|
|
7
|
+
reply.text = message_text
|
|
8
|
+
reply
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it { expect(message.type).to be TellaPeer::MessageTypes::REPLY }
|
|
12
|
+
|
|
13
|
+
it { expect(message).to respond_to :port }
|
|
14
|
+
it { expect(message).to respond_to :ip }
|
|
15
|
+
it { expect(message).to respond_to :text }
|
|
16
|
+
it { expect(message.payload_length).to eq message_text.length + 6 }
|
|
17
|
+
|
|
18
|
+
it { expect(message.payload.drop(5)).to eq message_text.chars.map(&:ord) }
|
|
19
|
+
|
|
20
|
+
context '#new' do
|
|
21
|
+
context 'building a reply' do
|
|
22
|
+
let(:packed_message) { message.pack }
|
|
23
|
+
let(:read_message) do
|
|
24
|
+
TellaPeer::Reply.new(packed_message[0..22].unpack(TellaPeer::Message::HEADER_PACKER), packed_message[23..-1])
|
|
25
|
+
end
|
|
26
|
+
it 'has a payload the same length as the payload field' do
|
|
27
|
+
expect((packed_message[23..-1] || []).length).to eq message.payload_length
|
|
28
|
+
end
|
|
29
|
+
[:message_id, :ttl, :hops, :payload_length, :text, :ip, :port].each do |prop|
|
|
30
|
+
it "maintains #{prop}" do
|
|
31
|
+
expect(read_message.send(prop)).to eq message.send(prop)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
data/tella_peer.gemspec
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'tella_peer/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "tella_peer"
|
|
8
|
+
spec.version = TellaPeer::VERSION
|
|
9
|
+
spec.authors = ["Keith Stone"]
|
|
10
|
+
spec.email = ["kstone@whitepages.com"]
|
|
11
|
+
spec.description = %q{ Client for CSEtella P2P network created for UW CSE 552 Spring '13 }
|
|
12
|
+
spec.summary = %q{ Client for CSEtella P2P network created for UW CSE 552 Spring '13}
|
|
13
|
+
spec.homepage = ""
|
|
14
|
+
spec.license = "MIT"
|
|
15
|
+
|
|
16
|
+
spec.files = `git ls-files`.split($/)
|
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
19
|
+
spec.require_paths = ["lib"]
|
|
20
|
+
|
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
|
22
|
+
spec.add_development_dependency "rake"
|
|
23
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: tella_peer
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Keith Stone
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2013-06-06 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ~>
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.3'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ~>
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.3'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - '>='
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - '>='
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
description: ' Client for CSEtella P2P network created for UW CSE 552 Spring ''13 '
|
|
42
|
+
email:
|
|
43
|
+
- kstone@whitepages.com
|
|
44
|
+
executables:
|
|
45
|
+
- client.rb
|
|
46
|
+
extensions: []
|
|
47
|
+
extra_rdoc_files: []
|
|
48
|
+
files:
|
|
49
|
+
- .gitignore
|
|
50
|
+
- .rbenv-version
|
|
51
|
+
- .rspec
|
|
52
|
+
- Gemfile
|
|
53
|
+
- Guardfile
|
|
54
|
+
- LICENSE.txt
|
|
55
|
+
- README.md
|
|
56
|
+
- Rakefile
|
|
57
|
+
- bin/client.rb
|
|
58
|
+
- client.thor
|
|
59
|
+
- lib/tella_peer.rb
|
|
60
|
+
- lib/tella_peer/connection.rb
|
|
61
|
+
- lib/tella_peer/connections.rb
|
|
62
|
+
- lib/tella_peer/message.rb
|
|
63
|
+
- lib/tella_peer/message_types.rb
|
|
64
|
+
- lib/tella_peer/ping.rb
|
|
65
|
+
- lib/tella_peer/pong.rb
|
|
66
|
+
- lib/tella_peer/public/.DS_Store
|
|
67
|
+
- lib/tella_peer/public/css/bootstrap.css
|
|
68
|
+
- lib/tella_peer/public/css/bootstrap.min.css
|
|
69
|
+
- lib/tella_peer/public/img/glyphicons-halflings-white.png
|
|
70
|
+
- lib/tella_peer/public/img/glyphicons-halflings.png
|
|
71
|
+
- lib/tella_peer/public/js/bootstrap.js
|
|
72
|
+
- lib/tella_peer/public/js/bootstrap.min.js
|
|
73
|
+
- lib/tella_peer/query.rb
|
|
74
|
+
- lib/tella_peer/reply.rb
|
|
75
|
+
- lib/tella_peer/status_page.rb
|
|
76
|
+
- lib/tella_peer/version.rb
|
|
77
|
+
- lib/tella_peer/views/index.erb
|
|
78
|
+
- lib/vash.rb
|
|
79
|
+
- spec/spec_helper.rb
|
|
80
|
+
- spec/tella_peer/message_spec.rb
|
|
81
|
+
- spec/tella_peer/ping_spec.rb
|
|
82
|
+
- spec/tella_peer/pong_spec.rb
|
|
83
|
+
- spec/tella_peer/reply_spec.rb
|
|
84
|
+
- tella_peer.gemspec
|
|
85
|
+
homepage: ''
|
|
86
|
+
licenses:
|
|
87
|
+
- MIT
|
|
88
|
+
metadata: {}
|
|
89
|
+
post_install_message:
|
|
90
|
+
rdoc_options: []
|
|
91
|
+
require_paths:
|
|
92
|
+
- lib
|
|
93
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
94
|
+
requirements:
|
|
95
|
+
- - '>='
|
|
96
|
+
- !ruby/object:Gem::Version
|
|
97
|
+
version: '0'
|
|
98
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
|
+
requirements:
|
|
100
|
+
- - '>='
|
|
101
|
+
- !ruby/object:Gem::Version
|
|
102
|
+
version: '0'
|
|
103
|
+
requirements: []
|
|
104
|
+
rubyforge_project:
|
|
105
|
+
rubygems_version: 2.0.3
|
|
106
|
+
signing_key:
|
|
107
|
+
specification_version: 4
|
|
108
|
+
summary: Client for CSEtella P2P network created for UW CSE 552 Spring '13
|
|
109
|
+
test_files:
|
|
110
|
+
- spec/spec_helper.rb
|
|
111
|
+
- spec/tella_peer/message_spec.rb
|
|
112
|
+
- spec/tella_peer/ping_spec.rb
|
|
113
|
+
- spec/tella_peer/pong_spec.rb
|
|
114
|
+
- spec/tella_peer/reply_spec.rb
|
|
115
|
+
has_rdoc:
|