config: fix yaml tags for FrontingSNIs / SNIConfig#8
Merged
Conversation
The upstream generator (lantern-cloud/cmd/update_masquerades) uses
the older getlantern/fronted Go types which carry no yaml struct
tags, so yaml.Marshal writes lowercased Go field names with no
separator:
frontingsnis:
ir:
usearbitrarysnis: true
arbitrarysnis:
- python.org
This domainfront package's tags expected snake_case
(`fronting_snis`, `use_arbitrary_snis`, `arbitrary_snis`), which
yaml.v3 silently fails to match, so every consumer of the parsed
Config saw FrontingSNIs as empty. The runtime fronting client's
arbitrary-SNI cover path was disabled across all clients.
Aligns the tags with the wire format. Adds no migration cost since
the older format was the only one ever produced.
Local verification against the live fronted.yaml.gz from
getlantern/fronted/main:
akamai.frontingsnis.cn: useArbitrary=false count=2570
akamai.frontingsnis.default: useArbitrary=true count=4638
akamai.frontingsnis.ir: useArbitrary=true count=0
There was a problem hiding this comment.
Pull request overview
This PR fixes a YAML tag mismatch so Config.Providers[*].FrontingSNIs (and nested SNIConfig fields) correctly unmarshals from the fronted.yaml.gz wire format, restoring the arbitrary-SNI cover configuration path for consumers.
Changes:
- Update
Provider.FrontingSNIsYAML tag to match the lowercase-concatenated key emitted upstream (frontingsnis). - Update
SNIConfigYAML tags to match the upstream-emitted keys (usearbitrarysnis,arbitrarysnis). - Add an in-code comment documenting why these tags must match the wire format exactly.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Addresses PR review: - README documented the snake_case form (fronting_snis / use_arbitrary_snis / arbitrary_snis) that never actually parsed — the upstream generator only ever emits the lowercase-concatenated form. Corrected the example to the real wire format so consumers don't copy keys that silently parse as zero values. - TestParseConfigYAML now includes a frontingsnis section with usearbitrarysnis/arbitrarysnis and asserts the fields populate, guarding the tag spelling against silent regression. No dual-key support added: there is no snake_case config in the wild to be compatible with (the format never changed; the tags were just wrong).
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
Config.Providers[*].FrontingSNIshas been silently empty for every consumer that parsesfronted.yaml.gzwith this library — a yaml-tag mismatch the linter doesn't catch.The upstream generator (
lantern-cloud/cmd/update_masquerades) writes the file using the oldergetlantern/frontedtypes, which carry no yaml struct tags. yaml.v3 falls back to lowercased-concatenated field names there, producing:This package's tags expected the snake_case form (
fronting_snis,use_arbitrary_snis,arbitrary_snis), so yaml.Unmarshal silently leaves the fields zero-valued. The runtime fronting client's arbitrary-SNI cover code path has been dead for every client.Fix
Aligns the tags with the wire format. Three tags change in
config.go:No migration cost: the older format is the only one ever produced.
Verification
Parsing the live
fronted.yaml.gzfromgetlantern/fronted/mainwith the fixed library:Before the fix all three groups parsed as empty (FrontingSNIs map was nil because the top-level key didn't match either).
Consumer impact
domainfront.ExpandedProvider) now sees arbitrary-SNI cover groups — this is the user-visible behavior change.SNIsForProvider's newFrontingSNIsunion, so the new IR-validated SNIs (queued in lantern-cloud#2799) make it into the scanner pool.🤖 Generated with Claude Code