fix(tuic): add additional configuration options for SNI, RTT reduction, UDP relay, and congestion control
This commit is contained in:
parent
189f62781e
commit
987e25e7ac
@ -247,6 +247,10 @@ type (
|
|||||||
}
|
}
|
||||||
Tuic {
|
Tuic {
|
||||||
Port int `json:"port" validate:"required"`
|
Port int `json:"port" validate:"required"`
|
||||||
|
DisableSNI bool `json:"disable_sni"`
|
||||||
|
ReduceRtt bool `json:"reduce_rtt"`
|
||||||
|
UDPRelayMode string `json:"udp_relay_mode"`
|
||||||
|
CongestionController string `json:"congestion_controller"`
|
||||||
SecurityConfig SecurityConfig `json:"security_config"`
|
SecurityConfig SecurityConfig `json:"security_config"`
|
||||||
}
|
}
|
||||||
SecurityConfig {
|
SecurityConfig {
|
||||||
|
|||||||
@ -1803,8 +1803,12 @@ type TrojanProtocol struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Tuic struct {
|
type Tuic struct {
|
||||||
Port int `json:"port" validate:"required"`
|
Port int `json:"port" validate:"required"`
|
||||||
SecurityConfig SecurityConfig `json:"security_config"`
|
DisableSNI bool `json:"disable_sni"`
|
||||||
|
ReduceRtt bool `json:"reduce_rtt"`
|
||||||
|
UDPRelayMode string `json:"udp_relay_mode"`
|
||||||
|
CongestionController string `json:"congestion_controller"`
|
||||||
|
SecurityConfig SecurityConfig `json:"security_config"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type UnbindOAuthRequest struct {
|
type UnbindOAuthRequest struct {
|
||||||
|
|||||||
@ -116,15 +116,21 @@ func parseTuic(data proxy.Proxy, uuid string) (*Proxy, error) {
|
|||||||
if !ok {
|
if !ok {
|
||||||
return nil, fmt.Errorf("invalid type for Tuic")
|
return nil, fmt.Errorf("invalid type for Tuic")
|
||||||
}
|
}
|
||||||
|
|
||||||
p := &Proxy{
|
p := &Proxy{
|
||||||
Name: data.Name,
|
Name: data.Name,
|
||||||
Type: "tuic",
|
Type: "tuic",
|
||||||
Server: data.Server,
|
Server: data.Server,
|
||||||
Port: data.Port,
|
Port: data.Port,
|
||||||
UUID: uuid,
|
UUID: uuid,
|
||||||
Password: uuid,
|
Password: uuid,
|
||||||
SNI: tuic.SecurityConfig.SNI,
|
ALPN: []string{"h3"},
|
||||||
SkipCertVerify: tuic.SecurityConfig.AllowInsecure,
|
DisableSni: tuic.DisableSNI,
|
||||||
|
ReduceRtt: tuic.ReduceRtt,
|
||||||
|
CongestionController: tuic.CongestionController,
|
||||||
|
UdpRelayMode: tuic.UDPRelayMode,
|
||||||
|
SNI: tuic.SecurityConfig.SNI,
|
||||||
|
SkipCertVerify: tuic.SecurityConfig.AllowInsecure,
|
||||||
}
|
}
|
||||||
|
|
||||||
return p, nil
|
return p, nil
|
||||||
|
|||||||
@ -249,7 +249,8 @@ func TuicUri(data proxy.Proxy, uuid string) string {
|
|||||||
tuic := data.Option.(proxy.Tuic)
|
tuic := data.Option.(proxy.Tuic)
|
||||||
var query = make(url.Values)
|
var query = make(url.Values)
|
||||||
|
|
||||||
setQuery(&query, "congestion_control", "bbr")
|
setQuery(&query, "congestion_control", tuic.CongestionController)
|
||||||
|
setQuery(&query, "udp_relay_mode", tuic.UDPRelayMode)
|
||||||
|
|
||||||
if tuic.SecurityConfig.SNI != "" {
|
if tuic.SecurityConfig.SNI != "" {
|
||||||
setQuery(&query, "sni", tuic.SecurityConfig.SNI)
|
setQuery(&query, "sni", tuic.SecurityConfig.SNI)
|
||||||
|
|||||||
@ -83,15 +83,29 @@ type Hysteria2 struct {
|
|||||||
|
|
||||||
// Tuic represents a Tuic proxy configuration
|
// Tuic represents a Tuic proxy configuration
|
||||||
type Tuic struct {
|
type Tuic struct {
|
||||||
|
Port int `json:"port"`
|
||||||
|
DisableSNI bool `json:"disable_sni"`
|
||||||
|
ReduceRtt bool `json:"reduce_rtt"`
|
||||||
|
UDPRelayMode string `json:"udp_relay_mode"`
|
||||||
|
CongestionController string `json:"congestion_controller"`
|
||||||
|
SecurityConfig SecurityConfig `json:"security_config"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// AnyTLS represents an AnyTLS proxy configuration
|
||||||
|
type AnyTLS struct {
|
||||||
Port int `json:"port"`
|
Port int `json:"port"`
|
||||||
SecurityConfig SecurityConfig `json:"security_config"`
|
SecurityConfig SecurityConfig `json:"security_config"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// TransportConfig represents the transport configuration for a proxy
|
// TransportConfig represents the transport configuration for a proxy
|
||||||
type TransportConfig struct {
|
type TransportConfig struct {
|
||||||
Path string `json:"path,omitempty"` // ws/httpupgrade
|
Path string `json:"path,omitempty"` // ws/httpupgrade
|
||||||
Host string `json:"host,omitempty"`
|
Host string `json:"host,omitempty"`
|
||||||
ServiceName string `json:"service_name"` // grpc
|
ServiceName string `json:"service_name"` // grpc
|
||||||
|
DisableSNI bool `json:"disable_sni"` // Disable SNI for the transport(tuic)
|
||||||
|
ReduceRtt bool `json:"reduce_rtt"` // Reduce RTT for the transport(tuic)
|
||||||
|
UDPRelayMode string `json:"udp_relay_mode"` // UDP relay mode for the transport(tuic)
|
||||||
|
CongestionController string `json:"congestion_controller"` // Congestion controller for the transport(tuic)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SecurityConfig represents the security configuration for a proxy
|
// SecurityConfig represents the security configuration for a proxy
|
||||||
|
|||||||
@ -31,7 +31,9 @@ func ParseTUIC(data proxy.Proxy, uuid string) (*Proxy, error) {
|
|||||||
},
|
},
|
||||||
UUID: uuid,
|
UUID: uuid,
|
||||||
Password: uuid,
|
Password: uuid,
|
||||||
CongestionControl: "bbr",
|
CongestionControl: tuic.CongestionController,
|
||||||
|
UDPRelayMode: tuic.UDPRelayMode,
|
||||||
|
ZeroRTTHandshake: tuic.ReduceRtt,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
// Security options
|
// Security options
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user