feat: transport extensions#37
Merged
Merged
Conversation
Add RequestTimeout() to the Transport interface so slow transports (like DNSTT at 135-byte MTU) can request a longer time budget from the race transport. Default (0) keeps existing behaviour. namedTransport stores and preserves the value through ReplaceTransport. WithDNSTunnel uses a type assertion to extract the timeout from the underlying DNSTT instance if it provides one.
Allows DNSTT transports to set a body size cap that the race transport uses to skip the transport for oversized requests (same pattern as AMP's 6000-byte limit). Type-asserts the optional MaxLength() int interface on the underlying DNSTT transport.
Adds reqTimeout field to mockTransport and two test cases:
- TransportOverridesBase: a transport's 5-min timeout beats the 80s GET default
- TakesMaxAcrossTransports: max of {2min, 5min, 3min} = 5min for POST body
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends Kindling transports so the race transport can (a) increase its per-request timeout budget for slow transports and (b) better accommodate transports that need to declare constraints (notably around request body size/time).
Changes:
- Adds
RequestTimeout() time.Durationto the exportedTransportinterface and threads this throughraceTransporttimeout budgeting. - Updates race transport timeout logic/tests to account for transport-provided timeout overrides.
- Extends
WithDNSTunnelto pick up optionalRequestTimeout()andMaxLength()capabilities from the provided DNSTT implementation.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
race_transport.go |
Uses a transport-aware request timeout budget for the race context deadline. |
race_transport_test.go |
Extends the test transport and adds coverage for timeout override/max selection. |
kindling.go |
Extends the public Transport interface with RequestTimeout and plumbs timeout through transport wrappers (including DNSTT). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Align RequestTimeout doc comment with actual behavior (body-based not method-based). Align requestTimeout doc comment with implementation (all configured transports, not just eligible). Normalize gofmt spacing in kindling.go and race_transport_test.go.
Adds TestWithDNSTunnelOverrides with stubDNSTT mock. Verifies: - Defaults: no override → RequestTimeout and MaxLength both 0 - RequestTimeout: 5-minute value propagates to namedTransport - MaxLength: 10000 value propagates to namedTransport - Both: both overrides propagate together
garmr-ulfr
approved these changes
Jun 2, 2026
Contributor
garmr-ulfr
left a comment
There was a problem hiding this comment.
Just one comment, otherwise LGTM.
Compute the race budget after filterTransports and over only the eligible transports, so a transport dropped for this request (by MaxLength/IsStreamable) no longer inflates the timeout. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Slow transports (e.g. DNSTT over DNS with 135-byte MTU) need more time to complete a single request than the race transport's default budget. A TLS handshake over a DNS tunnel can take 30-60 seconds, and a small POST body adds more. The fixed 80s (GET) / 3min (POST) timeout killed requests before the tunnel could finish.
Similarly, transports need to declare a maximum body size so the race transport can skip them for oversized payloads (e.g. 1.4MB issue report protobufs through a DNS tunnel).