Squashed 'api/' changes from 9fe203c..a65ee4f

a65ee4f Fix buf lint stage
bc5fad6 Merge commit '580d2995be07ca1dd4839c3e9214ee881b98bb3e' into 45-add-api-to-restart-handlers
226c480 Add endpoint API to control running endpoint groups
505b06f Add support for DHCP to audit stream
d742b08 Introduce profiling API
e7e9e82 Introduce DNS-over-HTTPS and HTTP2 support
6a5ac9b Merge branch 'renovate/configure' into 'main'
d9d3c9f Add renovate.json
5cad2aa Include PPROF handler to improve observability
3698421 Remove unnecessary proto import
74f521c Move to grpc default health service definition
f341615 Return ConsumerKey when recording is started

git-subtree-dir: api
git-subtree-split: a65ee4f207bd1734095990e12e56069ec3881d0e
This commit is contained in:
Peter Kurfer 2022-01-26 10:38:47 +01:00
parent e5208f25dc
commit b61b4df2c2
13 changed files with 166 additions and 86 deletions

View file

@ -8,5 +8,6 @@ stages:
lint: lint:
stage: test stage: test
script: script:
- cd proto/
- buf ls-files - buf ls-files
- buf lint - buf lint

View file

@ -1,20 +0,0 @@
# Below is not the lint and breaking configuration we recommend!
# This just just what googleapis passes.
# For lint, we recommend having the single value "DEFAULT" in "use"
# with no values in "except".
# For breaking, we recommend having the single value "FILE" in use.
# See https://docs.buf.build/lint-usage
# See https://docs.buf.build/breaking-usage
version: v1beta1
build:
roots:
- proto
lint:
use:
- DEFAULT
except:
- PACKAGE_DIRECTORY_MATCH
allow_comment_ignores: true
breaking:
use:
- FILE

View file

@ -0,0 +1,25 @@
syntax = "proto3";
package inetmock.audit.v1;
enum DHCPOpCode {
DHCP_OP_CODE_UNSPECIFIED = 0;
DHCP_OP_CODE_BOOT_REQUEST = 1;
DHCP_OP_CODE_BOOT_REPLY = 2;
}
enum DHCPHwType {
DHCP_HW_TYPE_UNSPECIFIED = 0;
DHCP_HW_TYPE_ETHERNET = 1;
DHCP_HW_TYPE_LOCAL_NET = 12;
DHCP_HW_TYPE_FIBRE_CHANNEL = 18;
DHCP_HW_TYPE_SERIAL_LINE = 20;
DHCP_HW_TYPE_IPSEC = 31;
DHCP_HW_TYPE_INFINIBAND = 32;
}
message DHCPDetailsEntity {
int32 hop_count = 1;
DHCPOpCode opcode = 2;
DHCPHwType hw_type = 3;
}

View file

@ -2,12 +2,6 @@ syntax = "proto3";
package inetmock.audit.v1; package inetmock.audit.v1;
option csharp_namespace = "INetMock.Client.Audit";
option go_package = "gitlab.com/inetmock/inetmock/pkg/audit/v1";
option java_multiple_files = true;
option java_outer_classname = "HandlerEventProto";
option java_package = "com.github.baez90.inetmock.audit";
enum DNSOpCode { enum DNSOpCode {
//buf:lint:ignore ENUM_ZERO_VALUE_SUFFIX //buf:lint:ignore ENUM_ZERO_VALUE_SUFFIX
DNS_OP_CODE_QUERY = 0; DNS_OP_CODE_QUERY = 0;

View file

@ -2,14 +2,10 @@ syntax = "proto3";
package inetmock.audit.v1; package inetmock.audit.v1;
option csharp_namespace = "INetMock.Client.Audit";
option go_package = "gitlab.com/inetmock/inetmock/pkg/audit/v1";
option java_multiple_files = true;
option java_outer_classname = "HandlerEventProto";
option java_package = "com.github.baez90.inetmock.audit";
import "google/protobuf/any.proto";
import "google/protobuf/timestamp.proto"; import "google/protobuf/timestamp.proto";
import "audit/v1/http_details.proto";
import "audit/v1/dns_details.proto";
import "audit/v1/dhcp_details.proto";
enum TransportProtocol { enum TransportProtocol {
TRANSPORT_PROTOCOL_UNSPECIFIED = 0; TRANSPORT_PROTOCOL_UNSPECIFIED = 0;
@ -22,6 +18,9 @@ enum AppProtocol {
APP_PROTOCOL_DNS = 1; APP_PROTOCOL_DNS = 1;
APP_PROTOCOL_HTTP = 2; APP_PROTOCOL_HTTP = 2;
APP_PROTOCOL_HTTP_PROXY = 3; APP_PROTOCOL_HTTP_PROXY = 3;
APP_PROTOCOL_PPROF = 4;
APP_PROTOCOL_DNS_OVER_HTTPS = 5;
APP_PROTOCOL_DHCP = 6;
} }
enum TLSVersion { enum TLSVersion {
@ -48,5 +47,10 @@ message EventEntity {
uint32 source_port = 7; uint32 source_port = 7;
uint32 destination_port = 8; uint32 destination_port = 8;
TLSDetailsEntity tls = 9; TLSDetailsEntity tls = 9;
google.protobuf.Any protocol_details = 10;
oneof protocol_details {
HTTPDetailsEntity http = 20;
DNSDetailsEntity dns = 21;
DHCPDetailsEntity dhcp = 22;
}
} }

View file

@ -2,12 +2,6 @@ syntax = "proto3";
package inetmock.audit.v1; package inetmock.audit.v1;
option csharp_namespace = "INetMock.Client.Audit";
option go_package = "gitlab.com/inetmock/inetmock/pkg/audit/v1";
option java_multiple_files = true;
option java_outer_classname = "HandlerEventProto";
option java_package = "com.github.baez90.inetmock.audit";
enum HTTPMethod { enum HTTPMethod {
HTTP_METHOD_UNSPECIFIED = 0; HTTP_METHOD_UNSPECIFIED = 0;
HTTP_METHOD_GET = 1; HTTP_METHOD_GET = 1;

10
proto/buf.yaml Normal file
View file

@ -0,0 +1,10 @@
version: v1
breaking:
use:
- FILE
lint:
use:
- DEFAULT
except:
- PACKAGE_DIRECTORY_MATCH
allow_comment_ignores: true

View file

@ -2,12 +2,6 @@ syntax = "proto3";
package inetmock.rpc.v1; package inetmock.rpc.v1;
option csharp_namespace = "INetMock.Client.Rpc";
option go_package = "gitlab.com/inetmock/inetmock/pkg/rpc/v1";
option java_multiple_files = true;
option java_outer_classname = "AuditProto";
option java_package = "com.github.baez90.inetmock.rpc";
import "audit/v1/event_entity.proto"; import "audit/v1/event_entity.proto";
message WatchEventsRequest { message WatchEventsRequest {

View file

@ -0,0 +1,73 @@
syntax = "proto3";
package inetmock.rpc.v1;
message ListenerGroup {
string name = 1;
repeated string endpoints = 2;
}
message ListAllServingGroupsRequest {
}
message ListAllServingGroupsResponse {
repeated ListenerGroup groups = 1;
}
message ListAllConfiguredGroupsRequest {
}
message ListAllConfiguredGroupsResponse {
repeated ListenerGroup groups = 1;
}
message StartListenerGroupRequest {
string group_name = 1;
}
message StartListenerGroupResponse {
}
message StartAllGroupsRequest {
}
message StartAllGroupsResponse {
}
message StopListenerGroupRequest {
string group_name = 1;
}
message StopListenerGroupResponse {
}
message StopAllGroupsRequest {
}
message StopAllGroupsResponse {
}
message RestartListenerGroupRequest {
string group_name = 1;
}
message RestartListenerGroupResponse {
}
message RestartAllGroupsRequest {
}
message RestartAllGroupsResponse {
}
service EndpointOrchestratorService {
rpc ListAllServingGroups(ListAllServingGroupsRequest) returns(ListAllServingGroupsResponse);
rpc ListAllConfiguredGroups(ListAllConfiguredGroupsRequest) returns(ListAllConfiguredGroupsResponse);
rpc StartListenerGroup(StartListenerGroupRequest) returns (StartListenerGroupResponse);
rpc StartAllGroups(StartAllGroupsRequest) returns (StartAllGroupsResponse);
rpc StopListenerGroup(StopListenerGroupRequest) returns (StopListenerGroupResponse);
rpc StopAllGroups(StopAllGroupsRequest) returns (StopAllGroupsResponse);
rpc RestartListenerGroup(RestartListenerGroupRequest) returns (RestartListenerGroupResponse);
rpc RestartAllGroups(RestartAllGroupsRequest) returns (RestartAllGroupsResponse);
}

View file

@ -1,34 +0,0 @@
syntax = "proto3";
package inetmock.rpc.v1;
option csharp_namespace = "INetMock.Client.Rpc";
option go_package = "gitlab.com/inetmock/inetmock/pkg/rpc/v1";
option java_multiple_files = true;
option java_outer_classname = "HealthProto";
option java_package = "com.github.baez90.inetmock.rpc";
enum HealthState {
HEALTH_STATE_UNSPECIFIED = 0;
HEALTH_STATE_INITIALIZING = 1;
HEALTH_STATE_UNHEALTHY = 2;
HEALTH_STATE_HEALTHY = 3;
}
message GetHealthRequest {
repeated string components = 1;
}
message ComponentHealth {
HealthState state = 1;
string message = 2;
}
message GetHealthResponse {
HealthState overall_health_state = 1;
map<string, ComponentHealth> components_health = 2;
}
service HealthService {
rpc GetHealth(GetHealthRequest) returns (GetHealthResponse);
}

View file

@ -2,12 +2,6 @@ syntax = "proto3";
package inetmock.rpc.v1; package inetmock.rpc.v1;
option csharp_namespace = "INetMock.Client.Rpc";
option go_package = "gitlab.com/inetmock/inetmock/pkg/rpc/v1";
option java_multiple_files = true;
option java_outer_classname = "AuditProto";
option java_package = "com.github.baez90.inetmock.rpc";
import "google/protobuf/duration.proto"; import "google/protobuf/duration.proto";
message ListAvailableDevicesRequest {} message ListAvailableDevicesRequest {}
@ -35,6 +29,7 @@ message StartPCAPFileRecordingRequest {
message StartPCAPFileRecordingResponse { message StartPCAPFileRecordingResponse {
string resolved_path = 1; string resolved_path = 1;
string consumer_key = 2;
} }
message StopPCAPFileRecordingRequest { message StopPCAPFileRecordingRequest {

38
proto/rpc/v1/pprof.proto Normal file
View file

@ -0,0 +1,38 @@
syntax = "proto3";
package inetmock.rpc.v1;
import "google/protobuf/duration.proto";
message ProfileDumpRequest {
string profile_name = 1;
int32 debug = 2;
// this applies only for 'heap' profile
bool gc_before_dump = 3;
}
message ProfileDumpResponse {
bytes profile_data = 1;
}
message CPUProfileRequest {
google.protobuf.Duration profile_duration = 1;
}
message CPUProfileResponse {
bytes profile_data = 1;
}
message TraceRequest {
google.protobuf.Duration trace_duration = 1;
}
message TraceResponse {
bytes profile_data = 1;
}
service ProfilingService {
rpc ProfileDump(ProfileDumpRequest) returns (ProfileDumpResponse);
rpc CPUProfile(CPUProfileRequest) returns (CPUProfileResponse);
rpc Trace(TraceRequest) returns (TraceResponse);
}

6
renovate.json Normal file
View file

@ -0,0 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base"
]
}