From 558b152668d3b2c92feb3a84ea14fd516cb14636 Mon Sep 17 00:00:00 2001 From: Hiddify Date: Tue, 19 Mar 2024 12:25:51 +0100 Subject: [PATCH] use dynamic idle timeout --- config/config.go | 9 +++++---- config/option.go | 12 ++++++------ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/config/config.go b/config/config.go index 69c0596..f251003 100644 --- a/config/config.go +++ b/config/config.go @@ -450,10 +450,11 @@ func BuildConfig(opt ConfigOptions, input option.Options) (*option.Options, erro Type: C.TypeURLTest, Tag: OutboundURLTestTag, URLTestOptions: option.URLTestOutboundOptions{ - Outbounds: tags, - URL: opt.ConnectionTestUrl, - Interval: option.Duration(opt.URLTestInterval.Duration()), - IdleTimeout: option.Duration(opt.URLTestIdleTimeout.Duration()), + Outbounds: tags, + URL: opt.ConnectionTestUrl, + Interval: option.Duration(opt.URLTestInterval.Duration()), + // IdleTimeout: option.Duration(opt.URLTestIdleTimeout.Duration()), + IdleTimeout: option.Duration(opt.URLTestInterval.Duration().Nanoseconds() * 10), }, } diff --git a/config/option.go b/config/option.go index 98d4c39..4242681 100644 --- a/config/option.go +++ b/config/option.go @@ -45,9 +45,9 @@ type InboundOptions struct { } type URLTestOptions struct { - ConnectionTestUrl string `json:"connection-test-url"` - URLTestInterval DurationInSeconds `json:"url-test-interval"` - URLTestIdleTimeout DurationInSeconds `json:"url-test-idle-timeout"` + ConnectionTestUrl string `json:"connection-test-url"` + URLTestInterval DurationInSeconds `json:"url-test-interval"` + // URLTestIdleTimeout DurationInSeconds `json:"url-test-idle-timeout"` } type RouteOptions struct { @@ -108,9 +108,9 @@ func DefaultConfigOptions() *ConfigOptions { TUNStack: "mixed", }, URLTestOptions: URLTestOptions{ - ConnectionTestUrl: "http://cp.cloudflare.com/", - URLTestInterval: DurationInSeconds(600), - URLTestIdleTimeout: DurationInSeconds(6000), + ConnectionTestUrl: "http://cp.cloudflare.com/", + URLTestInterval: DurationInSeconds(600), + // URLTestIdleTimeout: DurationInSeconds(6000), }, RouteOptions: RouteOptions{ ResolveDestination: false,