measurement: name the kinds by protocol and action, add the http_request kind and QUIC settings
This commit is contained in:
1 parent
bf2a598891
commit
e77880d372
31 files changed
+938
-141
No files matched your search
@@ -0,0 +1,28 @@
|
||||
using MoShiro.Protocol;
|
||||
|
||||
namespace MoShiro.Protocol.Tests;
|
||||
|
||||
public sealed class TargetHostTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData("http_request", "https://Example.com/health?x=1", "https://example.com/health?x=1")]
|
||||
[InlineData("http_request", "http://192.0.2.1:8080", "http://192.0.2.1:8080/")]
|
||||
[InlineData("tcp_connect", "Example.com:443", "example.com:443")]
|
||||
[InlineData("tcp_connect", "192.0.2.1", "192.0.2.1")]
|
||||
[InlineData("tcp_connect", "[2001:db8::1]:443", "[2001:db8::1]:443")]
|
||||
[InlineData("icmp_ping", "2001:db8::1", "2001:db8::1")]
|
||||
public void Normalize_AcceptsTheTargetFormOfTheKind(string kind, string target, string expected) =>
|
||||
Assert.Equal(expected, TargetHost.Normalize(kind, target));
|
||||
|
||||
[Theory]
|
||||
[InlineData("http_request", "example.com")] // http 必须是 URL
|
||||
[InlineData("http_request", "ftp://example.com/")]
|
||||
[InlineData("http_request", "https://user:pw@example.com/")]
|
||||
[InlineData("tcp_connect", "https://example.com/")] // 其余 Kind 不能是 URL
|
||||
[InlineData("tcp_connect", "example.com:0")]
|
||||
[InlineData("tcp_connect", "exa mple.com")]
|
||||
[InlineData("tcp_connect", "-bad.example.com")]
|
||||
[InlineData("tcp_connect", "")]
|
||||
public void Normalize_RejectsTheWrongFormForTheKind(string kind, string target) =>
|
||||
Assert.Null(TargetHost.Normalize(kind, target));
|
||||
}
|
||||
Reference in new issue
Block a user