Match relay rejection prefixes with a label tolerance (#395)
Co-authored-by: Coracle-Bot <npub1klq6260@nostr.local>
This commit is contained in:
parent
cec44ab78b
commit
cffc0acfde
1 changed files with 7 additions and 2 deletions
|
|
@ -13,6 +13,8 @@ import {
|
|||
isClientClose,
|
||||
isClientNegOpen,
|
||||
isClientNegClose,
|
||||
matchReason,
|
||||
RelayReasonPrefix,
|
||||
} from "@welshman/net"
|
||||
import {
|
||||
BlockedRelayLists,
|
||||
|
|
@ -138,12 +140,15 @@ const mostlyRestrictedPolicy = (socket: Socket) => {
|
|||
|
||||
// NIP-01 reserves "blocked: " for a ban and "restricted: " for lacking permission.
|
||||
const countDetails = (details: string) => {
|
||||
if (details.startsWith("auth-required: ")) {
|
||||
if (matchReason(RelayReasonPrefix.AuthRequired, details)) {
|
||||
total--
|
||||
updateStatus()
|
||||
}
|
||||
|
||||
if (details.startsWith("restricted: ") || details.startsWith("blocked: ")) {
|
||||
if (
|
||||
matchReason(RelayReasonPrefix.Restricted, details) ||
|
||||
matchReason(RelayReasonPrefix.Blocked, details)
|
||||
) {
|
||||
refused++
|
||||
updateStatus(details)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue