internetee-registry/lib/iptable.rb
2015-05-31 23:28:15 +03:00

15 lines
408 B
Ruby

module Iptable
def counter_update(registrar_code, ip)
counter_proc = "/proc/net/xt_recent/#{registrar_code}"
begin
File.open(counter_proc, 'a') do |f|
f.puts "+#{ip}"
end
rescue Errno::ENOENT => e
logger.error "ERROR: cannot open #{counter_proc}: #{e}"
rescue IOError => e
logger.error "ERROR: cannot write #{ip} to #{counter_proc}: #{e}"
end
end
end