interceptUpgraded method
Tests whether a fully capable Conn is allowed.
At this point, the Conn a multiplexer has been selected. When rejecting a Conn, the gater can return a DisconnectReason.
Implementation
@override
(bool, DisconnectReason?) interceptUpgraded(Conn conn) {
if (isPeerBlocked(conn.remotePeer)) {
_logger.fine('Blocked upgraded connection: ${conn.remotePeer}');
return (
false,
DisconnectReason(
code: 1,
message: 'Peer is blocked',
),
);
}
if (isConnBlocked(conn.id)) {
_logger.fine('Blocked upgraded connection: ${conn.id}');
return (
false,
DisconnectReason(
code: 2,
message: 'Connection is blocked',
),
);
}
return (true, null);
}