Merged
Conversation
tlsdialer wrapped utls with DNS resolution, timeout management, and cert verification — most of which fronted doesn't need since it passes pre-resolved IPs and handles its own cert verification via VerifyPeerCertificate. This inlines the ~25 lines of actually needed logic (UClient creation, handshake with deadline, manual cert verification for non-SNI path) and drops tlsdialer plus its transitive deps (mtime, netx). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR removes the tlsdialer/v3 dependency by inlining the minimal uTLS dialing logic directly into front.go, including a new helper for manual certificate verification on the non-SNI path, and updates module files to drop the removed dependency tree.
Changes:
- Remove
github.com/getlantern/tlsdialer/v3usage and inline uTLS dial + handshake logic infront.go. - Add
verifyServerCertshelper to perform manual x509 verification when SNI is not used. - Clean up
go.mod/go.sumto droptlsdialerand related transitive dependencies.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
front.go |
Replaces tlsdialer with inline uTLS dial/handshake logic and adds manual cert verification helper. |
go.mod |
Removes tlsdialer/v3 and prunes indirect dependencies. |
go.sum |
Removes checksums for dropped dependencies after module tidy. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…root The test used hardcoded Akamai certs that expired 2026-03-18. Updated with fresh certs (valid until 2026-12-22) which chain through DigiCert Global G3 (new intermediate), so added the DigiCert Global Root G3 CA to DefaultTrustedCAs. Also added an early skip guard that parses the leaf cert expiry so future expiration produces a clear skip message instead of a cryptic failure. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Return conn (*tls.UConn) instead of conn.Conn (*tls.Conn); both do encrypted I/O but returning the UConn directly is cleaner. - Remove verifyServerCerts helper and reuse the existing verifyPeerCertificate function from fronted.go, eliminating duplicate verification logic between SNI and non-SNI paths. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Two issues caused this test to fail intermittently: 1. defaultFrontedProviderID was a package-level global mutated by tests, leaking state between them. Added WithDefaultProviderID option so each test sets its provider ID on its own Fronted instance instead of mutating the global. 2. The embedded config loads akamai fronts which get added alongside the test's cloudfront fronts. When an akamai front was randomly picked, the akamai provider lacked the test host mappings, causing "no domain fronting mapping" errors. Fixed by registering test hosts with the akamai provider in testProvidersWithHosts. Co-Authored-By: Claude Opus 4.6 (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.
Summary
tlsdialer/v3directly intofront.go, replacing the single call site with ~20 lines ofutls.UClientusageverifyPeerCertificatefor manual cert verification on the non-SNI path, keeping verification consistent across both pathstlsdialerand its transitive deps (mtime,netx,golog,errors,hidden,hex,iptool,bpool,zap,multierr) — net removal of ~100 lines from go.sumTestVerifyPeerCertificatewhich was failing due to expired Akamai certs, and adds DigiCert Global Root G3 toDefaultTrustedCAsfor the new cert chainWhy
tlsdialerwraps utls with DNS resolution, timeout management, and cert verification — most of which fronted doesn't need since it passes pre-resolved IPs and handles its own cert verification viaVerifyPeerCertificate. Inlining the needed logic simplifies the dependency tree.Test plan
TestDomainFrontingWithoutSNIConfigpassesTestVerifyPeerCertificatepasses (updated certs + expiry skip guard)TestPassthrough,TestHostAliasesBasic,TestHostAliasesMultipassTestDomainFrontingWithSNIConfigskipped in CI (pre-existing; real Akamai endpoints unreliable from CI runners)🤖 Generated with Claude Code