1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-02-01 06:06:53 -05:00
v2fly/testing/mocks/config.go

81 lines
1.6 KiB
Go
Raw Normal View History

2015-09-19 09:35:20 -04:00
package mocks
import (
2015-10-30 17:50:45 -04:00
"github.com/v2ray/v2ray-core/app/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 {
FromValue uint16
ToValue uint16
}
func (this *PortRange) From() uint16 {
return this.FromValue
}
func (this *PortRange) To() uint16 {
return this.ToValue
}
type InboundDetourConfig struct {
ConnectionConfig
PortRangeValue *PortRange
}
func (this *InboundDetourConfig) PortRange() config.PortRange {
return this.PortRangeValue
}
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 {
PortValue uint16
2015-10-09 11:58:35 -04:00
LogConfigValue *LogConfig
2015-09-19 09:35:20 -04:00
InboundConfigValue *ConnectionConfig
OutboundConfigValue *ConnectionConfig
2015-10-31 17:22:43 -04:00
InboundDetoursValue []*InboundDetourConfig
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-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
}