diff --git a/shell/point/config.go b/shell/point/config.go index 34d8985f9..81b5cb333 100644 --- a/shell/point/config.go +++ b/shell/point/config.go @@ -30,8 +30,9 @@ const ( ) type InboundDetourAllocationConfig interface { - Strategy() string - Concurrency() int + Strategy() string // Allocation strategy of this inbound detour. + Concurrency() int // Number of handlers (ports) running in parallel. + Refresh() int // Number of seconds before a handler is regenerated. } type InboundDetourConfig interface { diff --git a/shell/point/json/inbound_detour.go b/shell/point/json/inbound_detour.go index 50d779fbb..a7604e1b0 100644 --- a/shell/point/json/inbound_detour.go +++ b/shell/point/json/inbound_detour.go @@ -12,6 +12,11 @@ import ( type InboundDetourAllocationConfig struct { StrategyValue string `json:"strategy"` ConcurrencyValue int `json:"concurrency"` + RefreshSec int `json:"refresh"` +} + +func (this *InboundDetourAllocationConfig) Refresh() int { + return this.RefreshSec } func (this *InboundDetourAllocationConfig) Strategy() string { diff --git a/shell/point/testing/mocks/config.go b/shell/point/testing/mocks/config.go index 7085fc0ec..b094e9a4f 100644 --- a/shell/point/testing/mocks/config.go +++ b/shell/point/testing/mocks/config.go @@ -55,6 +55,11 @@ func (this *PortRange) To() v2net.Port { type InboundDetourAllocationConfig struct { StrategyValue string ConcurrencyValue int + RefreshSec int +} + +func (this *InboundDetourAllocationConfig) Refresh() int { + return this.RefreshSec } func (this *InboundDetourAllocationConfig) Strategy() string {