Files
Flypaper/src/Flypaper.Core/Runtime/CountingTrapChannel.cs
T
TomandClaude Opus 5.5 a25072e6fb
Build and deploy / build (push) Successful in 1m28s
Build and deploy / deploy (push) Successful in 20s
Add link labyrinth, static robots.txt and robots bait paths
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 23:57:52 +01:00

24 lines
597 B
C#

using Flypaper.Core.Abstractions;
using Flypaper.Core.Models;
namespace Flypaper.Core.Runtime;
internal sealed class CountingTrapChannel(ITrapChannel inner) : ITrapChannel
{
private long _bytesSent;
public TrapSession Session => inner.Session;
public string? Path => inner.Path;
public string? Host => inner.Host;
public long BytesSent => Interlocked.Read(ref _bytesSent);
public async ValueTask WriteAsync(ReadOnlyMemory<byte> data, CancellationToken ct)
{
await inner.WriteAsync(data, ct);
Interlocked.Add(ref _bytesSent, data.Length);
}
}