-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(repeater): msgpack serialization
fixes #165
- Loading branch information
Showing
15 changed files
with
131 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,19 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Net.Http; | ||
using MessagePack; | ||
using SecTester.Core.Bus; | ||
using SecTester.Repeater.Runners; | ||
|
||
namespace SecTester.Repeater.Bus; | ||
|
||
[MessagePackObject(true)] | ||
public record IncomingRequest(Uri Url) : Event, IRequest | ||
{ | ||
public string? Body { get; init; } | ||
public HttpMethod Method { get; init; } = HttpMethod.Get; | ||
public Protocol Protocol { get; init; } = Protocol.Http; | ||
public Uri Url { get; init; } = Url ?? throw new ArgumentNullException(nameof(Url)); | ||
|
||
public IEnumerable<KeyValuePair<string, IEnumerable<string>>> Headers { get; init; } = | ||
public string? Body { get; set; } | ||
public HttpMethod Method { get; set; } = HttpMethod.Get; | ||
public Protocol Protocol { get; set; } = Protocol.Http; | ||
public Uri Url { get; set; } = Url ?? throw new ArgumentNullException(nameof(Url)); | ||
public IEnumerable<KeyValuePair<string, IEnumerable<string>>> Headers { get; set; } = | ||
new List<KeyValuePair<string, IEnumerable<string>>>(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,17 @@ | ||
using System.Collections.Generic; | ||
using MessagePack; | ||
using SecTester.Repeater.Runners; | ||
|
||
namespace SecTester.Repeater.Bus; | ||
|
||
[MessagePackObject(true)] | ||
public record OutgoingResponse : IResponse | ||
{ | ||
public int? StatusCode { get; init; } | ||
|
||
public string? Body { get; init; } | ||
public string? Message { get; init; } | ||
|
||
public string? ErrorCode { get; init; } | ||
|
||
public Protocol Protocol { get; init; } = Protocol.Http; | ||
|
||
public IEnumerable<KeyValuePair<string, IEnumerable<string>>> Headers { get; init; } = | ||
public int? StatusCode { get; set; } | ||
public string? Body { get; set; } | ||
public string? Message { get; set; } | ||
public string? ErrorCode { get; set; } | ||
public Protocol Protocol { get; set; } = Protocol.Http; | ||
public IEnumerable<KeyValuePair<string, IEnumerable<string>>> Headers { get; set; } = | ||
new List<KeyValuePair<string, IEnumerable<string>>>(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using MessagePack; | ||
|
||
namespace SecTester.Repeater.Bus; | ||
|
||
[MessagePackObject(true)] | ||
public sealed record RepeaterError | ||
{ | ||
public string Message { get; set; } = null!; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using MessagePack; | ||
|
||
namespace SecTester.Repeater.Bus; | ||
|
||
[MessagePackObject(true)] | ||
public sealed record RepeaterInfo | ||
{ | ||
public string RepeaterId { get; set; } = null!; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using MessagePack; | ||
|
||
namespace SecTester.Repeater.Bus; | ||
|
||
[MessagePackObject(true)] | ||
public sealed record RepeaterVersion | ||
{ | ||
public string Version { get; set; } = null!; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using SocketIOClient; | ||
|
||
namespace SecTester.Repeater.Bus; | ||
|
||
internal class SocketIoMessage : ISocketIoMessage | ||
{ | ||
private readonly SocketIOResponse _response; | ||
|
||
public SocketIoMessage(SocketIOResponse response) | ||
{ | ||
_response = response ?? throw new ArgumentNullException(nameof(response)); | ||
} | ||
|
||
public virtual T GetValue<T>(int index = 0) => _response.GetValue<T>(index); | ||
|
||
public virtual Task CallbackAsync(params object[] data) => _response.CallbackAsync(data); | ||
|
||
public virtual Task CallbackAsync(CancellationToken cancellationToken, params object[] data) => _response.CallbackAsync(cancellationToken, data); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.