Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct structure #10

Closed
wants to merge 1 commit into from
Closed

Correct structure #10

wants to merge 1 commit into from

Conversation

2012mjm
Copy link
Contributor

@2012mjm 2012mjm commented Oct 5, 2016

No description provided.

Copy link
Owner

@danog danog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This structure won't work, since (as you can see in https://github.com/danog/MadelineProto/blob/master/src/danog/MadelineProto/MTProto.php#L25) connection now contains an array of datacenters, not just one.
I think we can only keep app_info, and inserting authorization with rsa_key would be also nice.

@2012mjm
Copy link
Contributor Author

2012mjm commented Oct 5, 2016

@danog
Copy link
Owner

danog commented Oct 5, 2016

I haven't updated that part of the code yet.
The settings array that is going to be used is https://github.com/danog/MadelineProto/blob/master/src/danog/MadelineProto/MTProto.php#L25

@2012mjm
Copy link
Contributor Author

2012mjm commented Oct 5, 2016

For the following array

'connection' => [
                'dc_list' => [
                    2 => [
                        'ip_address'    => '149.154.167.50',
                        'port'          => '443',
                        'protocol'      => 'tcp_full',
                    ],
                ],

The following code is correct

$this->sock = new Connection($this->settings['connection']['dc_list'][2]['ip_address'], $this->settings['connection']['dc_list'][2]['port'], $this->settings['connection']['dc_list'][2]['protocol']);

@danog
Copy link
Owner

danog commented Oct 5, 2016

Yep.
Even if it's better to implement the connections to all of the datacenters automagically in the Connections class (or another Datacenters class).

@2012mjm
Copy link
Contributor Author

2012mjm commented Oct 5, 2016

Yes, good idea

@2012mjm
Copy link
Contributor Author

2012mjm commented Oct 5, 2016

I found the following IP address and port in webogram source

    var dcOptions = Config.Modes.test
      ? [
        {id: 1, host: '149.154.175.10',  port: 80},
        {id: 2, host: '149.154.167.40',  port: 80},
        {id: 3, host: '149.154.175.117', port: 80}
      ]
      : [
        {id: 1, host: '149.154.175.50',  port: 80},
        {id: 2, host: '149.154.167.51',  port: 80},
        {id: 3, host: '149.154.175.100', port: 80},
        {id: 4, host: '149.154.167.91',  port: 80},
        {id: 5, host: '149.154.171.5',   port: 80}
      ]

@danog
Copy link
Owner

danog commented Oct 5, 2016

@2012mjm Yeah, we could create two subarrays in the connection subarray, testing and main, each with the correct dc_list to be selected by a test_mode boolean in the main array.
But then there's the array for the https endpoints (flora, pluto, etc...), we gotta put 'em somewhere too...
Maybe some subarrays in the dc_list subarrays with the https and tcp/http endpoint separately (kek)

@danog danog closed this Oct 13, 2016
@xcgu xcgu mentioned this pull request Jan 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants