Sha256: 1dc771699b8765b4cc81a9e487e046629e6cde6588302edbc1954998c29d6aa2
Contents?: true
Size: 925 Bytes
Versions: 2
Compression:
Stored size: 925 Bytes
Contents
require 'net/ssh/gateway' module Arql class SSHProxy class << self attr_accessor :config, :ssh_gateway, :local_ssh_proxy_port def connect(config) @config = config @ssh_gateway = Net::SSH::Gateway.new(config[:host], config[:user], config.slice(:port, :password).symbolize_keys.merge(keepalive: true, keepalive_interval: 30)) @local_ssh_proxy_port = @ssh_gateway.open(config[:forward_host], config[:forward_port], config[:local_port]) end def reconnect reconnect! unless @ssh_gateway.active? end def reconnect! @ssh_gateway.shutdown! @ssh_gateway = Net::SSH::Gateway.new(@config[:host], @config[:user], @config.slice(:port, :password).symbolize_keys) @ssh_gateway.open(config[:forward_host], config[:forward_port], @local_ssh_proxy_port) end def active? @ssh_gateway.active? end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
arql-0.1.25 | lib/arql/ssh_proxy.rb |
arql-0.1.24 | lib/arql/ssh_proxy.rb |