Module: MTProto::DC

Defined in:
lib/mtproto/dc.rb

Overview

Datacenter IP addresses by number. An auth key is bound to the DC that issued it, so a saved session must reconnect to that same DC — resolve the host from auth_data rather than assuming a single endpoint.

Constant Summary collapse

PRODUCTION =
{
  1 => '149.154.175.53',
  2 => '149.154.167.51',
  3 => '149.154.175.100',
  4 => '149.154.167.91',
  5 => '91.108.56.130'
}.freeze
TEST =
{
  1 => '149.154.175.40',
  2 => '149.154.167.40',
  3 => '149.154.175.117'
}.freeze
DEFAULT_PORT =
443

Class Method Summary collapse

Class Method Details

.address(dc_number, test:) ⇒ Object



26
27
28
29
# File 'lib/mtproto/dc.rb', line 26

def address(dc_number, test:)
  map = test ? TEST : PRODUCTION
  { host: map[dc_number] || map.fetch(2), port: DEFAULT_PORT }
end