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"
|
|
|
|
)
|
|
|
|
|
|
|
|
type InboundDetourConfig struct {
|
2015-11-21 20:43:40 +00:00
|
|
|
ProtocolValue string `json:"protocol"`
|
|
|
|
PortRangeValue *v2netjson.PortRange `json:"port"`
|
|
|
|
SettingsValue json.RawMessage `json:"settings"`
|
2015-12-07 23:54:45 +00:00
|
|
|
TagValue string `json:"tag"`
|
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
|
|
|
|
}
|