TCP¶
名称: tcp
状态: Stable
TCP监听器根据服务配置,监听在指定TCP端口。
提示
TCP监听器是GOST中默认的监听器,当不指定监听器类型时,默认使用此监听器。
参数列表¶
keepalive(bool, default=false):- Enable TCP keep-alive probes on accepted connections. When a client connects and then silently disappears (e.g. network partition, host crash), the OS-level TCP keep-alive mechanism detects the dead connection and closes it, freeing server-side resources. Set to
trueto enable. This is the primary defense against connection leaks from dead peers in long-lived CONNECT tunnels. keepalive.idle(time.Duration):- The idle time before the first keep-alive probe is sent on accepted connections. Equivalent to
TCP_KEEPIDLEon Linux. Only effective whenkeepaliveistrue. keepalive.interval(time.Duration):- The interval between successive keep-alive probes. Equivalent to
TCP_KEEPINTVLon Linux. Only effective whenkeepaliveistrue. keepalive.count(int):- The number of unacknowledged keep-alive probes before the connection is declared dead. Equivalent to
TCP_KEEPCNTon Linux. Only effective whenkeepaliveistrue. reuseport(bool, default=false):- Enable
SO_REUSEPORTsocket option, allowing multiple listeners to bind to the same port for load distribution across processes. mptcp(bool, default=false):- Enable Multipath TCP (MPTCP) on the listener, allowing connections to use multiple network paths simultaneously for improved throughput and resilience.