zerg_support 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG ADDED
@@ -0,0 +1 @@
1
+ v0.0.1. Initial release. Support code for zerg* gem installation.
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2008 Victor Costan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/Manifest ADDED
@@ -0,0 +1,8 @@
1
+ lib/zerg_support/gems.rb
2
+ lib/zerg_support.rb
3
+ test/test_gems.rb
4
+ CHANGELOG
5
+ LICENSE
6
+ README
7
+ Rakefile
8
+ Manifest
data/README ADDED
@@ -0,0 +1,61 @@
1
+ INSTALL
2
+ -
3
+
4
+ on server and local machine:
5
+
6
+ `gem sources -a http://gems.github.com`
7
+
8
+ `sudo gem install coderrr-rtunnel`
9
+
10
+ If you don't have root access on server, you can use either the rtunnel_server_linux binary (only works with linux), or extract the .tar.gz and use `rtunnel_server.rb` (all function the same)
11
+
12
+ USAGE
13
+ -
14
+
15
+ on server (myserver.com):
16
+
17
+ `rtunnel_server`
18
+
19
+ on your local machine:
20
+
21
+ `rtunnel_client -c myserver.com -f 4000 -t 3000`
22
+
23
+ This would reverse tunnel myserver.com:4000 to localhost:3000 so that if you had a web server running at port 3000 on your local machine, anyone on the internet could access it by going to http://myserver.com:4000
24
+
25
+ **News**
26
+
27
+ * 0.3.6 released, new protocol
28
+ * created gem for easier installation
29
+ * 0.2.1 released, minor bugfix, cmdline options change
30
+ * 0.2.0 released, much simpler
31
+ * 0.1.2 released
32
+ * Created rtunnel_server binary for linux so you don't need Ruby installed on the host you want to reverse tunnel from
33
+ * 0.1.1 released
34
+ * Added default control port of 19050, no longer have to specify this on client or server unless you care to change it
35
+
36
+ RTunnel?
37
+ -
38
+
39
+ This client/server allow you to reverse tunnel traffic. Reverse tunneling is useful if you want to run a server behind a NAT and you do not have the ability use port forwarding. The specific reason I created this program was to reduce the pain of Facebook App development on a crappy internet connection that drops often. ssh -R was not cutting it.
40
+
41
+ **How does reverse tunneling work?**
42
+
43
+ * tunnel\_client makes connection to tunnel\_server (through NAT)
44
+ * tunnel_server listens on port X
45
+ * internet_user connects to port X on tunnel server
46
+ * tunnel\_server uses existing connection to tunnel internet user's request back to tunnel\_client
47
+ * tunnel_client connects to local server on port Y
48
+ * tunnel_client tunnels internet users connection through to local server
49
+
50
+ or:
51
+
52
+ * establish connection: tunnel\_client --NAT--> tunnel\_server
53
+ * reverse tunnel: internet\_user -> tunnel_server --(NAT)--> tunnel\_client -> server\_running\_behind\_nat
54
+
55
+ **How is this different than normal tunneling?**
56
+
57
+ With tunneling, usually your connections are made in the same direction you create the tunnel connection. With reverse tunneling, you tunnel your connections the opposite direction of which you made the tunnel connection. So you initiate the tunnel with A -> B, but connections are tunneled from B -> A.
58
+
59
+ **Why not just use ssh -R?**
60
+
61
+ The same thing can be achieved with ssh -R, why not just use it? A lot of ssh servers don't have the GatewayPorts sshd option set up to allow you to reverse tunnel. If you are not in control of the server and it is not setup correctly then you are SOL. RTunnel does not require you are in control of the server. ssh -R has other annoyances. When your connection drops and you try to re-initiate the reverse tunnel sometimes you get an address already in use error because the old tunnel process is still laying around. This requires you to kill the existing sshd process. RTunnel does not have this problem.
data/Rakefile ADDED
@@ -0,0 +1,21 @@
1
+ require 'rubygems'
2
+ gem 'echoe'
3
+ require 'echoe'
4
+
5
+ Echoe.new('zerg_support') do |p|
6
+ p.project = 'rails-pwnage' # rubyforge project
7
+
8
+ p.author = 'Victor Costan'
9
+ p.email = 'victor@zergling.net'
10
+ p.summary = 'Support libraries used by the Zerg system.'
11
+ p.url = 'http://www.zergling.net'
12
+
13
+ p.need_tar_gz = true
14
+ p.need_zip = true
15
+ p.rdoc_pattern = /^(lib|bin|tasks|ext)|^BUILD|^README|^CHANGELOG|^TODO|^LICENSE|^COPYING$/
16
+ end
17
+
18
+ if $0 == __FILE__
19
+ Rake.application = Rake::Application.new
20
+ Rake.application.run
21
+ end
@@ -0,0 +1,9 @@
1
+ # :nodoc
2
+ module Zerg
3
+ end
4
+
5
+ # TODO(victor): document this
6
+ module Zerg::Support
7
+ end
8
+
9
+ require 'zerg_support/gems.rb'
@@ -0,0 +1,36 @@
1
+ # methods used in gem installation hooks
2
+ module Zerg::Support::Gems
3
+ # called by ensure_on_path for Windows systems
4
+ def self.ensure_on_windows_path(bin_file)
5
+ # TODO(victor): test this; it's likely that a .bat will be needed instead
6
+ path = "/windows/#{File.basename bin_file}"
7
+ return if File.exists? path
8
+ FileUtils.ln_s(bin_file, path, :force)
9
+ end
10
+
11
+ # called by ensure_on_path for UNIX systems
12
+ def self.ensure_on_unix_path(bin_file)
13
+ path = "/usr/bin/#{File.basename bin_file}"
14
+ return if File.exists? path
15
+ # using a link so the gem can be updated and the link still works
16
+ FileUtils.ln_s(bin_file, path, :force)
17
+ end
18
+
19
+ # ensures that bin_file can be invoked from a shell
20
+ def self.ensure_on_path(bin_script)
21
+ bin_file = File.expand_path(__FILE__ + '/../../../bin/rpwn')
22
+ # this is a cheat to get the binary in the right place on stubborn Debians
23
+ if RUBY_PLATFORM =~ /win/ and RUBY_PLATFORM !~ /darwin/
24
+ ensure_on_windows_path bin_file
25
+ else
26
+ ensure_on_unix_path bin_file
27
+ end
28
+ end
29
+
30
+ # tricks rubygems into believeing that the extension compiled and worked out
31
+ def self.emulate_extension_install(extension_name)
32
+ File.open('Makefile', 'w') { |f| f.write "all:\n\ninstall:\n\n" }
33
+ File.open(extension_name + '.so', 'w') {}
34
+ File.open(extension_name + '.dll', 'w') {}
35
+ end
36
+ end
data/test/test_gems.rb ADDED
@@ -0,0 +1,29 @@
1
+ require 'digest/sha1'
2
+ require 'test/unit'
3
+
4
+ require 'zerg_support'
5
+
6
+ class TestGems < Test::Unit::TestCase
7
+ def hash_gems_file
8
+ file_path = File.join(File.dirname(__FILE__),
9
+ '../lib/zerg_support/gems.rb')
10
+ Digest::SHA1.hexdigest File.read(file_path)
11
+ end
12
+
13
+ def test_source_is_manually_tested
14
+ golden_hash = 'f02b6c7852af883d60d4ec0c658928579e61f270'
15
+ source_hash = hash_gems_file
16
+
17
+ assert_equal golden_hash, source_hash, <<END_MESSAGE
18
+ lib/zerg_support/zerg_support.rb has changed
19
+
20
+ You need to manually test the file, then replace golden_hash in this test.
21
+ Manual testing plan:
22
+ 1. rake install this gem (zerg_support)
23
+ 2. install zerg
24
+ 3. validate that the installation does not crash and the binary gets symlinked
25
+ in the correct place
26
+ 4. replace golden_hash with #{source_hash}
27
+ END_MESSAGE
28
+ end
29
+ end
@@ -0,0 +1,35 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{zerg_support}
5
+ s.version = "0.0.1"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Victor Costan"]
9
+ s.date = %q{2008-11-12}
10
+ s.description = %q{Support libraries used by the Zerg system.}
11
+ s.email = %q{victor@zergling.net}
12
+ s.extra_rdoc_files = ["lib/zerg_support/gems.rb", "lib/zerg_support.rb", "CHANGELOG", "LICENSE", "README"]
13
+ s.files = ["lib/zerg_support/gems.rb", "lib/zerg_support.rb", "test/test_gems.rb", "CHANGELOG", "LICENSE", "README", "Rakefile", "Manifest", "zerg_support.gemspec"]
14
+ s.has_rdoc = true
15
+ s.homepage = %q{http://www.zergling.net}
16
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Zerg_support", "--main", "README"]
17
+ s.require_paths = ["lib"]
18
+ s.rubyforge_project = %q{rails-pwnage}
19
+ s.rubygems_version = %q{1.3.1}
20
+ s.summary = %q{Support libraries used by the Zerg system.}
21
+ s.test_files = ["test/test_gems.rb"]
22
+
23
+ if s.respond_to? :specification_version then
24
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
25
+ s.specification_version = 2
26
+
27
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
28
+ s.add_development_dependency(%q<echoe>, [">= 0"])
29
+ else
30
+ s.add_dependency(%q<echoe>, [">= 0"])
31
+ end
32
+ else
33
+ s.add_dependency(%q<echoe>, [">= 0"])
34
+ end
35
+ end
metadata ADDED
@@ -0,0 +1,79 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: zerg_support
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Victor Costan
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-11-12 00:00:00 -05:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: echoe
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ description: Support libraries used by the Zerg system.
26
+ email: victor@zergling.net
27
+ executables: []
28
+
29
+ extensions: []
30
+
31
+ extra_rdoc_files:
32
+ - lib/zerg_support/gems.rb
33
+ - lib/zerg_support.rb
34
+ - CHANGELOG
35
+ - LICENSE
36
+ - README
37
+ files:
38
+ - lib/zerg_support/gems.rb
39
+ - lib/zerg_support.rb
40
+ - test/test_gems.rb
41
+ - CHANGELOG
42
+ - LICENSE
43
+ - README
44
+ - Rakefile
45
+ - Manifest
46
+ - zerg_support.gemspec
47
+ has_rdoc: true
48
+ homepage: http://www.zergling.net
49
+ post_install_message:
50
+ rdoc_options:
51
+ - --line-numbers
52
+ - --inline-source
53
+ - --title
54
+ - Zerg_support
55
+ - --main
56
+ - README
57
+ require_paths:
58
+ - lib
59
+ required_ruby_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: "0"
64
+ version:
65
+ required_rubygems_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: "1.2"
70
+ version:
71
+ requirements: []
72
+
73
+ rubyforge_project: rails-pwnage
74
+ rubygems_version: 1.3.1
75
+ signing_key:
76
+ specification_version: 2
77
+ summary: Support libraries used by the Zerg system.
78
+ test_files:
79
+ - test/test_gems.rb