Public Access
105 lines
4.3 KiB
C#
105 lines
4.3 KiB
C#
using DodoSSH.Domain;
|
|
|
|
namespace DodoSSH.Api.Features.Relay;
|
|
|
|
/// <summary>Source-generated log messages for the relay.</summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// Ids, counts and reasons. Never a ticket, which is a bearer credential for thirty seconds, and never
|
|
/// the target's address: that is in the audit table, where retention is the operator's decision, and
|
|
/// copying it into a log would make it the log pipeline's decision too.
|
|
/// </para>
|
|
/// <para>
|
|
/// <see cref="TargetRejected"/> is the one place the reason for a refused target is written down. The
|
|
/// client is told nothing specific, deliberately — see <c>RelayTicketEndpoint</c> — so this line is how
|
|
/// an operator answers "why will the relay not reach this host".
|
|
/// </para>
|
|
/// </remarks>
|
|
internal static partial class RelayLog
|
|
{
|
|
[LoggerMessage(
|
|
EventId = 2301,
|
|
Level = LogLevel.Information,
|
|
Message = "Relay ticket refused for user {UserId} and host {HostId}: {Reason}.")]
|
|
internal static partial void TargetRejected(ILogger logger, Guid userId, Guid hostId, string reason);
|
|
|
|
[LoggerMessage(
|
|
EventId = 2302,
|
|
Level = LogLevel.Debug,
|
|
Message = "Relay ticket issued to user {UserId} for host {HostId}, session {SessionId}, with "
|
|
+ "{AddressCount} permitted address(es).")]
|
|
internal static partial void TicketIssued(
|
|
ILogger logger,
|
|
Guid userId,
|
|
Guid hostId,
|
|
Guid sessionId,
|
|
int addressCount);
|
|
|
|
/// <remarks>
|
|
/// The session id is known only for a ticket that verified and had already been spent, which is the
|
|
/// case worth an operator's attention: a replay, or a client retrying a redemption it thinks failed.
|
|
/// </remarks>
|
|
[LoggerMessage(
|
|
EventId = 2303,
|
|
Level = LogLevel.Information,
|
|
Message = "Relay ticket refused at the socket (session {SessionId}): forged, expired or already used.")]
|
|
internal static partial void TicketRefused(ILogger logger, Guid? sessionId);
|
|
|
|
[LoggerMessage(
|
|
EventId = 2304,
|
|
Level = LogLevel.Information,
|
|
Message = "Relay session refused for user {UserId}: a session limit is met, with {SessionCount} "
|
|
+ "open on this node.")]
|
|
internal static partial void LimitReached(ILogger logger, Guid userId, int sessionCount);
|
|
|
|
[LoggerMessage(
|
|
EventId = 2305,
|
|
Level = LogLevel.Information,
|
|
Message = "Relay session {SessionId} could not reach host {HostId} on any permitted address.")]
|
|
internal static partial void TargetUnreachable(ILogger logger, Guid sessionId, Guid hostId);
|
|
|
|
[LoggerMessage(
|
|
EventId = 2306,
|
|
Level = LogLevel.Debug,
|
|
Message = "Relay session {SessionId} opened for user {UserId} to host {HostId}; {SessionCount} "
|
|
+ "open on this node.")]
|
|
internal static partial void SessionOpened(
|
|
ILogger logger,
|
|
Guid sessionId,
|
|
Guid userId,
|
|
Guid hostId,
|
|
int sessionCount);
|
|
|
|
[LoggerMessage(
|
|
EventId = 2307,
|
|
Level = LogLevel.Debug,
|
|
Message = "Relay session {SessionId} closed ({Reason}) after {ClientToTarget} byte(s) up and "
|
|
+ "{TargetToClient} down.")]
|
|
internal static partial void SessionClosed(
|
|
ILogger logger,
|
|
Guid sessionId,
|
|
RelayCloseReason reason,
|
|
long clientToTarget,
|
|
long targetToClient);
|
|
|
|
/// <remarks>
|
|
/// A warning rather than an error: the session itself is over and was fine. What is lost is the
|
|
/// audit row's second half, which leaves it looking like a session still open.
|
|
/// </remarks>
|
|
[LoggerMessage(
|
|
EventId = 2308,
|
|
Level = LogLevel.Warning,
|
|
Message = "Relay session {SessionId} ended but its audit record could not be closed.")]
|
|
internal static partial void AuditCloseFailed(ILogger logger, Guid sessionId, Exception exception);
|
|
|
|
/// <remarks>
|
|
/// A warning: the sessions it was checking stay open, which is how they all behaved before the check
|
|
/// existed, and each still ends at its idle timeout or its lifetime.
|
|
/// </remarks>
|
|
[LoggerMessage(
|
|
EventId = 2309,
|
|
Level = LogLevel.Warning,
|
|
Message = "Re-checking relay access for user {UserId} after an access change failed.")]
|
|
internal static partial void AccessRecheckFailed(ILogger logger, Guid userId, Exception exception);
|
|
}
|