Module: ChkDFront::Providers

Included in:
CliOperations, Request
Defined in:
lib/chkdfront/providers.rb

Overview

This module contains CDN provider specific settings headers.

Instance Method Summary collapse

Instance Method Details

#alibaba(host = '') ⇒ Hash

Alibaba vendor specific settings and headers

Parameters:

  • host (String) (defaults to: '')

Returns:

  • (Hash)

    Returns a hash of { dfront: [domain1, domain2], headers: {}}



56
57
58
59
60
61
62
63
64
65
66
# File 'lib/chkdfront/providers.rb', line 56

def alibaba(host='')
  {
      name:    'Alibaba',
      dfront:  ['kunlungr.com'],
      headers: {
          'Host'       => host,
          'User-Agent' => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:65.0) Gecko/20100101 Firefox/65.0",
          'Connection' => 'close'
      }
  }
end

#amazon(host = '') ⇒ Hash

Amazon vendor specific settings and headers

Parameters:

  • host (String) (defaults to: '')

Returns:

  • (Hash)

    Returns a hash of { dfront: [domain1, domain2], headers: {}}



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/chkdfront/providers.rb', line 24

def amazon(host='')
  {
      name:    'Amazon',
      dfront:  ['cloudfront.net'],
      headers: {
          'Host'       => host,
          'User-Agent' => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:65.0) Gecko/20100101 Firefox/65.0",
          'Connection' => 'close'
      }
  }
end

#azure(host = '') ⇒ Hash

Azure vendor specific settings and headers

Parameters:

  • host (String) (defaults to: '')

Returns:

  • (Hash)

    Returns a hash of { dfront: [domain1, domain2], headers: {}}



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/chkdfront/providers.rb', line 40

def azure(host='')
  {
      name:    'Azure',
      dfront:  ['azureedge.net'],
      headers: {
        'Host'       => host,
        'User-Agent' => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:65.0) Gecko/20100101 Firefox/65.0",
        'Connection' => 'close'
      }
  }
end

#get_provider(provider, domain_front) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/chkdfront/providers.rb', line 4

def get_provider(provider, domain_front)
  if domain_front.port
    host = "#{domain_front.host}:#{domain_front.port}"
  else
    host = domain_front.host
  end
  case provider
  when :amazon  then  amazon(host)
  when :azure   then  azure(host)
  when :alibaba then  alibaba(host)
  else
    puts "Unknown Provider!!!!: #{provider}"
    return false
  end
end