mirror of
https://github.com/SagerNet/sing-box.git
synced 2026-11-10 21:21:02 +08:00
Changes to the cache file are collected in a write buffer and written in one transaction when the buffer reaches buffer_size, when the OOM killer releases memory, or when sing-box is closed. An optional flush_interval writes the buffer periodically. Previously each DNS response, RDRC entry and FakeIP mapping was committed in its own transaction. Also open the database with NoFreelistSync, and mark store_rdrc and rdrc_timeout as deprecated in the options.
36 lines
1.0 KiB
Go
36 lines
1.0 KiB
Go
package constant
|
|
|
|
import "time"
|
|
|
|
const (
|
|
TCPKeepAliveInitial = 5 * time.Minute
|
|
TCPKeepAliveInterval = 75 * time.Second
|
|
TCPConnectTimeout = 5 * time.Second
|
|
TCPTimeout = 15 * time.Second
|
|
ReadPayloadTimeout = 300 * time.Millisecond
|
|
DNSTimeout = 10 * time.Second
|
|
UDPTimeout = 5 * time.Minute
|
|
ICMPTimeout = 10 * time.Second
|
|
DefaultURLTestInterval = 3 * time.Minute
|
|
DefaultURLTestIdleTimeout = 30 * time.Minute
|
|
StartTimeout = 10 * time.Second
|
|
StopTimeout = 5 * time.Second
|
|
FatalStopTimeout = 10 * time.Second
|
|
TLSFragmentFallbackDelay = 500 * time.Millisecond
|
|
)
|
|
|
|
var PortProtocols = map[uint16]string{
|
|
53: ProtocolDNS,
|
|
123: ProtocolNTP,
|
|
3478: ProtocolSTUN,
|
|
443: ProtocolQUIC,
|
|
}
|
|
|
|
var ProtocolTimeouts = map[string]time.Duration{
|
|
ProtocolDNS: 10 * time.Second,
|
|
ProtocolNTP: 10 * time.Second,
|
|
ProtocolSTUN: 10 * time.Second,
|
|
ProtocolQUIC: 30 * time.Second,
|
|
ProtocolDTLS: 30 * time.Second,
|
|
}
|