class Crudboy::SSHProxy

Attributes

config[RW]
local_ssh_proxy_port[RW]
ssh_gateway[RW]

Public Class Methods

active?() click to toggle source
# File lib/crudboy/ssh_proxy.rb, line 26
def active?
  @ssh_gateway.active?
end
connect(config) click to toggle source
# File lib/crudboy/ssh_proxy.rb, line 10
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, loop_wait: 1))
  @local_ssh_proxy_port = @ssh_gateway.open(config[:forward_host], config[:forward_port], config[:local_port])
end
reconnect() click to toggle source
# File lib/crudboy/ssh_proxy.rb, line 16
def reconnect
  reconnect! unless @ssh_gateway.active?
end
reconnect!() click to toggle source
# File lib/crudboy/ssh_proxy.rb, line 20
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