mirror of https://github.com/v2ray/v2ray-core
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
1.6 KiB
81 lines
1.6 KiB
9 years ago
|
package mocks
|
||
|
|
||
|
import (
|
||
9 years ago
|
"github.com/v2ray/v2ray-core/app/point/config"
|
||
9 years ago
|
)
|
||
|
|
||
|
type ConnectionConfig struct {
|
||
|
ProtocolValue string
|
||
9 years ago
|
SettingsValue interface{}
|
||
9 years ago
|
}
|
||
|
|
||
|
func (config *ConnectionConfig) Protocol() string {
|
||
|
return config.ProtocolValue
|
||
|
}
|
||
|
|
||
9 years ago
|
func (config *ConnectionConfig) Settings() interface{} {
|
||
9 years ago
|
return config.SettingsValue
|
||
9 years ago
|
}
|
||
|
|
||
9 years ago
|
type LogConfig struct {
|
||
|
AccessLogValue string
|
||
|
}
|
||
|
|
||
9 years ago
|
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
|
||
|
}
|
||
|
|
||
9 years ago
|
func (config *LogConfig) AccessLog() string {
|
||
|
return config.AccessLogValue
|
||
|
}
|
||
|
|
||
9 years ago
|
type Config struct {
|
||
|
PortValue uint16
|
||
9 years ago
|
LogConfigValue *LogConfig
|
||
9 years ago
|
InboundConfigValue *ConnectionConfig
|
||
|
OutboundConfigValue *ConnectionConfig
|
||
9 years ago
|
InboundDetoursValue []*InboundDetourConfig
|
||
9 years ago
|
}
|
||
|
|
||
|
func (config *Config) Port() uint16 {
|
||
|
return config.PortValue
|
||
|
}
|
||
|
|
||
9 years ago
|
func (config *Config) LogConfig() config.LogConfig {
|
||
|
return config.LogConfigValue
|
||
|
}
|
||
|
|
||
9 years ago
|
func (config *Config) InboundConfig() config.ConnectionConfig {
|
||
9 years ago
|
return config.InboundConfigValue
|
||
|
}
|
||
|
|
||
9 years ago
|
func (config *Config) OutboundConfig() config.ConnectionConfig {
|
||
9 years ago
|
return config.OutboundConfigValue
|
||
|
}
|
||
9 years ago
|
|
||
|
func (this *Config) InboundDetours() []config.InboundDetourConfig {
|
||
|
detours := make([]config.InboundDetourConfig, len(this.InboundDetoursValue))
|
||
|
for idx, detour := range this.InboundDetoursValue {
|
||
|
detours[idx] = detour
|
||
|
}
|
||
|
return detours
|
||
|
}
|