danog\MadelineProto\Settings\Connection
Author: Daniil Gentili daniil@daniil.it
Connection settings.
Method list:
__construct()init(): voidgetProtocol(): stringsetProtocol(class-string<\danog\MadelineProto\Stream\MTProtoBufferInterface> $protocol): selfgetIpv6(): boolsetIpv6(bool $ipv6): selfgetSslSubdomains(): arraysetSslSubdomains(array $sslSubdomains): selfgetMaxMediaSocketCount(): intsetMaxMediaSocketCount(int $maxMediaSocketCount): selfgetRobinPeriod(): intsetRobinPeriod(int $robinPeriod): selfgetProxies(): array<class-string<\danog\MadelineProto\Stream\StreamInterface>, array>addProxy(class-string<\danog\MadelineProto\Stream\StreamInterface> $proxy, array $extra = []): selfsetProxies(array<class-string<\danog\MadelineProto\Stream\StreamInterface>, list<array>> $proxies): selfclearProxies(): selfremoveProxy(string $proxy, array $extra): selfgetObfuscated(): boolsetObfuscated(bool $obfuscated): selfgetTestMode(): boolsetTestMode(bool $testMode): selfgetTransport(): class-string<\danog\MadelineProto\Stream\RawStreamInterface>setTransport(class-string<\danog\MadelineProto\Stream\RawStreamInterface> $transport): selfgetRetry(): boolsetRetry(bool $retry): selfgetTimeout(): floatsetTimeout(float $timeout): selfgetPingInterval(): intsetPingInterval(int $pingInterval): selfgetUseDoH(): boolsetUseDoH(bool $useDoH): selfgetBindTo(): ?stringsetBindTo((null|string) $bindTo): selfgetRsaKeys(): arraysetRsaKeys(array $rsaKeys): selfgetTestRsaKeys(): arraysetTestRsaKeys(array $testRsaKeys): self
Methods:
__construct()
init(): void
getProtocol(): string
Get protocol identifier.
setProtocol(class-string<\danog\MadelineProto\Stream\MTProtoBufferInterface> $protocol): self
Set protocol identifier.
Available MTProto transport protocols (smaller overhead is better):
\danog\MadelineProto\Stream\MTProtoTransport\AbridgedStream: Lightest protocol available- Overhead: Very small
- Minimum envelope length: 1 byte (length)
- Maximum envelope length: 4 bytes (length)
- Overhead: Very small
\danog\MadelineProto\Stream\MTProtoTransport\IntermediateStream: I guess they like having multiple protocols- Overhead: small
- Minimum envelope length: 4 bytes (length)
- Maximum envelope length: 4 bytes (length)
- Overhead: small
\danog\MadelineProto\Stream\MTProtoTransport\IntermediatePaddedStream: Padded version of the intermediate protocol, to use with obfuscation enabled to bypass ISP blocks- Overhead: small-medium
- Minimum envelope length: random
- Maximum envelope length: random
- Overhead: small-medium
\danog\MadelineProto\Stream\MTProtoTransport\FullStream: The basic MTProto transport protocolOverhead: medium
Minimum envelope length: 12 bytes (length+seqno+crc)
Maximum envelope length: 12 bytes (length+seqno+crc)
Pros:
Initial integrity check with crc32
Transport sequence number check
Cons:
Initial integrity check with crc32 is not that useful since the TCP protocol already uses it internally
Transport sequence number check is also not that useful since transport sequence numbers are not encrypted and thus cannot be used to avoid replay attacks, and MadelineProto already uses MTProto sequence numbers and message ids for that.
\danog\MadelineProto\Stream\MTProtoTransport\HttpStream: MTProto over HTTP for browsers and webhosts- Overhead: medium
- Pros:
- Can be used on restricted webhosts or browsers
- Cons:
- Very big envelope length
- Overhead: medium
\danog\MadelineProto\Stream\MTProtoTransport\HttpsStream: MTProto over HTTPS for browsers and webhosts, very secure- Overhead: high
- Pros:
- Can be used on restricted webhosts or browsers
- Provides an additional layer of security by trasmitting data over TLS
- Integrity checks with HMAC built into TLS
- Sequence number checks built into TLS
- Cons:
- Very big envelope length
- Requires an additional round of encryption
- Overhead: high
Parameters:
$protocol:class-string<\danog\MadelineProto\Stream\MTProtoBufferInterface>Protocol identifier
See also:
\danog\MadelineProto\Stream\MTProtoBufferInterface
getIpv6(): bool
Get whether to use ipv6.
setIpv6(bool $ipv6): self
Set whether to use ipv6.
Parameters:
$ipv6:boolWhether to use ipv6
getSslSubdomains(): array
Get subdomains of web.telegram.org for https protocol.
setSslSubdomains(array $sslSubdomains): self
Set subdomains of web.telegram.org for https protocol.
Parameters:
$sslSubdomains:arraySubdomains of web.telegram.org for https protocol.
getMaxMediaSocketCount(): int
Get maximum media socket count.
setMaxMediaSocketCount(int $maxMediaSocketCount): self
Set maximum media socket count.
Parameters:
$maxMediaSocketCount:intMaximum media socket count.
getRobinPeriod(): int
Get robin period (seconds).
setRobinPeriod(int $robinPeriod): self
Set robin period (seconds).
Parameters:
$robinPeriod:intRobin period (seconds).
getProxies(): array<class-string<\danog\MadelineProto\Stream\StreamInterface>, array>
Get proxy identifiers.
See also:
\danog\MadelineProto\Stream\StreamInterface
addProxy(class-string<\danog\MadelineProto\Stream\StreamInterface> $proxy, array $extra = []): self
Add proxy identifier to list, one of:.
\danog\MadelineProto\Stream\MTProtoTransport\ObfuscatedStream::class\danog\MadelineProto\Stream\Proxy\HttpProxy::class\danog\MadelineProto\Stream\Proxy\SocksProxy::class
Parameters:
$proxy:class-string<\danog\MadelineProto\Stream\StreamInterface>Proxy identifier$extra:arrayExtra
See also:
\danog\MadelineProto\Stream\StreamInterface
setProxies(array<class-string<\danog\MadelineProto\Stream\StreamInterface>, list<array>> $proxies): self
Set proxies.
The key must be one of:
\danog\MadelineProto\Stream\MTProtoTransport\ObfuscatedStream::class\danog\MadelineProto\Stream\Proxy\HttpProxy::class\danog\MadelineProto\Stream\Proxy\SocksProxy::class
The value must be a list of extra (URI, username, password) for that proxy.
Parameters:
$proxies:array<class-string<\danog\MadelineProto\Stream\StreamInterface>, list<array>>Proxies
See also:
\danog\MadelineProto\Stream\StreamInterface
clearProxies(): self
Clear proxies.
removeProxy(string $proxy, array $extra): self
Remove specific proxy pair.
Parameters:
$proxy:string$extra:array
getObfuscated(): bool
Get whether to use the obfuscated protocol: useful to bypass ISP blocks.
setObfuscated(bool $obfuscated): self
Set whether to use the obfuscated protocol: useful to bypass ISP blocks.
Parameters:
$obfuscated:boolWhether to use the obfuscated protocol.
getTestMode(): bool
Get whether we’re in test mode.
setTestMode(bool $testMode): self
Set whether we’re in test mode.
Parameters:
$testMode:boolWhether we’re in test mode.
getTransport(): class-string<\danog\MadelineProto\Stream\RawStreamInterface>
Get transport identifier.
See also:
\danog\MadelineProto\Stream\RawStreamInterface
setTransport(class-string<\danog\MadelineProto\Stream\RawStreamInterface> $transport): self
Sets the transport protocol to use when connecting to telegram. Not supported by HTTP and HTTPS protocols, obfuscation must be enabled.
danog\MadelineProto\Stream\Transport: Default TCP transportdanog\MadelineProto\Stream\WsTransport: Plain websocket transportdanog\MadelineProto\Stream\WssTransport: TLS websocket transport
Parameters:
$transport:class-string<\danog\MadelineProto\Stream\RawStreamInterface>Transport identifier.
See also:
\danog\MadelineProto\Stream\RawStreamInterface
getRetry(): bool
Get whether to retry connection.
setRetry(bool $retry): self
Set whether to retry connection.
Parameters:
$retry:boolWhether to retry connection.
getTimeout(): float
Get connection timeout.
setTimeout(float $timeout): self
Set connection timeout.
Parameters:
$timeout:floatConnection timeout.
getPingInterval(): int
Get ping interval.
setPingInterval(int $pingInterval): self
Set ping interval.
Parameters:
$pingInterval:intPing interval
getUseDoH(): bool
Get whether to use DNS over HTTPS.
setUseDoH(bool $useDoH): self
Set whether to use DNS over HTTPS.
Parameters:
$useDoH:boolWhether to use DNS over HTTPS
getBindTo(): ?string
Get bind on specific address and port.
setBindTo((null|string) $bindTo): self
Set bind on specific address and port.
Parameters:
$bindTo:(null|string)Bind on specific address and port.
getRsaKeys(): array
Get RSA keys.
setRsaKeys(array $rsaKeys): self
Set RSA keys.
Parameters:
$rsaKeys:arrayRSA keys
getTestRsaKeys(): array
Get test RSA keys.
setTestRsaKeys(array $testRsaKeys): self
Set test RSA keys.
Parameters:
$testRsaKeys:arrayTest RSA keys
Generated by danog/phpdoc