use dynamic idle timeout

This commit is contained in:
Hiddify
2024-03-19 12:25:51 +01:00
parent a5ca136a4c
commit 558b152668
2 changed files with 11 additions and 10 deletions

View File

@@ -450,10 +450,11 @@ func BuildConfig(opt ConfigOptions, input option.Options) (*option.Options, erro
Type: C.TypeURLTest, Type: C.TypeURLTest,
Tag: OutboundURLTestTag, Tag: OutboundURLTestTag,
URLTestOptions: option.URLTestOutboundOptions{ URLTestOptions: option.URLTestOutboundOptions{
Outbounds: tags, Outbounds: tags,
URL: opt.ConnectionTestUrl, URL: opt.ConnectionTestUrl,
Interval: option.Duration(opt.URLTestInterval.Duration()), Interval: option.Duration(opt.URLTestInterval.Duration()),
IdleTimeout: option.Duration(opt.URLTestIdleTimeout.Duration()), // IdleTimeout: option.Duration(opt.URLTestIdleTimeout.Duration()),
IdleTimeout: option.Duration(opt.URLTestInterval.Duration().Nanoseconds() * 10),
}, },
} }

View File

@@ -45,9 +45,9 @@ type InboundOptions struct {
} }
type URLTestOptions struct { type URLTestOptions struct {
ConnectionTestUrl string `json:"connection-test-url"` ConnectionTestUrl string `json:"connection-test-url"`
URLTestInterval DurationInSeconds `json:"url-test-interval"` URLTestInterval DurationInSeconds `json:"url-test-interval"`
URLTestIdleTimeout DurationInSeconds `json:"url-test-idle-timeout"` // URLTestIdleTimeout DurationInSeconds `json:"url-test-idle-timeout"`
} }
type RouteOptions struct { type RouteOptions struct {
@@ -108,9 +108,9 @@ func DefaultConfigOptions() *ConfigOptions {
TUNStack: "mixed", TUNStack: "mixed",
}, },
URLTestOptions: URLTestOptions{ URLTestOptions: URLTestOptions{
ConnectionTestUrl: "http://cp.cloudflare.com/", ConnectionTestUrl: "http://cp.cloudflare.com/",
URLTestInterval: DurationInSeconds(600), URLTestInterval: DurationInSeconds(600),
URLTestIdleTimeout: DurationInSeconds(6000), // URLTestIdleTimeout: DurationInSeconds(6000),
}, },
RouteOptions: RouteOptions{ RouteOptions: RouteOptions{
ResolveDestination: false, ResolveDestination: false,