|
@@ -41,6 +41,7 @@ func NewRuleAction(ctx context.Context, logger logger.ContextLogger, action opti
|
|
UDPConnect: action.RouteOptions.UDPConnect,
|
|
UDPConnect: action.RouteOptions.UDPConnect,
|
|
TLSFragment: action.RouteOptions.TLSFragment,
|
|
TLSFragment: action.RouteOptions.TLSFragment,
|
|
TLSFragmentFallbackDelay: time.Duration(action.RouteOptions.TLSFragmentFallbackDelay),
|
|
TLSFragmentFallbackDelay: time.Duration(action.RouteOptions.TLSFragmentFallbackDelay),
|
|
|
|
+ TLSRecordFragment: action.RouteOptions.TLSRecordFragment,
|
|
},
|
|
},
|
|
}, nil
|
|
}, nil
|
|
case C.RuleActionTypeRouteOptions:
|
|
case C.RuleActionTypeRouteOptions:
|
|
@@ -54,6 +55,7 @@ func NewRuleAction(ctx context.Context, logger logger.ContextLogger, action opti
|
|
UDPTimeout: time.Duration(action.RouteOptionsOptions.UDPTimeout),
|
|
UDPTimeout: time.Duration(action.RouteOptionsOptions.UDPTimeout),
|
|
TLSFragment: action.RouteOptionsOptions.TLSFragment,
|
|
TLSFragment: action.RouteOptionsOptions.TLSFragment,
|
|
TLSFragmentFallbackDelay: time.Duration(action.RouteOptionsOptions.TLSFragmentFallbackDelay),
|
|
TLSFragmentFallbackDelay: time.Duration(action.RouteOptionsOptions.TLSFragmentFallbackDelay),
|
|
|
|
+ TLSRecordFragment: action.RouteOptionsOptions.TLSRecordFragment,
|
|
}, nil
|
|
}, nil
|
|
case C.RuleActionTypeDirect:
|
|
case C.RuleActionTypeDirect:
|
|
directDialer, err := dialer.New(ctx, option.DialerOptions(action.DirectOptions), false)
|
|
directDialer, err := dialer.New(ctx, option.DialerOptions(action.DirectOptions), false)
|
|
@@ -153,15 +155,7 @@ func (r *RuleActionRoute) Type() string {
|
|
func (r *RuleActionRoute) String() string {
|
|
func (r *RuleActionRoute) String() string {
|
|
var descriptions []string
|
|
var descriptions []string
|
|
descriptions = append(descriptions, r.Outbound)
|
|
descriptions = append(descriptions, r.Outbound)
|
|
- if r.UDPDisableDomainUnmapping {
|
|
|
|
- descriptions = append(descriptions, "udp-disable-domain-unmapping")
|
|
|
|
- }
|
|
|
|
- if r.UDPConnect {
|
|
|
|
- descriptions = append(descriptions, "udp-connect")
|
|
|
|
- }
|
|
|
|
- if r.TLSFragment {
|
|
|
|
- descriptions = append(descriptions, "tls-fragment")
|
|
|
|
- }
|
|
|
|
|
|
+ descriptions = append(descriptions, r.Descriptions()...)
|
|
return F.ToString("route(", strings.Join(descriptions, ","), ")")
|
|
return F.ToString("route(", strings.Join(descriptions, ","), ")")
|
|
}
|
|
}
|
|
|
|
|
|
@@ -177,6 +171,7 @@ type RuleActionRouteOptions struct {
|
|
UDPTimeout time.Duration
|
|
UDPTimeout time.Duration
|
|
TLSFragment bool
|
|
TLSFragment bool
|
|
TLSFragmentFallbackDelay time.Duration
|
|
TLSFragmentFallbackDelay time.Duration
|
|
|
|
+ TLSRecordFragment bool
|
|
}
|
|
}
|
|
|
|
|
|
func (r *RuleActionRouteOptions) Type() string {
|
|
func (r *RuleActionRouteOptions) Type() string {
|
|
@@ -184,6 +179,10 @@ func (r *RuleActionRouteOptions) Type() string {
|
|
}
|
|
}
|
|
|
|
|
|
func (r *RuleActionRouteOptions) String() string {
|
|
func (r *RuleActionRouteOptions) String() string {
|
|
|
|
+ return F.ToString("route-options(", strings.Join(r.Descriptions(), ","), ")")
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+func (r *RuleActionRouteOptions) Descriptions() []string {
|
|
var descriptions []string
|
|
var descriptions []string
|
|
if r.OverrideAddress.IsValid() {
|
|
if r.OverrideAddress.IsValid() {
|
|
descriptions = append(descriptions, F.ToString("override-address=", r.OverrideAddress.AddrString()))
|
|
descriptions = append(descriptions, F.ToString("override-address=", r.OverrideAddress.AddrString()))
|
|
@@ -212,7 +211,16 @@ func (r *RuleActionRouteOptions) String() string {
|
|
if r.UDPTimeout > 0 {
|
|
if r.UDPTimeout > 0 {
|
|
descriptions = append(descriptions, "udp-timeout")
|
|
descriptions = append(descriptions, "udp-timeout")
|
|
}
|
|
}
|
|
- return F.ToString("route-options(", strings.Join(descriptions, ","), ")")
|
|
|
|
|
|
+ if r.TLSFragment {
|
|
|
|
+ descriptions = append(descriptions, "tls-fragment")
|
|
|
|
+ }
|
|
|
|
+ if r.TLSFragmentFallbackDelay > 0 {
|
|
|
|
+ descriptions = append(descriptions, F.ToString("tls-fragment-fallback-delay=", r.TLSFragmentFallbackDelay.String()))
|
|
|
|
+ }
|
|
|
|
+ if r.TLSRecordFragment {
|
|
|
|
+ descriptions = append(descriptions, "tls-record-fragment")
|
|
|
|
+ }
|
|
|
|
+ return descriptions
|
|
}
|
|
}
|
|
|
|
|
|
type RuleActionDNSRoute struct {
|
|
type RuleActionDNSRoute struct {
|