Description
Extended from #1546. Wish to gather further opinions from others before making sure everything could be ironed out. I'll likely work on this myself once finalized, so hopefully there wouldn't be much complaint about unnecessarily burdening the developers, and could be served as a gag to get some elitists shutting their [redacted] up. "No PR, no say", LMAO.
Design
Transport Session ID (TSID for short) is a customizable randomly-generated token applicable to all outbound transports allowing embedding additional headers (e.g. HTTP/2, WebSocket, HTTPUpgrade and SplitHTTP) (no one knows when Ditzy, the fully-decoupled upgrade of xSSE could be finished, lol). TSIDs are defined globally, then consumed by whichever outbounds when needed. TSIDs could be initialized once upon start, or it could be rotated with the specified time span.
To define a list of TSIDs, the GlobalTransportObject
is extended to include tsid
. Example of GlobalTransportObject.tsid[<TSIDMapObject>]
below.
[{
"id": "theDeerIsAlwaysHorny", // required
"length": 16, // [4, 64], defaults to 8
"rotate": 1800, // max valid duration for every ID in seconds, defaults to 3600
"delta": 0 // additional optional randomized duration to make it behave less predictable
}, {
"id": "freedomForAllOrNone"
}]
There are two proposals of consuming TSIDs. TSIDs could be filled in with standard Go templates inside header value strings (e.g. Bearer {{ ts.freedomForAllOrNone }}
) for maximum flexibility, or an additional property called tsHeader
could be used for a potential save in performance. Example of StreamSettingsObject.tsHeader<TSIDConfigObject>
below.
{
"use": "theDeerIsAlwaysHorny",
"as": "Authorization",
"prefix": "Bearer ",
"suffix": null
}
Intended use
TSIDs could be used anywhere where some measure of persistence is needed for client transports, mainly server-side load balancing. This can both benefit collaboration efforts and for-profit proxy vendors (sadly, but I doubt them using this anyway).
Some may argue that X-Forwarded-For
or X-Real-IP
is enough for that, which is never applicable in practice. A single client session could have different ports for egress, resulting in unwanted changes in X-Forwarded-For
, and multiple client sessions behind NAT will be confused as one in X-Real-IP
. If the proxy maintainer chooses to strip as much identifiable information as they could for clients, those headers will be absolute no-goes.
Stabilized load balancing & protecting exit IP reputation
Traditional measures of load balancing can cause erratic selection of exits. Since a client switching their exit IPs in relatively quick succession could be seen as bots, such use of LB will cause all affected exit IPs to be flagged, decreasing their IP reputation. Applying TSIDs solves this problem altogether.
Worry-free load-balanced streaming service unblocking
Adding on top of IP reputation protection, one can have load-balanced streaming service proxy detection bypass (it's a mouthful, so I'll stick to "streaming service unblocking") with multiple exits, keeping each exit below stream services' threshold while avoiding erratic exit switching.
Implementing high-availability
On top of stabilized load-balancing granted by TSID, servers with multiple hops can implement a stable client fail-over mechanism when any node inside the cluster fails. Client connections can simply be migrated over to a new available exit, ensuring stable connectivity.
Mini-Tor paired with VLESS encryption
Building on top of HA, when chaining multiple hops with VLESS encryption enabled, one can simply build a miniaturized Tor network: connections are protected at Guard, then securely delivered between Guard and End.
Potential problems to tackle
Most true duplex transports should be fine, but since transports under the Meek family (e.g. SplitHTTP) can have different TSIDs sent in edge cases, due to their reliance on state reconstructions, this could result in some connectivity loss, so a measure of persistence must be applied for Meek-like transports. If a fail-over occurs, problems can also ensue due to non-existent socket IDs. Until then, TSID could not be rolled out for Meek-likes.