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

Returns a new instance of IpAddressControl.



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

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.



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

def ip
  @ip
end

Instance Method Details

#get_ipObject



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

def get_ip
  ensure_tor_is_available
  @ip = tor_endpoint_ip
end

#get_new_ipObject



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

def get_new_ip
  ensure_tor_is_available
  get_new_tor_endpoint_ip
end