Allow binding to specific address and port
This commit is contained in:
parent
d74efbfd08
commit
0d1ef0aebe
|
@ -406,7 +406,7 @@ class DataCenter
|
||||||
$combos = \array_unique($combos, SORT_REGULAR);
|
$combos = \array_unique($combos, SORT_REGULAR);
|
||||||
}
|
}
|
||||||
/* @var $context \Amp\ConnectContext */
|
/* @var $context \Amp\ConnectContext */
|
||||||
$context = $context ?? (new ConnectContext())->withMaxAttempts(1)->withConnectTimeout(1000 * $this->settings->getTimeout());
|
$context = $context ?? (new ConnectContext())->withMaxAttempts(1)->withConnectTimeout(1000 * $this->settings->getTimeout())->withBindTo($this->settings->getBindTo());
|
||||||
foreach ($combos as $combo) {
|
foreach ($combos as $combo) {
|
||||||
foreach ([true, false] as $useDoH) {
|
foreach ([true, false] as $useDoH) {
|
||||||
$ipv6Combos = [
|
$ipv6Combos = [
|
||||||
|
|
|
@ -91,6 +91,11 @@ class Connection extends SettingsAbstract
|
||||||
*/
|
*/
|
||||||
protected bool $useDoH = true;
|
protected bool $useDoH = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bind on specific address and port.
|
||||||
|
*/
|
||||||
|
private ?string $bindTo = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Subdomains of web.telegram.org for https protocol.
|
* Subdomains of web.telegram.org for https protocol.
|
||||||
*/
|
*/
|
||||||
|
@ -623,4 +628,28 @@ class Connection extends SettingsAbstract
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get bind on specific address and port.
|
||||||
|
*
|
||||||
|
* @return ?string
|
||||||
|
*/
|
||||||
|
public function getBindTo(): ?string
|
||||||
|
{
|
||||||
|
return $this->bindTo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set bind on specific address and port.
|
||||||
|
*
|
||||||
|
* @param ?string $bindTo Bind on specific address and port.
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
*/
|
||||||
|
public function setBindTo(?string $bindTo): self
|
||||||
|
{
|
||||||
|
$this->bindTo = $bindTo;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue