1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-08 19:28:21 -05:00
v2fly/shell/point/json/inbound_detour.go

56 lines
1.4 KiB
Go
Raw Normal View History

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"`
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
}
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
}