Class: SSHKit::EC2InstanceConnect::Configuration
- Inherits:
-
Object
- Object
- SSHKit::EC2InstanceConnect::Configuration
- Defined in:
- lib/sshkit/ec2instanceconnect.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#ssh_key_refresh_enabled ⇒ Object
Returns the value of attribute ssh_key_refresh_enabled.
-
#ssh_key_size ⇒ Object
Returns the value of attribute ssh_key_size.
-
#tunnel_enabled ⇒ Object
Returns the value of attribute tunnel_enabled.
-
#tunnel_ports ⇒ Object
Returns the value of attribute tunnel_ports.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#random_tunnel_port ⇒ Object
Returns a secure random tunnel port.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
19 20 21 22 23 24 25 |
# File 'lib/sshkit/ec2instanceconnect.rb', line 19 def initialize @logger = ::Logger.new(IO::NULL) @ssh_key_refresh_enabled = true @ssh_key_size = 3072 @tunnel_enabled = false @tunnel_ports = 8000...8100 end |
Instance Attribute Details
#logger ⇒ Object
Returns the value of attribute logger.
17 18 19 |
# File 'lib/sshkit/ec2instanceconnect.rb', line 17 def logger @logger end |
#ssh_key_refresh_enabled ⇒ Object
Returns the value of attribute ssh_key_refresh_enabled.
17 18 19 |
# File 'lib/sshkit/ec2instanceconnect.rb', line 17 def ssh_key_refresh_enabled @ssh_key_refresh_enabled end |
#ssh_key_size ⇒ Object
Returns the value of attribute ssh_key_size.
17 18 19 |
# File 'lib/sshkit/ec2instanceconnect.rb', line 17 def ssh_key_size @ssh_key_size end |
#tunnel_enabled ⇒ Object
Returns the value of attribute tunnel_enabled.
17 18 19 |
# File 'lib/sshkit/ec2instanceconnect.rb', line 17 def tunnel_enabled @tunnel_enabled end |
#tunnel_ports ⇒ Object
Returns the value of attribute tunnel_ports.
17 18 19 |
# File 'lib/sshkit/ec2instanceconnect.rb', line 17 def tunnel_ports @tunnel_ports end |
Instance Method Details
#random_tunnel_port ⇒ Object
Returns a secure random tunnel port.
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/sshkit/ec2instanceconnect.rb', line 28 def random_tunnel_port random_number = SecureRandom.random_number(tunnel_ports.size) case tunnel_ports when Array tunnel_ports[random_number] when Range tunnel_ports.begin + random_number else raise ArgumentError, 'tunnel_ports must be an Array or Range' end end |