Sha256: 3b120bb1a020d52ec3318d46bd68390e8988665f9ef7e8542d00ab46b15a7d5b
Contents?: true
Size: 976 Bytes
Versions: 6
Compression:
Stored size: 976 Bytes
Contents
require 'net/ssh/gateway' require 'crudboy/ssh_proxy_patch' module Crudboy 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, loop_wait: 1)) @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
6 entries across 6 versions & 1 rubygems