Make the hold method configurable in the dashboard
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9a56fc5b48
commit
6b9bf3cd5f
40 files changed
+815
-134
No files matched your search
@@ -25,7 +25,7 @@ public sealed class TrapRunnerTests
|
||||
|
||||
var outcome = await CreateRunner(TimeSpan.FromSeconds(1)).RunAsync(
|
||||
Context(),
|
||||
_ =>
|
||||
(_, _) =>
|
||||
{
|
||||
opened = true;
|
||||
return ValueTask.FromResult<ITrapChannel>(_channel);
|
||||
@@ -59,7 +59,7 @@ public sealed class TrapRunnerTests
|
||||
var outcome = await CreateRunner(TimeSpan.FromMinutes(1)).RunAsync(Context(), Open, cts.Token);
|
||||
|
||||
outcome.ShouldBe(TrapOutcome.ClientAborted);
|
||||
_sink.Received(1).Publish(Arg.Is<TrapEvent>(e => e.Outcome == TrapOutcome.ClientAborted && e.Strategy == "html-drip"));
|
||||
_sink.Received(1).Publish(Arg.Is<TrapEvent>(e => e.Outcome == TrapOutcome.ClientAborted && e.Strategy == "html-drip 5-20ms 1-64B"));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -111,17 +111,16 @@ public sealed class TrapRunnerTests
|
||||
return lease;
|
||||
}
|
||||
|
||||
private ValueTask<ITrapChannel> Open(CancellationToken ct) => ValueTask.FromResult<ITrapChannel>(_channel);
|
||||
private ValueTask<ITrapChannel> Open(ITarpitStrategy strategy, CancellationToken ct) => ValueTask.FromResult<ITrapChannel>(_channel);
|
||||
|
||||
private TrapRunner CreateRunner(TimeSpan maxHoldDuration, bool ignorePrivateNetworks = true)
|
||||
{
|
||||
var drip = new HtmlDripStrategy(
|
||||
TestOptions.Monitor(new DripOptions { MinDelay = TimeSpan.FromMilliseconds(5), MaxDelay = TimeSpan.FromMilliseconds(20) }),
|
||||
new SeededRandomSource(7),
|
||||
TimeProvider.System);
|
||||
var dripOptions = TestOptions.Monitor(new DripOptions { MinDelay = TimeSpan.FromMilliseconds(5), MaxDelay = TimeSpan.FromMilliseconds(20) });
|
||||
var random = new SeededRandomSource(7);
|
||||
var drip = new HtmlDripStrategy(dripOptions, random, TimeProvider.System);
|
||||
return new TrapRunner(
|
||||
_governor,
|
||||
new ProtocolStrategySelector([drip]),
|
||||
new ConfiguredStrategySelector([drip], dripOptions, random),
|
||||
_sink,
|
||||
TestOptions.Monitor(new FlypaperOptions { MaxHoldDuration = maxHoldDuration, IgnorePrivateNetworks = ignorePrivateNetworks }),
|
||||
TimeProvider.System,
|
||||
|
||||
Reference in new issue
Block a user