Skip to content

Return validated outbound-only JSON from share conversion - #147

Merged
yiguodev merged 7 commits into
mainfrom
dev-26.8-3
Aug 26, 2026
Merged

yiguodev merged 7 commits into
mainfrom
dev-26.8-3

Conversation

@yiguodev

Copy link
Copy Markdown
Collaborator

Summary

  • treat Xray JSON imports as node sources and retain only their root outbounds
  • project convertShareLinksToXrayJson results onto share-link-supported protocol, transport, and security fields, then validate every projected outbound
  • preserve opaque XHTTP extra and FinalMask mask settings JSON
  • remove deprecated allowInsecure and legacy mKCP seed/header handling, and omit empty KCP settings
  • document the conversion semantics and add coverage for Invoke response shape, supported protocols, KCP behavior, and field filtering

Testing

  • go test ./... -count=1
  • Android gomobile build with the local Xray-core checkout
  • Apple Go XCFramework build with the local Xray-core checkout
  • git diff --check

Copilot AI lite review requested due to automatic review settings August 26, 2026 10:29

Copilot AI left a comment

Copy link
Copy Markdown

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 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 MarshalShareConfigJSON to project/validate supported outbound + stream/security fields (preserving XHTTP extra and FinalMask mask settings JSON).
  • 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.

Comment thread share/marshal_share.go
Copilot AI review requested due to automatic review settings August 26, 2026 11:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

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

Copilot AI review requested due to automatic review settings August 26, 2026 11:07
@yiguodev
yiguodev merged commit d3f2c47 into main Aug 26, 2026
4 checks passed
@yiguodev
yiguodev deleted the dev-26.8-3 branch August 26, 2026 11:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

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

wejg pushed a commit to wejg/libXray that referenced this pull request Sep 24, 2026
… of https://github.com/XTLS/libXray

* 'main' of https://github.com/wejg/libXray:

* 'main' of https://github.com/XTLS/libXray:
  feat: allow excluding reserved ports from allocation (XTLS#157)
  Restore Matt Pocock skills configuration and documentation (XTLS#156)
  Complete share-link fields and remove legacy VMess QR support (XTLS#155)
  feat: add an optional desktop Core error output file (XTLS#154)
  Validate Xray configurations through instance construction (XTLS#153)
  Update Xray-core to v26.9.9 (XTLS#152)
  refactor: remove runtime accounting and simplify share responses (XTLS#151)
  Add managed runtime accounting and probe APIs (XTLS#150)
  Restore protected desktop DNS resolver (XTLS#148)
  Return validated outbound-only JSON from share conversion (XTLS#147)
  Add Tools .go (XTLS#146)
  Document single Go runtime limitation (XTLS#144)
  Add age-encrypted subscriptions and JSON-based Xray APIs (XTLS#143)
  Fix Windows ARM64 build toolchain (XTLS#142)
  Add concurrent batch ping and improve runtime safety (XTLS#141)
  Validate imported outbounds with Xray-core (XTLS#140)
  Add Android VPN-aware DNS resolver (XTLS#139)
  Update native platform builds (XTLS#138)

# Conflicts:
#	README.md
#	go.mod
#	go.sum
#	invoke.go
#	invoke_model.go
#	invoke_test.go
#	memory/memory_ios.go
#	readme/README.zh_CN.md
#	xray/ping.go
#	xray/xray.go
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