Skip to content

Add WithDialer option for custom TCP dialer injection#68

Merged
myleshorton merged 8 commits intomainfrom
add-with-dialer
Feb 25, 2026
Merged

Add WithDialer option for custom TCP dialer injection#68
myleshorton merged 8 commits intomainfrom
add-with-dialer

Conversation

@myleshorton
Copy link
Contributor

Summary

  • Introduces a DialFunc type and WithDialer functional option that allows callers to inject a custom TCP dialer into the fronted package, overriding the default net.Dialer
  • Threads the custom dialer through from the top-level fronted struct down to individual front instances so it is used for all underlying TCP connections
  • This is needed for routing fronted traffic through a bypass proxy to avoid VPN tunnel loops (see feat: local bypass proxy for kindling traffic radiance#341)

Test plan

  • TestWithDialer verifies that a custom dialer is stored and invoked when set
  • TestWithDialerDefault verifies a default dialer is assigned when WithDialer is not used
  • TestWithDialerFlowsToFronts verifies the custom dialer propagates from the top-level config down to individual fronts and is used during dial()
  • Manual integration testing with the radiance bypass proxy to confirm fronted traffic routes outside the VPN tunnel

🤖 Generated with Claude Code

myleshorton and others added 2 commits February 22, 2026 05:54
Allow callers to inject a custom dialer function via WithDialer() that
flows through to the tlsdialer used by each front. This enables kindling
to set a single dialer that automatically applies to all fronted connections.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Introduce named DialFunc type for the dialer function signature
- Improve WithDialer docstring with more context about how the dialer is used
- Add tests: TestWithDialer, TestWithDialerDefault, TestWithDialerFlowsToFronts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces the ability to inject a custom TCP dialer into the fronted package, enabling users to control how the underlying network connections are established. This is particularly useful for routing fronted traffic through a bypass proxy to avoid VPN tunnel loops.

Changes:

  • Adds a DialFunc type and WithDialer functional option for custom dialer injection
  • Threads the custom dialer from the top-level fronted struct through to individual front instances via function parameter passing
  • Includes comprehensive tests verifying custom dialer storage, default dialer fallback, and proper propagation through the call chain

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
fronted.go Defines DialFunc type, adds dialFunc field to fronted struct, implements WithDialer option, sets default dialer in NewFronted, and threads dialer to loadFronts
front.go Adds dialFunc field to front struct, updates newFront signature to accept dialer, and modifies dial() method to use custom dialer with nil fallback
fronted_test.go Adds three comprehensive tests for custom dialer functionality and updates existing TestLoadFronts to pass nil dialer parameter

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

myleshorton and others added 6 commits February 25, 2026 12:30
TestDomainFrontingWithoutSNIConfig, TestDomainFrontingWithSNIConfig,
and TestVet all connect to real CloudFront/Akamai endpoints. These
hang indefinitely in GitHub Actions, causing a 10-minute timeout.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
tryAllFronts() previously iterated fronts in insertion order. When
fronts from multiple sources (embedded config, cache) formed contiguous
blocks, a block of stale/unreachable IPs could stall vetting for
minutes before working fronts from other sources were tried.

Shuffle the snapshot before submitting to the worker pool so fronts
from all sources are interleaved. Also remove stale CI skip guards
and the noconfig.yaml override from integration tests, and use >= for
masquerade count assertions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
TestDomainFrontingWithSNIConfig provides its own akamai provider.
Without noconfig.yaml, the embedded config loads cloudfront fronts
that can be selected first (due to shuffling) and fail the host
alias lookup for config.example.com.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
TestDomainFrontingWithSNIConfig connects to real Akamai CDN endpoints
which are unreliable from GitHub Actions runners, causing 10m timeouts.
Restore the CI skip guard for this test only.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…es out

TestVet iterates through all DefaultCloudfrontMasquerades sequentially,
each with a 5s dial timeout. With stale masquerades this exceeds the
10m test timeout in CI.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Coveralls upload is unreliable (530 errors) and blocks the build.
Remove the goveralls install and coverage upload steps.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@myleshorton myleshorton merged commit 41c9e53 into main Feb 25, 2026
1 check passed
@myleshorton myleshorton deleted the add-with-dialer branch February 25, 2026 20:51
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.

2 participants