Update proxy docs
This commit is contained in:
parent
b6152298e3
commit
733a119e0c
@ -7,15 +7,57 @@ image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png
|
|||||||
|
|
||||||
You can use a proxy with MadelineProto.
|
You can use a proxy with MadelineProto.
|
||||||
|
|
||||||
There are two ways to do this: either buy a pre-made Socks5 or HTTP proxy for 10$, or build your own proxy.
|
There are three ways to do this:
|
||||||
|
|
||||||
|
* [Use pre-built Socks5 proxy](#socks5-proxy)
|
||||||
|
* [Use pre-built HTTP proxy](#http-proxy)
|
||||||
|
* [Build your own proxy](#build-your-proxy)
|
||||||
|
|
||||||
|
|
||||||
## Buying a proxy class
|
## Socks5 proxy
|
||||||
|
|
||||||
Just send 10$ to paypal.me/danog, specifying the the proxy you wish to receive and your telegram username.
|
No password:
|
||||||
|
|
||||||
|
```
|
||||||
|
$settings['connection_settings']['all']['proxy'] = '\SocksProxy';
|
||||||
|
$settings['connection_settings']['all']['proxy_extra'] = ['address' => $proxy_address, 'port' => $proxy_port];
|
||||||
|
|
||||||
|
$MadelineProto = new \danog\MadelineProto\API('session.madeline', $settings);
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
## Building a proxy class
|
With password:
|
||||||
|
|
||||||
|
```
|
||||||
|
$settings['connection_settings']['all']['proxy'] = '\SocksProxy';
|
||||||
|
$settings['connection_settings']['all']['proxy_extra'] = ['address' => $proxy_address, 'port' => $proxy_port, 'username' => 'user', 'password' => 'afnjasf'];
|
||||||
|
|
||||||
|
$MadelineProto = new \danog\MadelineProto\API('session.madeline', $settings);
|
||||||
|
```
|
||||||
|
|
||||||
|
## HTTP proxy
|
||||||
|
|
||||||
|
No password:
|
||||||
|
|
||||||
|
```
|
||||||
|
$settings['connection_settings']['all']['proxy'] = '\HttpProxy';
|
||||||
|
$settings['connection_settings']['all']['proxy_extra'] = ['address' => $proxy_address, 'port' => $proxy_port];
|
||||||
|
|
||||||
|
$MadelineProto = new \danog\MadelineProto\API('session.madeline', $settings);
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
With password:
|
||||||
|
|
||||||
|
```
|
||||||
|
$settings['connection_settings']['all']['proxy'] = '\HttpProxy';
|
||||||
|
$settings['connection_settings']['all']['proxy_extra'] = ['address' => $proxy_address, 'port' => $proxy_port, 'username' => 'user', 'password' => 'afnjasf'];
|
||||||
|
|
||||||
|
$MadelineProto = new \danog\MadelineProto\API('session.madeline', $settings);
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Build your proxy
|
||||||
|
|
||||||
```php
|
```php
|
||||||
class MyProxy implements \danog\MadelineProto\Proxy
|
class MyProxy implements \danog\MadelineProto\Proxy
|
||||||
@ -124,4 +166,4 @@ Can return additional HTTP headers to use when the HTTP protocol is being used.
|
|||||||
|
|
||||||
Returns the resource used for socket communication: should call `$socket->getResource()`.
|
Returns the resource used for socket communication: should call `$socket->getResource()`.
|
||||||
|
|
||||||
<a href="https://docs.madelineproto.xyz/docs/CONTRIB.html">Next section</a>
|
<a href="https://docs.madelineproto.xyz/docs/CONTRIB.html">Next section</a>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user