Return validated outbound-only JSON from share conversion - #147
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR tightens convertShareLinksToXrayJson output semantics by projecting parsed nodes onto a share-link-supported Xray JSON subset (root outbounds only), validating each projected outbound, and returning the projected JSON object through Invoke.
Changes:
- Treat Xray JSON inputs as node sources and retain only root
outbounds. - Introduce
MarshalShareConfigJSONto project/validate supported outbound + stream/security fields (preserving XHTTPextraand FinalMask masksettingsJSON). - Remove deprecated/legacy fields and behaviors (e.g., TLS
allowInsecure/skip-cert-verify, legacy mKCP seed/header handling) and add/adjust tests + README docs.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| share/xray_json.go | Removes now-unused fake header type tied to legacy KCP handling. |
| share/transport_build.go | Stops parsing/building legacy KCP seed/header; narrows when headerType is accepted. |
| share/stream.go | Drops parsing of deprecated insecure=1 TLS flag. |
| share/parse_share.go | Returns configs containing only OutboundConfigs for Xray JSON inputs; updates doc comment. |
| share/parse_share_test.go | Adds coverage for “outbounds-only” behavior and updated KCP expectations. |
| share/marshal_share.go | Adds outbound projection + validation and JSON marshaling for share-link-supported subset. |
| share/marshal_share_test.go | Adds tests for projection/filtering, protocol buildability, KCP, and FinalMask preservation. |
| share/generate_share.go | Stops emitting deprecated TLS insecure flag and legacy KCP seed/header query params. |
| share/generate_share_test.go | Adds test asserting KCP seed/header are ignored in generated links. |
| share/clash_meta.go | Removes skip-cert-verify plumbing to deprecated TLS insecure behavior. |
| share/clash_meta_test.go | Updates Clash tests to reflect removal of skip-cert-verify behavior. |
| readme/README.zh_CN.md | Documents new conversion/projection semantics in Chinese README. |
| README.md | Documents new conversion/projection semantics in English README. |
| invoke.go | Changes Invoke convert-share handler to return projected share-supported JSON object. |
| invoke_test.go | Adds coverage that Invoke returns only the projected {outbounds: ...} object and no unsupported fields. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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
outboundsconvertShareLinksToXrayJsonresults onto share-link-supported protocol, transport, and security fields, then validate every projected outboundextraand FinalMask masksettingsJSONallowInsecureand legacy mKCP seed/header handling, and omit empty KCP settingsTesting
go test ./... -count=1git diff --check