Quellcode durchsuchen

Refresh rate of a inbound detour allocation

v2ray vor 9 Jahren
Ursprung
Commit
e19d8002a8
3 geänderte Dateien mit 13 neuen und 2 gelöschten Zeilen
  1. 3 2
      shell/point/config.go
  2. 5 0
      shell/point/json/inbound_detour.go
  3. 5 0
      shell/point/testing/mocks/config.go

+ 3 - 2
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 {

+ 5 - 0
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 {

+ 5 - 0
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 {