pipe2me-client 0.2.15 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a9d71c8d4790ffb256420754f6da2f3883d640b4
4
- data.tar.gz: d9cf6ae6b8c13975fa9e70cff666bcd0af35fd3b
3
+ metadata.gz: 6f325ba9aa41bbe17611895ce65eff4279fe21fa
4
+ data.tar.gz: 330125913e082e80df6e67fde935b41d810b738f
5
5
  SHA512:
6
- metadata.gz: dcab1a08ad5d8900dd697f2ddd0a421c3e76b814cbb1c2b9789e7f97d6d87852d20ef0a6d3f3bd9c3f6cdd22ab7834a51403dbe1ffd375e22c8a1ea340eae966
7
- data.tar.gz: ec2c3cecba6b539aef79e71710cc5d7e235740aa738b738788b50d90cca8ea6ddbdfa884a12484aef7b73970ca15f0b89cbdca72d1a17862bd1803afad91bd3c
6
+ metadata.gz: d517e7c6df0d6f76e430d342adfb1931f53fbf585b4b86087a7bee9b9575972180337849813c7d08ca84cdd44e2e17a91ac1a16ab7ba5017022faa7c3467b552
7
+ data.tar.gz: 24b3a761dee28119080f12d6aec46a5a05c52a58d5809cf710bb075f1f74eeb89ac93f6bb50d3aedd3e561b17beb47ca52cad82868cfe881f7d4d2b8289abe00
data/README.md CHANGED
@@ -40,7 +40,7 @@ pretty-ivory-horse.test.pipe2.me
40
40
  PIPE2ME_URLS_0=http://pretty-ivory-horse.test.pipe2.me:10003
41
41
  PIPE2ME_URLS_1=https://pretty-ivory-horse.test.pipe2.me:10004
42
42
 
43
- # Start the tunnels via foreman (but please review on using foreman)
43
+ # Start the tunnels
44
44
  &gt; <b>pipe2me start</b>
45
45
  </pre>
46
46
 
@@ -107,4 +107,4 @@ under the terms of the MIT License (MIT), see COPYING.MIT for details.
107
107
  The subdirectory lib/vendor contains third-party code, which is subject to its own copyrights.
108
108
  Please see the respective source files for copyright information.
109
109
 
110
- (c) The kinko team, 2014
110
+ (c) The kinko.me team, 2014
data/bin/pipe2me CHANGED
@@ -3,8 +3,6 @@ $:.unshift "#{File.dirname(__FILE__)}/../lib"
3
3
 
4
4
  require "pipe2me"
5
5
  require "pipe2me/cli"
6
- require "pipe2me/cli-foreman"
7
- require "pipe2me/cli-monit"
8
6
 
9
7
  if ENV["BACKTRACE"].to_i == 1
10
8
  Pipe2me::CLI.start ARGV
@@ -15,36 +15,25 @@ module Pipe2me::Tunnel::Commands
15
15
  end
16
16
  end
17
17
 
18
- public
19
-
20
18
  # return an arry [ [name, command ], [name, command ], .. ]
21
- def tunnel_commands
19
+ def tunnel_command
22
20
  tunnel_uri = URI.parse config.tunnel
23
21
 
24
- tunnels.map do |protocol, remote_port, local_port|
25
- next unless cmd = port_tunnel_command(tunnel_uri, protocol, remote_port, local_port)
26
- [ "#{protocol}_#{remote_port}", cmd ]
27
- end.compact
28
- end
29
-
30
- # def mapping_commands
31
- # natpmpc = File.expand_path "#{File.dirname(__FILE__)}/../bin/natpmpc"
32
- # mappings = tunnels.map do |_, remote_port, local_port|
33
- # "tcp:#{remote_port}:#{local_port}"
34
- # end
35
- # [ [ "natpmpc", "#{natpmpc} #{mappings.join(" ")} && sleep 10000" ] ]
36
- # end
22
+ port_mappings = tunnels.map do |protocol, remote_port, local_port|
23
+ [ remote_port, local_port ]
24
+ end
37
25
 
38
- def echo_commands
39
- tunnels.map do |protocol, remote_port, local_port|
40
- next unless cmd = echo_server_command(protocol, local_port)
41
- [ "echo_#{local_port}", cmd ]
42
- end.compact
26
+ cmd = port_tunnel_command(tunnel_uri, port_mappings)
27
+ [ "tunnel", cmd ]
43
28
  end
44
29
 
45
30
  private
46
31
 
47
- def port_tunnel_command(tunnel_uri, protocol, remote_port, local_port)
32
+ def port_tunnel_command(tunnel_uri, port_mappings)
33
+ port_mappings = port_mappings.map do |remote_port, local_port|
34
+ "-R 0.0.0.0:#{remote_port}:localhost:#{local_port}"
35
+ end.join(" ")
36
+
48
37
  cmd = <<-SHELL
49
38
  env AUTOSSH_GATETIME=0 # comments work here..
50
39
  #{Which::AUTOSSH}
@@ -52,23 +41,16 @@ module Pipe2me::Tunnel::Commands
52
41
  -F #{T::SSH_CONFIG}
53
42
  #{tunnel_uri.user}@#{tunnel_uri.host}
54
43
  -p #{tunnel_uri.port}
55
- -R 0.0.0.0:#{remote_port}:localhost:#{local_port}
44
+ #{port_mappings}
56
45
  -i #{T::SSH_PRIVKEY}
57
46
  -o StrictHostKeyChecking=no
58
47
  -o UserKnownHostsFile=pipe2me.known_hosts
59
48
  -o PasswordAuthentication=no
49
+ -o ExitOnForwardFailure=yes
60
50
  -N
61
51
  SHELL
62
52
 
63
53
  # remove comments and newlines from commands
64
54
  cmd.gsub(/( *#.*|\s+)/, " ").gsub(/(^ )|( $)/, "")
65
55
  end
66
-
67
- def echo_server_command(protocol, port)
68
- binary = File.dirname(__FILE__) + "/echo/#{protocol}"
69
- return unless File.executable?(binary)
70
-
71
- UI.info "Starting #{protocol} echo server on port #{port}"
72
- "env PORT=#{port} #{binary}"
73
- end
74
56
  end
@@ -1,4 +1,4 @@
1
1
  module Pipe2me
2
- VERSION = "0.2.15"
3
- BANNER = "pipe2me command line client V#{Pipe2me::VERSION}; (c) The kinko team, 2013, 2014."
2
+ VERSION = "0.3.0"
3
+ BANNER = "pipe2me command line client V#{Pipe2me::VERSION}; (c) The kinko.me team, 2013, 2014."
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pipe2me-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.15
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - radiospiel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-01 00:00:00.000000000 Z
11
+ date: 2014-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -38,20 +38,6 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: foreman
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: simple-ui
57
43
  requirement: !ruby/object:Gem::Requirement
@@ -66,7 +52,7 @@ dependencies:
66
52
  - - ">="
67
53
  - !ruby/object:Gem::Version
68
54
  version: '0'
69
- description: pipe2me command line client V0.2.15; (c) The kinko team, 2013, 2014.
55
+ description: pipe2me command line client V0.3.0; (c) The kinko.me team, 2013, 2014.
70
56
  email: contact@kinko.me
71
57
  executables:
72
58
  - pipe2me
@@ -78,8 +64,6 @@ files:
78
64
  - bin/pipe2med
79
65
  - lib/pipe2me.rb
80
66
  - lib/pipe2me/bin/natpmpc
81
- - lib/pipe2me/cli-foreman.rb
82
- - lib/pipe2me/cli-monit.rb
83
67
  - lib/pipe2me/cli.rb
84
68
  - lib/pipe2me/config.rb
85
69
  - lib/pipe2me/ext/file_ext.rb
@@ -100,8 +84,6 @@ files:
100
84
  - rakelib/test.rake
101
85
  - test/auth-token-test.sh
102
86
  - test/env-test.sh
103
- - test/foreman-test.sh
104
- - test/monitrc-test.sh
105
87
  - test/redirection-test.sh
106
88
  - test/setup-test.sh
107
89
  - test/sshkey-test.sh
@@ -133,5 +115,5 @@ rubyforge_project:
133
115
  rubygems_version: 2.2.2
134
116
  signing_key:
135
117
  specification_version: 4
136
- summary: pipe2me command line client V0.2.15; (c) The kinko team, 2013, 2014.
118
+ summary: pipe2me command line client V0.3.0; (c) The kinko.me team, 2013, 2014.
137
119
  test_files: []
@@ -1,34 +0,0 @@
1
- class Pipe2me::CLI < Thor
2
- desc "start", "Start tunnels"
3
- option :echo, :type => :boolean, :banner => "Also run echo servers"
4
- def start
5
- handle_global_options
6
-
7
- procfile = options[:echo] ? "pipe2me.procfile.echo" : "pipe2me.procfile"
8
-
9
- File.open procfile, "w" do |io|
10
- Pipe2me::Tunnel.tunnel_commands.each do |name, cmd|
11
- io.write "#{name}: #{cmd}\n"
12
- end
13
-
14
- # Pipe2me::Tunnel.mapping_commands.each do |name, cmd|
15
- # io.write "#{name}: #{cmd}\n"
16
- # end
17
-
18
- next unless options[:echo]
19
-
20
- Pipe2me::Tunnel.echo_commands.each do |name, cmd|
21
- io.write "#{name}: #{cmd}\n"
22
- end
23
- end
24
-
25
- config = Pipe2me::Tunnel.send(:config)
26
- fqdn = config.fqdn
27
-
28
- Pipe2me::Tunnel.tunnels.each do |protocol, remote_port, local_port|
29
- UI.success "Tunneling #{protocol}://localhost:#{local_port} <=> #{protocol}://#{fqdn}:#{remote_port}"
30
- end
31
-
32
- Kernel.exec "foreman start -f #{procfile}"
33
- end
34
- end
@@ -1,66 +0,0 @@
1
- class Pipe2me::CLI < Thor
2
- desc "monit", "Create monitrc file and run monit"
3
- option :port, :default => 5555, :banner => "control port"
4
- option :echo, :type => :boolean, :banner => "Also run echo servers"
5
- def monit(*args)
6
- handle_global_options
7
-
8
- monitrc_file = create_monitrc
9
-
10
- UI.warn "Running: monit -c #{monitrc_file} #{args.join(" ")}"
11
- Kernel.exec "monit", "-c", monitrc_file, *args
12
- end
13
-
14
- desc "monitrc", "Create monitrc file"
15
- option :port, :default => 5555, :banner => "control port"
16
- option :echo, :type => :boolean, :banner => "Also run echo servers"
17
- def monitrc
18
- handle_global_options
19
-
20
- monitrc_file = create_monitrc
21
- Kernel.exec "monit", "-c", monitrc_file, "-t"
22
- end
23
-
24
- private
25
-
26
- def create_monitrc
27
- path = options[:echo] ? "pipe2me.monitrc.echo" : "pipe2me.monitrc"
28
-
29
- # The daemon binary
30
- daemon = "#{Which::DAEMON} -D #{File.expand_path(Dir.getwd)}"
31
-
32
- port = options[:port]
33
-
34
- logfile = File.expand_path "pipe2me.monit.log"
35
- piddir = File.expand_path "pipe2me.monit.pids"
36
- FileUtils.mkdir_p piddir
37
-
38
- commands = Pipe2me::Tunnel.tunnel_commands
39
- # commands += Pipe2me::Tunnel.mapping_commands
40
- commands += Pipe2me::Tunnel.echo_commands if options[:echo]
41
-
42
- File.open path, "w", 0600 do |io|
43
- require "erb"
44
-
45
- erb = ERB.new MONITRC_ERB
46
- io.write erb.result(self.send(:binding))
47
- end
48
-
49
- UI.success "Created #{path}"
50
-
51
- path
52
- end
53
-
54
- MONITRC_ERB = %q{
55
- set daemon 10
56
- set httpd port <%= port %> and use address localhost allow localhost
57
-
58
- <% commands.each do |name, cmd| %>
59
- check process <%= name %> with pidfile <%= piddir %>/<%= name %>.pid
60
- <% daemon = "#{daemon} -N --name #{name} --pidfiles #{piddir} --output #{logfile}" %>
61
- start program = "<%= daemon %> -- <%= cmd %>" with timeout 60 seconds
62
- stop program = "<%= daemon %> --stop"
63
- <% end %>
64
- }
65
-
66
- end
data/test/foreman-test.sh DELETED
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env roundup
2
- describe "setup and starts tunnels in foreman mode"
3
-
4
- . $(dirname $1)/testhelper.inc
5
-
6
- it_works_with_foreman() {
7
- later It setup and starts tunnels in foreman mode
8
- # i.e. pipe2me setup
9
- # pipe2me echo
10
- # ...
11
- }
data/test/monitrc-test.sh DELETED
@@ -1,23 +0,0 @@
1
- #!/usr/bin/env roundup
2
- describe "setup and starts tunnels in foreman mode"
3
-
4
- . $(dirname $1)/testhelper.inc
5
-
6
- it_works_with_monitrc() {
7
- later It setup and starts tunnels in monitrc mode
8
- # i.e. pipe2me setup
9
- # pipe2me monitrc
10
- # pipe2me monit start all
11
- # ...
12
- }
13
-
14
- it_creates_a_monitrc_file() {
15
- ! [ -e pipe2me.monitrc ]
16
- fqdn=$($pipe2me setup --server $pipe2me_server --token $pipe2me_token)
17
-
18
- $pipe2me monitrc
19
- [ -e pipe2me.monitrc ]
20
-
21
- # The file is 0600
22
- ls -l pipe2me.monitrc | grep -e "-rw-------"
23
- }