Skip to content

Commit 997ac32

Browse files
committed
feat: Add decryptor filter
1 parent ad5cf87 commit 997ac32

File tree

10 files changed

+459
-0
lines changed

10 files changed

+459
-0
lines changed

Cargo.lock

+73
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ cfg-if = "1.0.0"
150150
libflate = "2.0.0"
151151
form_urlencoded = "1.2.1"
152152
gxhash = "3.4.1"
153+
chacha20 = { version = "0.9.1", features = ["std"] }
153154

154155
[dependencies.hyper-util]
155156
version = "0.1"

crates/proto-gen/gen.rs

+1
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ fn execute(which: &str) {
202202
"filters/capture/v1alpha1/capture",
203203
"filters/compress/v1alpha1/compress",
204204
"filters/concatenate/v1alpha1/concatenate",
205+
"filters/decryptor/v1alpha1/decryptor",
205206
"filters/debug/v1alpha1/debug",
206207
"filters/drop/v1alpha1/drop",
207208
"filters/firewall/v1alpha1/firewall",

crates/quilkin-proto/src/generated/quilkin/filters.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ pub mod capture;
22
pub mod compress;
33
pub mod concatenate;
44
pub mod debug;
5+
pub mod decryptor;
56
pub mod drop;
67
pub mod firewall;
78
pub mod load_balancer;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pub mod v1alpha1;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#[allow(clippy::derive_partial_eq_without_eq)]
2+
#[derive(Clone, PartialEq, ::prost::Message)]
3+
pub struct Decryptor {
4+
#[prost(bytes = "vec", tag = "1")]
5+
pub key: ::prost::alloc::vec::Vec<u8>,
6+
#[prost(enumeration = "decryptor::Mode", tag = "2")]
7+
pub mode: i32,
8+
#[prost(message, optional, tag = "3")]
9+
pub data_key: ::core::option::Option<::prost::alloc::string::String>,
10+
#[prost(message, optional, tag = "4")]
11+
pub nonce_key: ::core::option::Option<::prost::alloc::string::String>,
12+
}
13+
/// Nested message and enum types in `Decryptor`.
14+
pub mod decryptor {
15+
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
16+
#[repr(i32)]
17+
pub enum Mode {
18+
Destination = 0,
19+
}
20+
impl Mode {
21+
/// String value of the enum field names used in the ProtoBuf definition.
22+
///
23+
/// The values are not transformed in any way and thus are considered stable
24+
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
25+
pub fn as_str_name(&self) -> &'static str {
26+
match self {
27+
Mode::Destination => "Destination",
28+
}
29+
}
30+
/// Creates an enum from field names used in the ProtoBuf definition.
31+
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
32+
match value {
33+
"Destination" => Some(Self::Destination),
34+
_ => None,
35+
}
36+
}
37+
}
38+
}

docs/src/services/xds/proto/index.md

+50
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@
3737

3838
- [Concatenate.Strategy](#quilkin-filters-concatenate-v1alpha1-Concatenate-Strategy)
3939

40+
- [quilkin/filters/decryptor/v1alpha1/decryptor.proto](#quilkin_filters_decryptor_v1alpha1_decryptor-proto)
41+
- [Decryptor](#quilkin-filters-decryptor-v1alpha1-Decryptor)
42+
43+
- [Decryptor.Mode](#quilkin-filters-decryptor-v1alpha1-Decryptor-Mode)
44+
4045
- [quilkin/filters/debug/v1alpha1/debug.proto](#quilkin_filters_debug_v1alpha1_debug-proto)
4146
- [Debug](#quilkin-filters-debug-v1alpha1-Debug)
4247

@@ -507,6 +512,51 @@ of xDS servers to connect to in the relay itself.
507512

508513

509514

515+
<a name="quilkin_filters_decryptor_v1alpha1_decryptor-proto"></a>
516+
<p align="right"><a href="#top">Top</a></p>
517+
518+
## quilkin/filters/decryptor/v1alpha1/decryptor.proto
519+
520+
521+
522+
<a name="quilkin-filters-decryptor-v1alpha1-Decryptor"></a>
523+
524+
### Decryptor
525+
526+
527+
528+
| Field | Type | Label | Description |
529+
| ----- | ---- | ----- | ----------- |
530+
| key | [bytes](#bytes) | | |
531+
| mode | [Decryptor.Mode](#quilkin-filters-decryptor-v1alpha1-Decryptor-Mode) | | |
532+
| data_key | [google.protobuf.StringValue](#google-protobuf-StringValue) | | |
533+
| nonce_key | [google.protobuf.StringValue](#google-protobuf-StringValue) | | |
534+
535+
536+
537+
538+
539+
540+
541+
542+
<a name="quilkin-filters-decryptor-v1alpha1-Decryptor-Mode"></a>
543+
544+
### Decryptor.Mode
545+
546+
547+
| Name | Number | Description |
548+
| ---- | ------ | ----------- |
549+
| Destination | 0 | |
550+
551+
552+
553+
554+
555+
556+
557+
558+
559+
510560
<a name="quilkin_filters_debug_v1alpha1_debug-proto"></a>
511561
<p align="right"><a href="#top">Top</a></p>
512562

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Copyright 2024 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
syntax = "proto3";
18+
19+
package quilkin.filters.decryptor.v1alpha1;
20+
21+
import "google/protobuf/wrappers.proto";
22+
23+
message Decryptor {
24+
enum Mode {
25+
Destination = 0;
26+
}
27+
28+
bytes key = 1;
29+
Mode mode = 2;
30+
google.protobuf.StringValue data_key = 3;
31+
google.protobuf.StringValue nonce_key = 4;
32+
}

src/filters.rs

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ pub mod capture;
2828
pub mod compress;
2929
pub mod concatenate;
3030
pub mod debug;
31+
pub mod decryptor;
3132
pub mod drop;
3233
pub mod firewall;
3334
pub mod load_balancer;

0 commit comments

Comments
 (0)