Change algorithm of TCP relaying

This commit is contained in:
9seconds
2021-08-27 17:22:36 +03:00
parent 4b7be8c565
commit 456ed5b051
18 changed files with 300 additions and 434 deletions
+10 -2
View File
@@ -69,6 +69,9 @@ const (
// DefaultIdleTimeout is a default timeout for closing a connection
// in case of idling.
//
// Deprecated: no longer in use because of changed TCP relay
// algorithm.
DefaultIdleTimeout = time.Minute
// DefaultTolerateTimeSkewness is a default timeout for time
@@ -83,9 +86,14 @@ const (
// by Telegram and a proxy.
SecretKeyLength = 16
// ConnectionIDBytesLength defines a count of random bytes
// used to generate a stream/connection ids.
// ConnectionIDBytesLength defines a count of random bytes used to generate
// a stream/connection ids.
ConnectionIDBytesLength = 16
// TCPRelayReadTimeout defines a max time period between two consecuitive
// reads from Telegram after which connection will be terminated. This is
// required to abort stale connections.
TCPRelayReadTimeout = 20 * time.Second
)
// Network defines a knowledge how to work with a network. It may sound