Update to latest protobuf structure

This commit is contained in:
Peter 2021-02-21 17:23:48 +01:00
parent f6ce972034
commit 5b4366a5c6
Signed by: prskr
GPG key ID: C1DB5D2E8DB512F9
6 changed files with 14 additions and 15 deletions

View file

@ -11,7 +11,7 @@ namespace INetMock.Client.Audit.Client
{
public class AuditApiClient : IAuditApiClient
{
private readonly Rpc.Audit.AuditClient _auditClient;
private readonly AuditService.AuditServiceClient _auditClient;
public AuditApiClient(string address, GrpcChannelOptions? options = null) : this(new Uri(address), options)
{
@ -24,7 +24,7 @@ namespace INetMock.Client.Audit.Client
public AuditApiClient(ChannelBase channel)
{
_auditClient = new Rpc.Audit.AuditClient(channel);
_auditClient = new AuditService.AuditServiceClient(channel);
}
public async Task<IEnumerable<string>> ListSinksAsync(CancellationToken token = default)

View file

@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using Google.Protobuf.WellKnownTypes;
using INetMock.Client.Audit.Details;
namespace INetMock.Client.Audit
{

View file

@ -24,9 +24,9 @@ namespace INetMock.Client.Audit
Id = entity.Id;
Timestamp = entity.Timestamp.ToDateTimeOffset();
Transport = entity.Transport;
SourceIp = new IPAddress(entity.SourceIP.Span);
SourceIp = new IPAddress(entity.SourceIp.Span);
SourcePort = Convert.ToUInt16(entity.SourcePort);
DestinationIp = new IPAddress(entity.DestinationIP.Span);
DestinationIp = new IPAddress(entity.DestinationIp.Span);
DestinationPort = Convert.ToUInt16(entity.DestinationPort);
TlsDetails = entity.Tls;
Application = entity.Application;

View file

@ -1,6 +1,5 @@
using System.Net.Http.Headers;
using Google.Protobuf.Collections;
using INetMock.Client.Audit.Details;
namespace INetMock.Client.Audit
{

View file

@ -1,14 +1,15 @@
using System.Threading;
using System.Threading.Tasks;
using Grpc.Core;
using INetMock.Client.Rpc;
namespace INetMock.Client.Audit.Serialization
{
public sealed class EventServerStreamReader : IProtoEventReader
{
private readonly AsyncServerStreamingCall<EventEntity> _asyncEventStream;
private readonly AsyncServerStreamingCall<WatchEventsResponse> _asyncEventStream;
public EventServerStreamReader(AsyncServerStreamingCall<EventEntity> asyncEventStream)
public EventServerStreamReader(AsyncServerStreamingCall<WatchEventsResponse> asyncEventStream)
{
_asyncEventStream = asyncEventStream;
}
@ -16,7 +17,7 @@ namespace INetMock.Client.Audit.Serialization
public async Task<EventEntity?> ReadAsync(CancellationToken token = default)
{
if (!await _asyncEventStream.ResponseStream.MoveNext(token)) return null;
return _asyncEventStream.ResponseStream.Current;
return _asyncEventStream.ResponseStream.Current.Entity;
}
public void Dispose() => _asyncEventStream.Dispose();

View file

@ -14,11 +14,11 @@
</PackageReference>
</ItemGroup>
<ItemGroup>
<Protobuf Include="proto/audit/event_entity.proto" GrpcServices="Client" AdditionalImportDirs="./proto/" />
<Protobuf Include="proto/audit/details/dns_details.proto" GrpcServices="Client" AdditionalImportDirs="./proto/" />
<Protobuf Include="proto/audit/details/http_details.proto" GrpcServices="Client" AdditionalImportDirs="./proto/" />
<Protobuf Include="proto/rpc/audit.proto" GrpcServices="Client" AdditionalImportDirs="./proto/" />
<Protobuf Include="proto/rpc/health.proto" GrpcServices="Client" AdditionalImportDirs="./proto/" />
<Protobuf Include="proto/rpc/pcap.proto" GrpcServices="Client" AdditionalImportDirs="./proto/" />
<Protobuf Include="proto/audit/v1/event_entity.proto" GrpcServices="Client" AdditionalImportDirs="./proto/" />
<Protobuf Include="proto/audit/v1/dns_details.proto" GrpcServices="Client" AdditionalImportDirs="./proto/" />
<Protobuf Include="proto/audit/v1/http_details.proto" GrpcServices="Client" AdditionalImportDirs="./proto/" />
<Protobuf Include="proto/rpc/v1/audit.proto" GrpcServices="Client" AdditionalImportDirs="./proto/" />
<Protobuf Include="proto/rpc/v1/health.proto" GrpcServices="Client" AdditionalImportDirs="./proto/" />
<Protobuf Include="proto/rpc/v1/pcap.proto" GrpcServices="Client" AdditionalImportDirs="./proto/" />
</ItemGroup>
</Project>