bin/shaft in shaft-0.8.5 vs bin/shaft in shaft-0.8.8
- old
+ new
@@ -65,17 +65,21 @@
rescue NoMethodError
error "Tunnel configuration for '#{name}' appears to be invalid!"
return
end
- used = local_port_used?(c['bind']['client-port'])
+ used = c['reverse'] ? false : local_port_used?(c['bind']['client-port'])
+ if c['reverse']
+ say "Reverse tunnel, skipping port check."
+ end
if used
error "Local port #{port} is used by:\n#{used}"
return
end
say "Starting tunnel '#{name}'..."
- pid = Process.spawn("ssh -N -p #{port} #{host} -L #{bind}")
+ flag = c['reverse'] ? 'R' : 'L'
+ pid = Process.spawn("ssh -N -p #{port} #{host} -#{flag} #{bind}")
Process.detach pid
say "Started with pid #{pid}."
active[name] = pid
set_active(active)