config.go 649 B

123456789101112131415161718192021222324252627282930
  1. package transport
  2. import "github.com/v2ray/v2ray-core/transport/hub/kcpv"
  3. // Config for V2Ray transport layer.
  4. type Config struct {
  5. ConnectionReuse bool
  6. enableKcp bool
  7. kcpConfig *kcpv.Config
  8. }
  9. // Apply applies this Config.
  10. func (this *Config) Apply() error {
  11. if this.ConnectionReuse {
  12. connectionReuse = true
  13. }
  14. enableKcp = this.enableKcp
  15. if enableKcp {
  16. KcpConfig = this.kcpConfig
  17. /*
  18. KCP do not support connectionReuse,
  19. it is mandatory to set connectionReuse to false
  20. Since KCP have no handshake and
  21. does not SlowStart, there isn't benefit to
  22. use that anyway.
  23. */
  24. connectionReuse = false
  25. }
  26. return nil
  27. }