Class: Bifrossht::Connection::Base
- Inherits:
-
Object
- Object
- Bifrossht::Connection::Base
- Defined in:
- lib/bifrossht/connection/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
Instance Method Summary collapse
- #connect(_target) ⇒ Object
-
#initialize(config) ⇒ Base
constructor
A new instance of Base.
- #match(target) ⇒ Object
- #name ⇒ Object
- #probe(_target) ⇒ Object
- #skip_probe ⇒ Object
Constructor Details
#initialize(config) ⇒ Base
Returns a new instance of Base.
6 7 8 |
# File 'lib/bifrossht/connection/base.rb', line 6 def initialize(config) @config = config end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
4 5 6 |
# File 'lib/bifrossht/connection/base.rb', line 4 def config @config end |
Instance Method Details
#connect(_target) ⇒ Object
18 19 20 |
# File 'lib/bifrossht/connection/base.rb', line 18 def connect(_target) raise 'not implemented' end |
#match(target) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/bifrossht/connection/base.rb', line 26 def match(target) host_matches = config.match.select do |re| re.match(target.host) end return true if host_matches.any? if target.resolvable? addr_matches = config.match_addr.select do |net| net.include?(target.resolved_ip) end return true if addr_matches.any? end false end |
#name ⇒ Object
10 11 12 |
# File 'lib/bifrossht/connection/base.rb', line 10 def name config.name end |
#probe(_target) ⇒ Object
14 15 16 |
# File 'lib/bifrossht/connection/base.rb', line 14 def probe(_target) raise 'not implemented' end |
#skip_probe ⇒ Object
22 23 24 |
# File 'lib/bifrossht/connection/base.rb', line 22 def skip_probe config.skip_probe end |