11use crate :: { Error , common:: utils:: default_bool_true, config:: utils} ;
22use serde:: { Deserialize , de:: value:: MapDeserializer } ;
33use serde_yaml:: Value ;
4+ #[ cfg( feature = "shadowquic" ) ]
5+ use shadowquic:: config:: CongestionControl as SQCongestionControl ;
46use std:: {
57 collections:: HashMap ,
68 fmt:: { Display , Formatter } ,
@@ -73,6 +75,9 @@ pub enum OutboundProxyProtocol {
7375 #[ serde( rename = "ssh" ) ]
7476 #[ cfg( feature = "ssh" ) ]
7577 Ssh ( OutBoundSsh ) ,
78+ #[ serde( rename = "shadowquic" ) ]
79+ #[ cfg( feature = "shadowquic" ) ]
80+ ShadowQuic ( OutboundShadowQuic ) ,
7681}
7782
7883impl OutboundProxyProtocol {
@@ -95,6 +100,8 @@ impl OutboundProxyProtocol {
95100 OutboundProxyProtocol :: Hysteria2 ( hysteria2) => & hysteria2. name ,
96101 #[ cfg( feature = "ssh" ) ]
97102 OutboundProxyProtocol :: Ssh ( ssh) => & ssh. common_opts . name ,
103+ #[ cfg( feature = "shadowquic" ) ]
104+ OutboundProxyProtocol :: ShadowQuic ( sq) => & sq. common_opts . name ,
98105 }
99106 }
100107}
@@ -133,6 +140,8 @@ impl Display for OutboundProxyProtocol {
133140 OutboundProxyProtocol :: Hysteria2 ( _) => write ! ( f, "Hysteria2" ) ,
134141 #[ cfg( feature = "ssh" ) ]
135142 OutboundProxyProtocol :: Ssh ( _) => write ! ( f, "Ssh" ) ,
143+ #[ cfg( feature = "shadowquic" ) ]
144+ OutboundProxyProtocol :: ShadowQuic ( _) => write ! ( f, "ShadowQUIC" ) ,
136145 }
137146 }
138147}
@@ -292,6 +301,39 @@ pub struct OutboundTuic {
292301 pub receive_window : Option < u64 > ,
293302}
294303
304+ #[ cfg( feature = "shadowquic" ) ]
305+ #[ derive( serde:: Serialize , serde:: Deserialize , Debug , Default ) ]
306+ #[ serde( rename_all = "kebab-case" ) ]
307+ pub struct OutboundShadowQuic {
308+ #[ serde( flatten) ]
309+ pub common_opts : CommonConfigOptions ,
310+ /// jls password, must be the same as the server
311+ pub jls_pwd : String ,
312+ /// jls initial vector, must be the same as the server
313+ pub jls_iv : String ,
314+ /// server name, must be the same as the server jls_upstream
315+ /// domain name
316+ pub server_name : String ,
317+ /// alpn, default to "h3"
318+ pub alpn : Option < Vec < String > > ,
319+ /// initial mtu, must be larger than min mtu, at least to be 1200.
320+ /// 1400 is recommended for high packet loss network. default to be 1300
321+ pub initial_mtu : Option < u16 > ,
322+ /// congestion control, default to "bbr"
323+ pub congestion_control : Option < SQCongestionControl > , // bbr, new-reno, cubic
324+ /// set to true to enable zero rtt, default to true
325+ pub zero_rtt : Option < bool > ,
326+ /// if true, use quic stream to send UDP, otherwise use quic datagram
327+ /// extension, similar to native UDP in TUIC
328+ pub over_stream : Option < bool > ,
329+ /// minimum mtu, must be smaller than initial mtu, at least to be 1200.
330+ /// 1400 is recommended for high packet loss network. default to be 1290
331+ pub min_mtu : Option < u16 > ,
332+ /// keep alive interval in milliseconds
333+ /// 0 means disable keep alive, should be smaller than 30_000(idle time)
334+ pub keep_alive_interval : Option < u32 > ,
335+ }
336+
295337#[ cfg( feature = "ssh" ) ]
296338#[ derive( serde:: Serialize , serde:: Deserialize , Debug , Default ) ]
297339#[ serde( rename_all = "kebab-case" ) ]
0 commit comments