1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-01-08 02:16:28 -05:00
v2fly/shell/point/config/testing/mocks/config.go

106 lines
2.3 KiB
Go
Raw Normal View History

2015-09-19 09:35:20 -04:00
package mocks
import (
2015-11-22 11:41:52 -05:00
routerconfig "github.com/v2ray/v2ray-core/app/router/config"
2015-11-21 15:43:40 -05:00
v2net "github.com/v2ray/v2ray-core/common/net"
2015-11-29 08:45:32 -05:00
"github.com/v2ray/v2ray-core/shell/point/config"
2015-09-19 09:35:20 -04:00
)
type ConnectionConfig struct {
ProtocolValue string
2015-10-06 17:11:08 -04:00
SettingsValue interface{}
2015-09-19 09:35:20 -04:00
}
func (config *ConnectionConfig) Protocol() string {
return config.ProtocolValue
}
func (config *ConnectionConfig) Settings() interface{} {
2015-10-06 17:11:08 -04:00
return config.SettingsValue
2015-09-19 09:35:20 -04:00
}
2015-10-09 11:58:35 -04:00
type LogConfig struct {
AccessLogValue string
}
2015-10-31 17:22:43 -04:00
type PortRange struct {
2015-12-02 06:47:54 -05:00
FromValue v2net.Port
ToValue v2net.Port
2015-10-31 17:22:43 -04:00
}
2015-12-02 06:47:54 -05:00
func (this *PortRange) From() v2net.Port {
2015-10-31 17:22:43 -04:00
return this.FromValue
}
2015-12-02 06:47:54 -05:00
func (this *PortRange) To() v2net.Port {
2015-10-31 17:22:43 -04:00
return this.ToValue
}
type InboundDetourConfig struct {
ConnectionConfig
PortRangeValue *PortRange
}
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
}
2015-11-22 11:41:52 -05:00
type OutboundDetourConfig struct {
ConnectionConfig
TagValue string
2015-11-22 11:41:52 -05:00
}
func (this *OutboundDetourConfig) Tag() string {
2015-11-22 11:41:52 -05:00
return this.TagValue
}
2015-10-09 11:58:35 -04:00
func (config *LogConfig) AccessLog() string {
return config.AccessLogValue
}
2015-09-19 09:35:20 -04:00
type Config struct {
2015-11-22 11:41:52 -05:00
PortValue uint16
LogConfigValue *LogConfig
RouterConfigValue routerconfig.RouterConfig
InboundConfigValue *ConnectionConfig
OutboundConfigValue *ConnectionConfig
InboundDetoursValue []*InboundDetourConfig
OutboundDetoursValue []*OutboundDetourConfig
2015-09-19 09:35:20 -04:00
}
func (config *Config) Port() uint16 {
return config.PortValue
}
2015-10-09 11:58:35 -04:00
func (config *Config) LogConfig() config.LogConfig {
return config.LogConfigValue
}
2015-11-22 11:41:52 -05:00
func (this *Config) RouterConfig() routerconfig.RouterConfig {
return this.RouterConfigValue
}
2015-10-06 17:11:08 -04:00
func (config *Config) InboundConfig() config.ConnectionConfig {
2015-09-19 09:35:20 -04:00
return config.InboundConfigValue
}
2015-10-06 17:11:08 -04:00
func (config *Config) OutboundConfig() config.ConnectionConfig {
2015-09-19 09:35:20 -04:00
return config.OutboundConfigValue
}
2015-10-31 17:22:43 -04:00
func (this *Config) InboundDetours() []config.InboundDetourConfig {
detours := make([]config.InboundDetourConfig, len(this.InboundDetoursValue))
for idx, detour := range this.InboundDetoursValue {
detours[idx] = detour
}
return detours
}
2015-11-22 11:41:52 -05:00
func (this *Config) OutboundDetours() []config.OutboundDetourConfig {
detours := make([]config.OutboundDetourConfig, len(this.OutboundDetoursValue))
for idx, detour := range this.OutboundDetoursValue {
detours[idx] = detour
}
return detours
}