v2ray-core/shell/point/json/inbound_detour.go

52 lines
1.4 KiB
Go
Raw Normal View History

2015-10-31 21:22:43 +00:00
package json
import (
"encoding/json"
2015-11-21 20:43:40 +00:00
v2net "github.com/v2ray/v2ray-core/common/net"
v2netjson "github.com/v2ray/v2ray-core/common/net/json"
2015-10-31 21:22:43 +00:00
proxyconfig "github.com/v2ray/v2ray-core/proxy/common/config"
2015-12-28 22:17:38 +00:00
"github.com/v2ray/v2ray-core/shell/point"
2015-10-31 21:22:43 +00:00
)
2015-12-28 22:17:38 +00:00
type InboundDetourAllocationConfig struct {
StrategyValue string `json:"strategy"`
ConcurrencyValue int `json:"concurrency"`
}
func (this *InboundDetourAllocationConfig) Strategy() string {
return this.StrategyValue
}
func (this *InboundDetourAllocationConfig) Concurrency() int {
return this.ConcurrencyValue
}
2015-10-31 21:22:43 +00:00
type InboundDetourConfig struct {
2015-12-28 22:17:38 +00: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 21:22:43 +00:00
}
func (this *InboundDetourConfig) Protocol() string {
return this.ProtocolValue
}
2015-11-21 20:43:40 +00:00
func (this *InboundDetourConfig) PortRange() v2net.PortRange {
2015-10-31 21:22:43 +00:00
return this.PortRangeValue
}
func (this *InboundDetourConfig) Settings() interface{} {
return loadConnectionConfig(this.SettingsValue, this.ProtocolValue, proxyconfig.TypeInbound)
}
2015-12-07 23:54:45 +00:00
func (this *InboundDetourConfig) Tag() string {
return this.TagValue
}