mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-09-01 11:24:02 +03:00
Add separate handshake timeout
This PR adds a new setting to the config: `network.timeout`. This setting defines a time period during which all handshake procedures and ceremonies must be completed. If not - connection is aborted. This should help in situations when connection is established but client cannot continue for some reason (for example, RST sent by some middle box).
This commit is contained in:
@@ -70,6 +70,12 @@ type ProxyOpts struct {
|
||||
// This is an optional setting.
|
||||
IdleTimeout time.Duration
|
||||
|
||||
// HandshakeTimeout is a timeout during which all handshake ceremonies must
|
||||
// be completed, otherwise this process will be aborted
|
||||
//
|
||||
// This is an optional setting.
|
||||
HandshakeTimeout time.Duration
|
||||
|
||||
// TolerateTimeSkewness is a time boundary that defines a time range where
|
||||
// faketls timestamp is acceptable.
|
||||
//
|
||||
@@ -215,6 +221,14 @@ func (p ProxyOpts) getPreferIP() string {
|
||||
return p.PreferIP
|
||||
}
|
||||
|
||||
func (p ProxyOpts) getHandshakeTimeout() time.Duration {
|
||||
if p.HandshakeTimeout == 0 {
|
||||
return DefaultHandshakeTimeout
|
||||
}
|
||||
|
||||
return p.HandshakeTimeout
|
||||
}
|
||||
|
||||
func (p ProxyOpts) getIdleTimeout() time.Duration {
|
||||
if p.IdleTimeout == 0 {
|
||||
return DefaultIdleTimeout
|
||||
|
||||
Reference in New Issue
Block a user