Update to latest protobuf structure
This commit is contained in:
parent
f6ce972034
commit
5b4366a5c6
6 changed files with 14 additions and 15 deletions
|
@ -11,7 +11,7 @@ namespace INetMock.Client.Audit.Client
|
||||||
{
|
{
|
||||||
public class AuditApiClient : IAuditApiClient
|
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)
|
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)
|
public AuditApiClient(ChannelBase channel)
|
||||||
{
|
{
|
||||||
_auditClient = new Rpc.Audit.AuditClient(channel);
|
_auditClient = new AuditService.AuditServiceClient(channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<string>> ListSinksAsync(CancellationToken token = default)
|
public async Task<IEnumerable<string>> ListSinksAsync(CancellationToken token = default)
|
||||||
|
|
|
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
using Google.Protobuf.WellKnownTypes;
|
using Google.Protobuf.WellKnownTypes;
|
||||||
using INetMock.Client.Audit.Details;
|
|
||||||
|
|
||||||
namespace INetMock.Client.Audit
|
namespace INetMock.Client.Audit
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,9 +24,9 @@ namespace INetMock.Client.Audit
|
||||||
Id = entity.Id;
|
Id = entity.Id;
|
||||||
Timestamp = entity.Timestamp.ToDateTimeOffset();
|
Timestamp = entity.Timestamp.ToDateTimeOffset();
|
||||||
Transport = entity.Transport;
|
Transport = entity.Transport;
|
||||||
SourceIp = new IPAddress(entity.SourceIP.Span);
|
SourceIp = new IPAddress(entity.SourceIp.Span);
|
||||||
SourcePort = Convert.ToUInt16(entity.SourcePort);
|
SourcePort = Convert.ToUInt16(entity.SourcePort);
|
||||||
DestinationIp = new IPAddress(entity.DestinationIP.Span);
|
DestinationIp = new IPAddress(entity.DestinationIp.Span);
|
||||||
DestinationPort = Convert.ToUInt16(entity.DestinationPort);
|
DestinationPort = Convert.ToUInt16(entity.DestinationPort);
|
||||||
TlsDetails = entity.Tls;
|
TlsDetails = entity.Tls;
|
||||||
Application = entity.Application;
|
Application = entity.Application;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
using Google.Protobuf.Collections;
|
using Google.Protobuf.Collections;
|
||||||
using INetMock.Client.Audit.Details;
|
|
||||||
|
|
||||||
namespace INetMock.Client.Audit
|
namespace INetMock.Client.Audit
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Grpc.Core;
|
using Grpc.Core;
|
||||||
|
using INetMock.Client.Rpc;
|
||||||
|
|
||||||
namespace INetMock.Client.Audit.Serialization
|
namespace INetMock.Client.Audit.Serialization
|
||||||
{
|
{
|
||||||
public sealed class EventServerStreamReader : IProtoEventReader
|
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;
|
_asyncEventStream = asyncEventStream;
|
||||||
}
|
}
|
||||||
|
@ -16,7 +17,7 @@ namespace INetMock.Client.Audit.Serialization
|
||||||
public async Task<EventEntity?> ReadAsync(CancellationToken token = default)
|
public async Task<EventEntity?> ReadAsync(CancellationToken token = default)
|
||||||
{
|
{
|
||||||
if (!await _asyncEventStream.ResponseStream.MoveNext(token)) return null;
|
if (!await _asyncEventStream.ResponseStream.MoveNext(token)) return null;
|
||||||
return _asyncEventStream.ResponseStream.Current;
|
return _asyncEventStream.ResponseStream.Current.Entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose() => _asyncEventStream.Dispose();
|
public void Dispose() => _asyncEventStream.Dispose();
|
||||||
|
|
|
@ -14,11 +14,11 @@
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Protobuf Include="proto/audit/event_entity.proto" GrpcServices="Client" AdditionalImportDirs="./proto/" />
|
<Protobuf Include="proto/audit/v1/event_entity.proto" GrpcServices="Client" AdditionalImportDirs="./proto/" />
|
||||||
<Protobuf Include="proto/audit/details/dns_details.proto" GrpcServices="Client" AdditionalImportDirs="./proto/" />
|
<Protobuf Include="proto/audit/v1/dns_details.proto" GrpcServices="Client" AdditionalImportDirs="./proto/" />
|
||||||
<Protobuf Include="proto/audit/details/http_details.proto" GrpcServices="Client" AdditionalImportDirs="./proto/" />
|
<Protobuf Include="proto/audit/v1/http_details.proto" GrpcServices="Client" AdditionalImportDirs="./proto/" />
|
||||||
<Protobuf Include="proto/rpc/audit.proto" GrpcServices="Client" AdditionalImportDirs="./proto/" />
|
<Protobuf Include="proto/rpc/v1/audit.proto" GrpcServices="Client" AdditionalImportDirs="./proto/" />
|
||||||
<Protobuf Include="proto/rpc/health.proto" GrpcServices="Client" AdditionalImportDirs="./proto/" />
|
<Protobuf Include="proto/rpc/v1/health.proto" GrpcServices="Client" AdditionalImportDirs="./proto/" />
|
||||||
<Protobuf Include="proto/rpc/pcap.proto" GrpcServices="Client" AdditionalImportDirs="./proto/" />
|
<Protobuf Include="proto/rpc/v1/pcap.proto" GrpcServices="Client" AdditionalImportDirs="./proto/" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
Loading…
Reference in a new issue