Connect Manager

EndpointGuard

FinalYes

Валидация endpoint, DNS-resolve и защита от SSRF / DNS-rebinding.

Tags
SuppressWarnings

("PHPMD.CyclomaticComplexity")

("PHPMD.NPathComplexity")

("PHPMD.ShortVariable")

("PHPMD.ExcessiveClassComplexity")

("PHPMD.ErrorControlOperator")

Table of Contents

Methods

__construct()  : mixed
assertAllowed()  : void
Проверяет endpoint согласно опциям безопасности (без пиннинга).
assertConnectedPeer()  : void
Повторная проверка адреса пира после connect (анти-rebinding).
extractHost()  : string|null
Извлекает host из endpoint (host:port, scheme://host, unix-path).
isBlockedHost()  : bool
Проверяет, является ли host частным/зарезервированным (с DNS для имён).
prepare()  : PinnedEndpoint
Проверяет endpoint и возвращает IP-pinned вариант для connect.
resolvePublicIps()  : array<int, string>
Резолвит hostname и проверяет, что все адреса публичные.

Methods

assertConnectedPeer()

Повторная проверка адреса пира после connect (анти-rebinding).

public assertConnectedPeer(mixed $stream, ConnectionOptions $options) : void
Parameters
$stream : mixed

Открытый stream resource

$options : ConnectionOptions
Tags
throws
SecurityException

extractHost()

Извлекает host из endpoint (host:port, scheme://host, unix-path).

public extractHost(string $endpoint) : string|null
Parameters
$endpoint : string
Return values
string|null

isBlockedHost()

Проверяет, является ли host частным/зарезервированным (с DNS для имён).

public isBlockedHost(string $host) : bool
Parameters
$host : string
Return values
bool

resolvePublicIps()

Резолвит hostname и проверяет, что все адреса публичные.

public resolvePublicIps(string $host) : array<int, string>
Parameters
$host : string
Tags
throws
SecurityException
Return values
array<int, string>
On this page

Search results