class Knj::SSHRobot::Forward
Attributes
open[R]
Public Class Methods
new(args)
click to toggle source
# File lib/knj/sshrobot/sshrobot.rb, line 98 def initialize(args) @open = true @args = args @thread = Knj::Thread.new do begin #args[:session].logger.sev_threshold = Logger::Severity::DEBUG if args[:type] == "local" @args[:session].forward.local(@args[:host_local], @args[:port_local].to_i, @args[:host], @args[:port_remote].to_i) elsif args[:type] == "remote" @args[:session].forward.remote_to(@args[:port_local], @args[:host], @args[:port_remote], @args[:host_local]) else raise "No valid type given." end @args[:session].loop do true end rescue => e puts e.inspect puts e.backtrace @open = false end end end
Public Instance Methods
close()
click to toggle source
# File lib/knj/sshrobot/sshrobot.rb, line 124 def close if !@args return nil end @args[:session].close @open = false @thread.exit @args = nil @thread = nil end