feat: add Snell v3–v6 client outbound#33
Merged
Conversation
Add an unofficial Snell v4/v5 outbound for exclave-core, covering TCP CONNECT, UDP-over-TCP, optional http/tls obfs, and connection reuse. Protocol code is adapted from missuo/opensnell (GPL-3.0) and vendored under proxy/snell/internal so the module stays self-contained. Snell v6 is intentionally not supported (deployment-unique framing).
Replace the OpenSnell-based v4/v5-only stack with sagernet/sing-snell, which implements Snell v6 (ChaCha20-Poly1305 AEAD, deployment-unique framing, default/unshaped/unsafe-raw modes) as well as v3–v5. Config adds obfsHost and mode fields for v6.
Remote sagernet/sing-snell pulled sing v0.8.12 which conflicts with exclave-core's utls (HandshakeTimeout). Vendor sing-snell under proxy/snell/sing-snell and require sing v0.8.11 for a consistent build.
Import SagerNet/sing-snell sources into proxy/snell/internal/singsnell (same module, no nested go.mod) and rewrite the outbound to match the current ClientOptions / DialPacketConn APIs used by sing-box testing. Supports Snell v4 (and 3/5 via v4 client) and official Snell v6.
exclave-core is on sing v0.8.11. Drop VectorisedWriteCreator / PacketBatch* paths and server-only reuse types from inlined sing-snell so the client builds cleanly while keeping Snell v4/v6 wire support.
Clean re-import of SagerNet/sing-snell client sources plus minimal compat stubs so CreateVectorisedWriter/PacketBatch* APIs degrade gracefully on sing v0.8.11. Server-only paths removed.
Restore RecordWriter.CreateVectorisedWriterFor, stub unsupported vectorised creators for sing v0.8.11, and replace NewBufferSize with buf.NewSize.
6 tasks
Collaborator
|
- Import github.com/sagernet/sing-snell directly; bump sing to the unstable version required by sing-snell (add HandshakeTimeout to singbridge TLS wrapper). - Support versions 4 and 6 only (drop v3/v5). - Rename JSON field obfs → obfsMode; strict exact-match parsing (none|http|tls; no "off" alias; case-sensitive). - Reject non-empty v4-only fields on v6 and vice versa. - Add userPSK (sing-box private extension; optional). - Allow empty PSK (servers may accept it). - Remove server-speaks-first first-payload logic (Snell is client-first). - Resolve UDP domain destinations to IP before write (Snell UDP has no domain ATYP). Snell v6 remains beta upstream; exposed with that understanding.
Author
|
Thanks for the review — addressed in the latest commit:
Companion app PR: ExclaveNetwork/Exclave#446 |
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
Add Snell client outbound to exclave-core, covering v3–v6.
testingbranch), inlined underproxy/snell/internal/singsnellso the module stays self-contained."snell"none|http|tls, connection reuse, Snell v6 modesdefault|unshaped|unsafe-rawinfra/conf/v4/snell.gomain/distro/allandoutboundConfigLoaderSettings example
{ "protocol": "snell", "settings": { "address": "1.2.3.4", "port": 44046, "psk": "secret", "obfs": "tls", "obfsHost": "www.bing.com", "version": 6, "reuse": true, "mode": "default" } }Notes
obfs: "tls"for the fake TLS handshake.singv0.8.11 (vectorised/packet-batch creator APIs from newer sing are stubbed; wire protocol is intact).ExclaveNetwork/Exclave.Test plan
defaultmode)