Class: Bifrossht::Connection::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/bifrossht/connection/base.rb

Direct Known Subclasses

Exec

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#configObject

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

#nameObject


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_probeObject


22
23
24
# File 'lib/bifrossht/connection/base.rb', line 22

def skip_probe
  config.skip_probe
end