/*************************************************************************
* ModernUO *
* Copyright 2019-2026 - ModernUO Development Team *
* Email: hi@modernuo.com *
* File: IBanReporter.cs *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see . *
*************************************************************************/
using System;
using System.Net;
using System.Threading;
namespace Server.Network.Bans;
///
/// A contribution sink behind . Reporters receive locally-decided bans
/// (manual admin bans, rate-limit trips, blocklist promotions) and forward them to an external system
/// (e.g. CrowdSec), which distributes them to OS-level bouncers. Reporters never answer the accept-path
/// membership query — that is an 's job.
///
public interface IBanReporter
{
/// Stable id for logging/config (e.g. crowdsec).
string Name { get; }
/// Reads configuration. No network or file I/O here.
void Register();
/// Starts background delivery. The token is cancelled on shutdown.
void Start(CancellationToken token);
/// Flushes and tears down background delivery.
void Stop();
///
/// Enqueues a ban contribution. MUST be non-blocking and safe on the accept path: it may only
/// enqueue (bounded, drop-on-overflow) and never perform synchronous I/O.
///
/// or negative = use the reporter's default duration.
/// Short slug (manual, rate-limit) used as the scenario suffix.
void Report(IPAddress address, TimeSpan ttl, string reason);
/// True if this reporter can retract a previously-reported ban.
bool CanRetract { get; }
/// Enqueues a retraction (e.g. a manual unban). No-op if unsupported.
void Retract(IPAddress address);
}