v2ray-core/transport/config.go

24 lines
448 B
Go
Raw Normal View History

2016-06-02 01:49:25 +02:00
package transport
2016-06-11 19:51:02 +08:00
import "github.com/v2ray/v2ray-core/transport/hub/kcpv"
2016-06-11 13:29:33 +02:00
// Config for V2Ray transport layer.
2016-06-02 20:52:52 +02:00
type Config struct {
2016-06-02 01:49:25 +02:00
ConnectionReuse bool
2016-06-11 19:51:02 +08:00
enableKcp bool
kcpConfig *kcpv.Config
2016-06-02 01:49:25 +02:00
}
2016-06-11 13:29:33 +02:00
// Apply applies this Config.
2016-06-02 20:52:52 +02:00
func (this *Config) Apply() error {
if this.ConnectionReuse {
connectionReuse = true
}
2016-06-11 19:51:02 +08:00
enableKcp = this.enableKcp
if enableKcp {
KcpConfig = this.kcpConfig
connectionReuse = false
2016-06-11 19:51:02 +08:00
}
2016-06-02 20:52:52 +02:00
return nil
2016-06-02 01:49:25 +02:00
}