interceptAddrDial method
Tests whether we're permitted to dial the specified multiaddr for the given peer.
This is called by the network implementation after it has resolved the peer's addrs, and prior to dialling each.
Implementation
@override
bool interceptAddrDial(PeerId peerId, MultiAddr addr) {
// Check if the peer is blocked
if (isPeerBlocked(peerId)) {
_logger.fine('Blocked peer dial: $peerId');
return false;
}
// Check if the address is blocked
if (isAddrBlocked(addr)) {
_logger.fine('Blocked address dial: $addr');
return false;
}
// Check if the address is in a blocked subnet
if (isAddrInBlockedSubnet(addr)) {
_logger.fine('Blocked subnet dial: $addr');
return false;
}
return true;
}