trisulrp 1.4.4 → 1.4.5

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.4
1
+ 1.4.5
@@ -52,6 +52,19 @@ module TrisulRP::Utils
52
52
 
53
53
  # Make key
54
54
  #
55
+ # Convert an item into Trisul Key format.
56
+ #
57
+ # Example
58
+ #
59
+ # == Pass a hostname
60
+ # mk_trisul_key(conn,GUID_HOSTS,"www.trisul.org") => "D0.D1.01.EA"
61
+ # mk_trisul_key(conn,GUID_APPS,"https") => "p-01BB"
62
+ #
63
+ # == Pass a IP
64
+ # mk_trisul_key(conn,GUID_HOSTS,"192.168.1.5") => "C0.A8.01.05"
65
+ # mk_trisul_key(conn,GUID_APPS,"Port-443") => "p-01BB"
66
+ #
67
+ #
55
68
  # [conn] active TRP connection opened earlier
56
69
  # [guid] counter group id (eg hosts, apps, countries)
57
70
  # [str] eg a resolved name (eg a host like www.blue.net)
@@ -75,7 +88,7 @@ module TrisulRP::Utils
75
88
  if resp.found_keys.size > 0
76
89
  resp.found_keys[0].key
77
90
  else
78
- str
91
+ TrisulRP::Keys::make_key(str)
79
92
  end
80
93
  end
81
94
 
data/test/test_key.rb CHANGED
@@ -3,21 +3,56 @@ require 'rubygems'
3
3
  require './helper'
4
4
  include TrisulRP::Protocol
5
5
  include TrisulRP::Keys
6
+ include TrisulRP::Utils
6
7
 
7
8
  class TestTrisulrp < Test::Unit::TestCase
8
9
 
9
10
  def test_keys
10
- p "0A.01.3C.BB = "
11
- p TrisulRP::Keys::make_readable( "0A.01.3C.BB" )
11
+ print "0A.01.3C.BB = "
12
+ print TrisulRP::Keys::make_readable( "0A.01.3C.BB" )
13
+ print "\n"
12
14
 
13
- p "10.1.60.187 = "
14
- p TrisulRP::Keys::make_key( "10.1.60.187" )
15
+ print "10.1.60.187 = "
16
+ print TrisulRP::Keys::make_key( "10.1.60.187" )
17
+ print "\n"
15
18
 
16
- p "p-01BB = "
17
- p TrisulRP::Keys::make_readable( "p-01BB" )
19
+ print "p-01BB = "
20
+ print TrisulRP::Keys::make_readable( "p-01BB" )
21
+ print "\n"
18
22
 
19
- p "Port-443 = "
20
- p TrisulRP::Keys::make_key( "Port-443" )
23
+ print "Port-443 = "
24
+ print TrisulRP::Keys::make_key( "Port-443" )
25
+ print "\n"
26
+
27
+ end
28
+
29
+
30
+ def test_resolved
31
+
32
+ conn = TrisulRP::Protocol.connect("127.0.0.1", 12001,"Demo_Client.crt","Demo_Client.key")
33
+
34
+
35
+ print "www.wireshark.org = "
36
+ print TrisulRP::Utils::mk_trisul_key( conn, TrisulRP::Guids::CG_HOST, "www.wireshark.org" )
37
+ print "\n"
38
+
39
+
40
+ print "80.79.32.7A = "
41
+ print TrisulRP::Keys::make_readable( "80.79.32.7A" )
42
+ ip = TrisulRP::Keys::make_readable("128.121.50.122" )
43
+ print "\n"
44
+
45
+ print "128.121.50.122 = "
46
+ print TrisulRP::Keys::make_key("128.121.50.122" )
47
+ print "\n"
48
+
49
+
50
+ # back to ip
51
+ print "from ip to key "
52
+ print "#{ip} = "
53
+ print TrisulRP::Utils::mk_trisul_key( conn, TrisulRP::Guids::CG_HOST, ip )
54
+ print "\n"
55
+
21
56
 
22
57
  end
23
58
 
data/trisulrp.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{trisulrp}
8
- s.version = "1.4.4"
8
+ s.version = "1.4.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["vivek"]
12
- s.date = %q{2012-05-22}
12
+ s.date = %q{2012-05-23}
13
13
  s.description = %q{This gem deals about the trisul remote protocol}
14
14
  s.email = %q{vivek_rajagopal@yahoo.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 4
8
- - 4
9
- version: 1.4.4
8
+ - 5
9
+ version: 1.4.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - vivek
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2012-05-22 00:00:00 +05:30
17
+ date: 2012-05-23 00:00:00 +05:30
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -152,7 +152,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
152
152
  requirements:
153
153
  - - ">="
154
154
  - !ruby/object:Gem::Version
155
- hash: -721192739
155
+ hash: 517202355
156
156
  segments:
157
157
  - 0
158
158
  version: "0"