Class: TorManager::IpAddressControl

Inherits:
Object
  • Object
show all
Defined in:
lib/tormanager/ip_address_control.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ IpAddressControl



9
10
11
12
13
14
# File 'lib/tormanager/ip_address_control.rb', line 9

def initialize params={}
  @tor_process = params.fetch(:tor_process, nil)
  @tor_proxy = params.fetch(:tor_proxy, nil)
  @ip = nil
  @endpoint_change_attempts = 5
end

Instance Attribute Details

#ipObject

Returns the value of attribute ip.



7
8
9
# File 'lib/tormanager/ip_address_control.rb', line 7

def ip
  @ip
end

Instance Method Details

#get_ipObject



16
17
18
19
# File 'lib/tormanager/ip_address_control.rb', line 16

def get_ip
  ensure_tor_is_available
  @ip = tor_endpoint_ip
end

#get_new_ipObject



21
22
23
24
# File 'lib/tormanager/ip_address_control.rb', line 21

def get_new_ip
  ensure_tor_is_available
  get_new_tor_endpoint_ip
end