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 {
|
||||||
|
|||||||
@ -1804,6 +1804,10 @@ type TrojanProtocol struct {
|
|||||||
|
|
||||||
type Tuic struct {
|
type Tuic struct {
|
||||||
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"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -116,6 +116,7 @@ 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",
|
||||||
@ -123,6 +124,11 @@ func parseTuic(data proxy.Proxy, uuid string) (*Proxy, error) {
|
|||||||
Port: data.Port,
|
Port: data.Port,
|
||||||
UUID: uuid,
|
UUID: uuid,
|
||||||
Password: uuid,
|
Password: uuid,
|
||||||
|
ALPN: []string{"h3"},
|
||||||
|
DisableSni: tuic.DisableSNI,
|
||||||
|
ReduceRtt: tuic.ReduceRtt,
|
||||||
|
CongestionController: tuic.CongestionController,
|
||||||
|
UdpRelayMode: tuic.UDPRelayMode,
|
||||||
SNI: tuic.SecurityConfig.SNI,
|
SNI: tuic.SecurityConfig.SNI,
|
||||||
SkipCertVerify: tuic.SecurityConfig.AllowInsecure,
|
SkipCertVerify: tuic.SecurityConfig.AllowInsecure,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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,6 +83,16 @@ 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"`
|
||||||
}
|
}
|
||||||
@ -92,6 +102,10 @@ 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