7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/rack-detect-tor.rb', line 7
def initialize(app, options={})
@app = app
@options = {
'external_ip' => nil,
'external_port' => nil,
'update_frequency' => 60*60
}.merge(options)
@identifier = Hash[@options.select{|k,v| k =~ /^external_/}.
sort_by{|k,v| k}].values.map{|v| v.to_s == '' ? '*' : v}.join('/')
log_message 'Fetching initial list of tor exits...'
@tor_exits = fetch_tor_exits || {}
unless @options['update_frequency'].to_i == 0
log_message "Starting update timer... (updating every #{@options['update_frequency']} seconds)"
run_update_timer
end
end
|