2015-10-31 17:22:43 -04:00
|
|
|
package json
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
|
2015-11-21 15:43:40 -05:00
|
|
|
v2net "github.com/v2ray/v2ray-core/common/net"
|
|
|
|
v2netjson "github.com/v2ray/v2ray-core/common/net/json"
|
2015-12-28 17:17:38 -05:00
|
|
|
"github.com/v2ray/v2ray-core/shell/point"
|
2015-10-31 17:22:43 -04:00
|
|
|
)
|
|
|
|
|
2015-12-28 17:17:38 -05:00
|
|
|
type InboundDetourAllocationConfig struct {
|
|
|
|
StrategyValue string `json:"strategy"`
|
|
|
|
ConcurrencyValue int `json:"concurrency"`
|
2015-12-29 14:52:35 -05:00
|
|
|
RefreshSec int `json:"refresh"`
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *InboundDetourAllocationConfig) Refresh() int {
|
|
|
|
return this.RefreshSec
|
2015-12-28 17:17:38 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *InboundDetourAllocationConfig) Strategy() string {
|
|
|
|
return this.StrategyValue
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *InboundDetourAllocationConfig) Concurrency() int {
|
|
|
|
return this.ConcurrencyValue
|
|
|
|
}
|
|
|
|
|
2015-10-31 17:22:43 -04:00
|
|
|
type InboundDetourConfig struct {
|
2015-12-28 17:17:38 -05:00
|
|
|
ProtocolValue string `json:"protocol"`
|
|
|
|
PortRangeValue *v2netjson.PortRange `json:"port"`
|
|
|
|
SettingsValue json.RawMessage `json:"settings"`
|
|
|
|
TagValue string `json:"tag"`
|
|
|
|
AllocationValue *InboundDetourAllocationConfig `json:"allocate"`
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *InboundDetourConfig) Allocation() point.InboundDetourAllocationConfig {
|
|
|
|
return this.AllocationValue
|
2015-10-31 17:22:43 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *InboundDetourConfig) Protocol() string {
|
|
|
|
return this.ProtocolValue
|
|
|
|
}
|
|
|
|
|
2015-11-21 15:43:40 -05:00
|
|
|
func (this *InboundDetourConfig) PortRange() v2net.PortRange {
|
2015-10-31 17:22:43 -04:00
|
|
|
return this.PortRangeValue
|
|
|
|
}
|
|
|
|
|
2016-01-02 11:40:51 -05:00
|
|
|
func (this *InboundDetourConfig) Settings() []byte {
|
|
|
|
return []byte(this.SettingsValue)
|
2015-10-31 17:22:43 -04:00
|
|
|
}
|
2015-12-07 18:54:45 -05:00
|
|
|
|
|
|
|
func (this *InboundDetourConfig) Tag() string {
|
|
|
|
return this.TagValue
|
|
|
|
}
|