config.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // Copyright (C) 2017 The Syncthing Authors.
  2. //
  3. // This Source Code Form is subject to the terms of the Mozilla Public
  4. // License, v. 2.0. If a copy of the MPL was not distributed with this file,
  5. // You can obtain one at http://mozilla.org/MPL/2.0/.
  6. package connections
  7. import (
  8. "io/ioutil"
  9. "time"
  10. "github.com/hashicorp/yamux"
  11. )
  12. const (
  13. tcpPriority = 10
  14. kcpPriority = 50
  15. relayPriority = 200
  16. // KCP filter priorities
  17. kcpNoFilterPriority = 100
  18. kcpConversationFilterPriority = 20
  19. kcpStunFilterPriority = 10
  20. // KCP SetNoDelay options
  21. // 0 - disabled (default)
  22. // 1 - enabled
  23. kcpNoDelay = 0
  24. kcpUpdateInterval = 100 // ms (default)
  25. // 0 - disable (default)
  26. // 1 - enabled
  27. kcpFastResend = 0
  28. // 0 - enabled (default)
  29. // 1 - disabled
  30. kcpCongestionControl = 0
  31. // KCP window sizes
  32. kcpSendWindowSize = 128
  33. kcpReceiveWindowSize = 128
  34. )
  35. var (
  36. yamuxConfig = &yamux.Config{
  37. AcceptBacklog: 256,
  38. EnableKeepAlive: true,
  39. KeepAliveInterval: 30 * time.Second,
  40. ConnectionWriteTimeout: 10 * time.Second,
  41. MaxStreamWindowSize: 256 * 1024,
  42. LogOutput: ioutil.Discard,
  43. }
  44. )