diff --git a/README.md b/README.md index 334df82..aff08cd 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ frp is a fast reverse proxy to help you expose a local server behind a NAT or fi * [Privilege Mode](#privilege-mode) * [Port White List](#port-white-list) * [TCP Stream Multiplexing](#tcp-stream-multiplexing) + * [Support KCP Protocol](#support-kcp-protocol) * [Connection Pool](#connection-pool) * [Rewriting the Host Header](#rewriting-the-host-header) * [Password protecting your web service](#password-protecting-your-web-service) @@ -319,6 +320,35 @@ You can disable this feature by modify frps.ini and frpc.ini: tcp_mux = false ``` +### Support KCP Protocol + +frp support kcp protocol since v0.12.0. + +KCP is a fast and reliable protocol that can achieve the transmission effect of a reduction of the average latency by 30% to 40% and reduction of the maximum delay by a factor of three, at the cost of 10% to 20% more bandwidth wasted than TCP. + +Using kcp in frp: + +1. Enable kcp protocol in frps: + + ```ini + # frps.ini + [common] + bind_port = 7000 + # kcp needs to bind a udp port, it can be same with 'bind_port' + kcp_bind_port = 7000 + ``` + +2. Configure the protocol used in frpc to connect frps: + + ```ini + # frpc.ini + [common] + server_addr = x.x.x.x + # specify the 'kcp_bind_port' in frps + server_port = 7000 + protocol = kcp + ``` + ### Connection Pool By default, frps send message to frpc for create a new connection to backward service when getting an user request.If a proxy's connection pool is enabled, there will be a specified number of connections pre-established. diff --git a/README_zh.md b/README_zh.md index ee4fc86..160ca21 100644 --- a/README_zh.md +++ b/README_zh.md @@ -26,6 +26,7 @@ frp 是一个可用于内网穿透的高性能的反向代理应用,支持 tcp * [特权模式](#特权模式) * [端口白名单](#端口白名单) * [TCP 多路复用](#tcp-多路复用) + * [支持 kcp 协议](#支持-kcp-协议) * [连接池](#连接池) * [修改 Host Header](#修改-host-header) * [通过密码保护你的 web 服务](#通过密码保护你的-web-服务) @@ -326,6 +327,35 @@ privilege_allow_ports 可以配置允许使用的某个指定端口或者是一 tcp_mux = false ``` +### 支持 kcp 协议 + +从 v0.12.0 版本开始,底层通信协议支持选择 kcp 协议,在弱网环境下传输效率提升明显,但是会有一些额外的流量消耗。 + +开启 kcp 协议支持: + +1. 在 frps.ini 中启用 kcp 协议支持,指定一个 udp 端口用于接收客户端请求: + + ```ini + # frps.ini + [common] + bind_port = 7000 + # kcp 绑定的是 udp 端口,可以和 bind_port 一样 + kcp_bind_port = 7000 + ``` + +2. 在 frpc.ini 指定需要使用的协议类型,目前只支持 tcp 和 kcp。其他代理配置不需要变更: + + ```ini + # frpc.ini + [common] + server_addr = x.x.x.x + # server_port 指定为 frps 的 kcp_bind_port + server_port = 7000 + protocol = kcp + ``` + +3. 像之前一样使用 frp,需要注意开放相关机器上的 udp 的端口的访问权限。 + ### 连接池 默认情况下,当用户请求建立连接后,frps 才会请求 frpc 主动与后端服务建立一个连接。当为指定的代理启用连接池后,frp 会预先和后端服务建立起指定数量的连接,每次接收到用户请求后,会从连接池中取出一个连接和用户连接关联起来,避免了等待与后端服务建立连接以及 frpc 和 frps 之间传递控制信息的时间。 diff --git a/conf/frps_full.ini b/conf/frps_full.ini index bc70cc2..fa72838 100644 --- a/conf/frps_full.ini +++ b/conf/frps_full.ini @@ -5,6 +5,10 @@ bind_addr = 0.0.0.0 bind_port = 7000 +# udp port used for kcp protocol, it can be same with 'bind_port' +# if not set, kcp is disabled in frps +kcp_bind_port = 7000 + # if you want to support virtual host, you must set the http port for listening (optional) vhost_http_port = 80 vhost_https_port = 443 @@ -49,6 +53,3 @@ subdomain_host = frps.com # if tcp stream multiplexing is used, default is true tcp_mux = true - -# if server support client using kcp protocol, default is true -support_kcp = true