File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -56,6 +56,12 @@ function _doTunnel(req) {
5656 payload . host = req . h ;
5757 payload . port = req . p ;
5858 break ;
59+ case "connect_data" :
60+ payload . op = "connect_data" ;
61+ payload . host = req . h ;
62+ payload . port = req . p ;
63+ if ( req . d ) payload . data = req . d ;
64+ break ;
5965 case "data" :
6066 payload . op = "data" ;
6167 payload . sid = req . sid ;
@@ -66,7 +72,10 @@ function _doTunnel(req) {
6672 payload . sid = req . sid ;
6773 break ;
6874 default :
69- return _json ( { e : "unknown tunnel op: " + req . t } ) ;
75+ // Structured `code` lets the Rust client detect version skew
76+ // without substring-matching the error text. Must match
77+ // CODE_UNSUPPORTED_OP in tunnel_client.rs and tunnel-node/src/main.rs.
78+ return _json ( { e : "unknown tunnel op: " + req . t , code : "UNSUPPORTED_OP" } ) ;
7079 }
7180
7281 var resp = UrlFetchApp . fetch ( TUNNEL_SERVER_URL + "/tunnel" , {
Original file line number Diff line number Diff line change @@ -185,6 +185,11 @@ pub struct TunnelResponse {
185185 pub eof : Option < bool > ,
186186 #[ serde( default ) ]
187187 pub e : Option < String > ,
188+ /// Structured error code from the tunnel-node (e.g. `UNSUPPORTED_OP`).
189+ /// `None` for legacy tunnel-nodes; clients should fall back to parsing
190+ /// `e` only when this is `None` and compatibility is needed.
191+ #[ serde( default ) ]
192+ pub code : Option < String > ,
188193}
189194
190195/// A single op in a batch tunnel request.
You can’t perform that action at this time.
0 commit comments