-
Notifications
You must be signed in to change notification settings - Fork 313
Add support for event hub transport layer proxy #3051
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
8de95b0
1e3898e
267a6c7
60cf509
93c06d3
4f11853
4fd6384
7ef967a
5c57934
208d56f
04ff4b7
0fd4d02
93fe99f
260e69a
e72dc50
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,6 @@ amqps | |
sastoken | ||
smallulong | ||
smalluint | ||
proxyuser | ||
testuser | ||
testpass |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,8 +29,12 @@ serde.workspace = true | |
serde_amqp = { workspace = true, optional = true } | ||
serde_bytes = { workspace = true, optional = true } | ||
tokio.workspace = true | ||
tokio-native-tls = { workspace = true, optional = true } | ||
tokio-socks = { workspace = true, optional = true } | ||
native-tls = { workspace = true, optional = true } | ||
tracing.workspace = true | ||
typespec = { workspace = true, features = ["amqp"] } | ||
typespec_client_core = { workspace = true } | ||
typespec_macros.workspace = true | ||
|
||
[dev-dependencies] | ||
|
@@ -49,9 +53,10 @@ fe2o3_amqp = [ | |
"serde_amqp", | ||
"serde_bytes", | ||
] | ||
socks5 = ["dep:tokio-socks", "dep:native-tls", "dep:tokio-native-tls"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You also need to add this to the docs.rs metadata table below or it won't be documented. We intentionally don't document the others as they are meant more for internal testing / development. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added |
||
|
||
[lints] | ||
workspace = true | ||
|
||
[package.metadata.docs.rs] | ||
features = ["fe2o3_amqp"] | ||
features = ["fe2o3_amqp", "socks5"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,49 @@ Azure AMQP crate for consumption of AMQP based packages in the Azure SDK for Rus | |
|
||
This crate is part of a collection of crates: for more information please refer to [https://github.com/azure/azure-sdk-for-rust](https://github.com/azure/azure-sdk-for-rust). | ||
|
||
## SOCKS5 Proxy Support | ||
|
||
This crate supports SOCKS5 proxy connections for corporate environments. | ||
|
||
**Note**: SOCKS5 support requires enabling the `socks5` feature: | ||
|
||
```toml | ||
[dependencies] | ||
azure_core_amqp = { version = "0.8", features = ["socks5"] } | ||
``` | ||
|
||
SOCKS5 support is enabled by configuring the `custom_endpoint` option with a SOCKS5 URL: | ||
|
||
```rust,no_run | ||
use azure_core_amqp::AmqpConnectionOptions; | ||
|
||
# fn main() -> Result<(), Box<dyn std::error::Error>> { | ||
let options = AmqpConnectionOptions { | ||
custom_endpoint: Some("socks5h://proxy.contoso.com:8080".parse()?), | ||
..Default::default() | ||
}; | ||
# Ok(()) | ||
# } | ||
``` | ||
|
||
### Supported Protocols | ||
|
||
- **socks5://** - Standard SOCKS5 with local DNS resolution | ||
- **socks5h://** - SOCKS5 with proxy-side DNS resolution (recommended for corporate environments) | ||
|
||
### Authentication | ||
|
||
Username/password authentication is supported via the proxy URL: | ||
```text | ||
socks5://username:[email protected]:1080 | ||
``` | ||
|
||
All proxy credentials are automatically masked in log output for security. | ||
|
||
### Dependencies | ||
|
||
SOCKS5 support adds the `tokio-socks` dependency to the crate. | ||
|
||
## Testing the AMQP Client | ||
|
||
The AMQP package is tested using the standard `cargo test` command line: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything in here is in
azure_core
.azure_*
crates outside of core should not referencetypespec
crates.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@heaths I referenced it in sdk/eventhubs/azure_messaging_eventhubs/Cargo.toml in order to use the sanitize. any suggestion about that? remove sanitize? leave it in the file? what is the best course of action here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm saying that the sanitization function should be exported in
azure_core
as well, in the same module (hopefully, unless we missed something). For anyazure_*
crates we're trying to "hide" the typespec crates as an implementation detail. Everything they export is imported and re-exported byazure_core
in the same module path. A couple types we "override", but internally make convertible to the types they "override" in typespec.