Sha256: 55c2fc1e8f82e75e5f14fe759c823c64d92f31ebe177ae9931dd056166ebe635
Contents?: true
Size: 1.01 KB
Versions: 10
Compression:
Stored size: 1.01 KB
Contents
module Invoker module Power class UrlRewriter def select_backend_config(complete_path) possible_matches = extract_host_from_domain(complete_path) exact_match = nil possible_matches.each do |match| if match exact_match = dns_check(process_name: match) break if exact_match.port end end exact_match end def extract_host_from_domain(complete_path) matching_strings = [] tld_match_regex.map do |regexp| if (match_result = complete_path.match(regexp)) matching_strings << match_result[1] end end matching_strings.uniq end private def tld_match_regex tld = Invoker.config.tld [/([\w.-]+)\.#{tld}(\:\d+)?$/, /([\w-]+)\.#{tld}(\:\d+)?$/] end def dns_check(dns_args) Invoker::IPC::UnixClient.send_command("dns_check", dns_args) do |dns_response| dns_response end end end end end
Version data entries
10 entries across 10 versions & 3 rubygems