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 {
|
||||
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 {
|
||||
|
||||
@ -1803,8 +1803,12 @@ type TrojanProtocol struct {
|
||||
}
|
||||
|
||||
type Tuic struct {
|
||||
Port int `json:"port" validate:"required"`
|
||||
SecurityConfig SecurityConfig `json:"security_config"`
|
||||
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"`
|
||||
}
|
||||
|
||||
type UnbindOAuthRequest struct {
|
||||
|
||||
@ -116,15 +116,21 @@ func parseTuic(data proxy.Proxy, uuid string) (*Proxy, error) {
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("invalid type for Tuic")
|
||||
}
|
||||
|
||||
p := &Proxy{
|
||||
Name: data.Name,
|
||||
Type: "tuic",
|
||||
Server: data.Server,
|
||||
Port: data.Port,
|
||||
UUID: uuid,
|
||||
Password: uuid,
|
||||
SNI: tuic.SecurityConfig.SNI,
|
||||
SkipCertVerify: tuic.SecurityConfig.AllowInsecure,
|
||||
Name: data.Name,
|
||||
Type: "tuic",
|
||||
Server: data.Server,
|
||||
Port: data.Port,
|
||||
UUID: uuid,
|
||||
Password: uuid,
|
||||
ALPN: []string{"h3"},
|
||||
DisableSni: tuic.DisableSNI,
|
||||
ReduceRtt: tuic.ReduceRtt,
|
||||
CongestionController: tuic.CongestionController,
|
||||
UdpRelayMode: tuic.UDPRelayMode,
|
||||
SNI: tuic.SecurityConfig.SNI,
|
||||
SkipCertVerify: tuic.SecurityConfig.AllowInsecure,
|
||||
}
|
||||
|
||||
return p, nil
|
||||
|
||||
@ -249,7 +249,8 @@ func TuicUri(data proxy.Proxy, uuid string) string {
|
||||
tuic := data.Option.(proxy.Tuic)
|
||||
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 != "" {
|
||||
setQuery(&query, "sni", tuic.SecurityConfig.SNI)
|
||||
|
||||
@ -83,15 +83,29 @@ type Hysteria2 struct {
|
||||
|
||||
// Tuic represents a Tuic proxy configuration
|
||||
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"`
|
||||
SecurityConfig SecurityConfig `json:"security_config"`
|
||||
}
|
||||
|
||||
// TransportConfig represents the transport configuration for a proxy
|
||||
type TransportConfig struct {
|
||||
Path string `json:"path,omitempty"` // ws/httpupgrade
|
||||
Host string `json:"host,omitempty"`
|
||||
ServiceName string `json:"service_name"` // grpc
|
||||
Path string `json:"path,omitempty"` // ws/httpupgrade
|
||||
Host string `json:"host,omitempty"`
|
||||
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
|
||||
|
||||
@ -31,7 +31,9 @@ func ParseTUIC(data proxy.Proxy, uuid string) (*Proxy, error) {
|
||||
},
|
||||
UUID: uuid,
|
||||
Password: uuid,
|
||||
CongestionControl: "bbr",
|
||||
CongestionControl: tuic.CongestionController,
|
||||
UDPRelayMode: tuic.UDPRelayMode,
|
||||
ZeroRTTHandshake: tuic.ReduceRtt,
|
||||
},
|
||||
}
|
||||
// Security options
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user