Skip to content

chore: align with trusttunnel's official session reuse logic#2683

Merged
wwqgtxx merged 3 commits into
MetaCubeX:Alphafrom
123jjck:fix/trusttunnel-reuse
Apr 8, 2026
Merged

chore: align with trusttunnel's official session reuse logic#2683
wwqgtxx merged 3 commits into
MetaCubeX:Alphafrom
123jjck:fix/trusttunnel-reuse

Conversation

@123jjck

@123jjck 123jjck commented Apr 8, 2026

Copy link
Copy Markdown

Build CONNECT requests against the proxy server while keeping the target host in the Host header.

This lets us pool sessions by the actual upstream proxy authority instead of opening separate connections for each destination host so the "max-connections" setting works as expected.

Build CONNECT requests against the proxy server while keeping the destination host in the Host header.

This lets trusttunnel reuse upstream sessions by proxy authority instead of opening separate HTTP/2 or HTTP/3 connections for each destination host.
@123jjck 123jjck changed the title fix(trusttunnel): reuse proxy sessions by authority fix(trusttunnel): reuse sessions by authority and drop failed clients Apr 8, 2026
@wwqgtxx wwqgtxx closed this Apr 8, 2026
@wwqgtxx wwqgtxx reopened this Apr 8, 2026
@wwqgtxx

wwqgtxx commented Apr 8, 2026

Copy link
Copy Markdown
Collaborator

Your second commit is unnecessary. http2Transport will automatically reconnect after an error. Please restore the content to the first commit.

@123jjck 123jjck force-pushed the fix/trusttunnel-reuse branch from 5af48c6 to d8d701c Compare April 8, 2026 12:47
@123jjck

123jjck commented Apr 8, 2026

Copy link
Copy Markdown
Author

Please restore the content to the first commit.

Ok, done. But what's the point of health-check then? Maybe rename it to 'keep-alive' ?

@123jjck 123jjck changed the title fix(trusttunnel): reuse sessions by authority and drop failed clients fix(trusttunnel): reuse sessions by authority Apr 8, 2026
@wwqgtxx

wwqgtxx commented Apr 8, 2026

Copy link
Copy Markdown
Collaborator

But what's the point of health-check then? Maybe rename it to 'keep-alive' ?

That name was simply to follow the naming conventions of the original TrustTunnel.

@wwqgtxx

wwqgtxx commented Apr 8, 2026

Copy link
Copy Markdown
Collaborator

In addition, please add comments to the two Host fields in your newConnectRequest, explicitly stating that the first is used to specify the server address for the connection, and the second is used for the actual Host header (:authority) sent.

@wwqgtxx wwqgtxx changed the title fix(trusttunnel): reuse sessions by authority fix: trusttunnel session reuse logic Apr 8, 2026
@wwqgtxx

wwqgtxx commented Apr 8, 2026

Copy link
Copy Markdown
Collaborator

I'm wondering if the default values ​​in our PoolClient should be modified accordingly after this change. Because previously, different TCP targets would actually trigger new underlying connections, but this PR changes that behavior.

@123jjck

123jjck commented Apr 8, 2026

Copy link
Copy Markdown
Author

default values ​​in our PoolClient

you mean max-connections and etc.? The official TrustTunnel client has max 8 connections and 5 streams before opening new connection by default, so we can use this values

@wwqgtxx

wwqgtxx commented Apr 8, 2026

Copy link
Copy Markdown
Collaborator

It seems we should change the default values ​​to:

max-connections: 8
min-streams: 5

Please modify the default values ​​in NewPoolClient and docs/config.yaml.

@wwqgtxx wwqgtxx changed the title fix: trusttunnel session reuse logic chore: align with trusttunnel's official session reuse logic Apr 8, 2026
@wwqgtxx wwqgtxx merged commit d801e6b into MetaCubeX:Alpha Apr 8, 2026
@MetaCubeX MetaCubeX deleted a comment from 123jjck Apr 8, 2026
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