Skip to content

kms: add Config.Transport field for custom http.RoundTripper#43

Merged
aead merged 1 commit intomainfrom
transport
Nov 20, 2025
Merged

kms: add Config.Transport field for custom http.RoundTripper#43
aead merged 1 commit intomainfrom
transport

Conversation

@aead
Copy link
Member

@aead aead commented Nov 20, 2025

This commit adds the Config.Transport field that allows users to specify a custom http.RoundTripper. However, users have to create and set a TLS config on their http.RoundTripper implementation.

NewClient does not use the APIKey or TLS field to try to modify the Transport because:

  • The Transport might be a custom type and not neccessarily a *http.Transport. Hence, we cannot inject a TLS config.
  • Even if it is a *http.Transport, we would have to modify its TLSClientConfig field which may not be expected and can lead to surprising side effects.

@aead aead requested a review from 0xMALVEE November 20, 2025 09:47
@aead aead self-assigned this Nov 20, 2025
@aead
Copy link
Member Author

aead commented Nov 20, 2025

Alternative to #42

@aead aead requested a review from klauspost November 20, 2025 09:49
Copy link
Contributor

@klauspost klauspost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If @0xMALVEE is happy, I am happy :)

This commit adds the `Config.Transport` field that allows users
to specify a custom `http.RoundTripper`. However, users have to
create and set a TLS config on their `http.RoundTripper` implementation.

`NewClient` does not use the `APIKey` or `TLS` field to try to modify
the `Transport` because:
 - The `Transport` might be a custom type and not neccessarily a `*http.Transport`.
   Hence, we cannot inject a TLS config.
 - Even if it is a `*http.Transport`, we would have to modify its `TLSClientConfig`
   field which may not be expected and can lead to surprising side effects.

Signed-off-by: Andreas Auernhammer <github@aead.dev>
@aead aead merged commit 8e992ab into main Nov 20, 2025
5 checks passed
@aead aead deleted the transport branch November 20, 2025 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants