<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>协议 :: NJET文档</title>
    <link>https://docs.njet.org.cn/docs/v4.0.1/reference/protocol/index.html</link>
    <description></description>
    <generator>Hugo</generator>
    <language>zh</language>
    <lastBuildDate>Wed, 10 Sep 2025 11:31:14 +0800</lastBuildDate>
    <atom:link href="https://docs.njet.org.cn/docs/v4.0.1/reference/protocol/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Http3 支持</title>
      <link>https://docs.njet.org.cn/docs/v4.0.1/reference/protocol/http3_suport/index.html</link>
      <pubDate>Fri, 15 Aug 2025 14:51:51 +0800</pubDate>
      <guid>https://docs.njet.org.cn/docs/v4.0.1/reference/protocol/http3_suport/index.html</guid>
      <description>1.功能描述 HTTP3 相关协议主要包括 QUIC 协议(RFC 9000, RFC 9001, RFC 9002 RFC 9221 RFC 8899). 具体的HTTP/3 (RFC 9114), 以及QPACK (RFC 9204). 这些协议在阿里巴巴的xquic项目的doc下有翻译成中文的协议，不过版本不是最新的。还可以参考深入剖析HTTP3协议。&#xA;目前在nginx1.25.0中，已经支持http3/quic协议了，不过NINGX宣称目前对HTTP3的支持还是实验性的。&#xA;对比之前的quic分支，去除了server端push的功能，原因是浏览器（chrome）中去除了对这个功能的支持。此外还去除了stream的quic支持，开发者说可能会考虑在以后再加回来，之前开发主要是调试quic协议。&#xA;QUIC(Quick UDP Internet Connection)是谷歌推出的一套基于UDP的传输协议，它实现了TCP + HTTPS + HTTP/2的功能，目的是保证可靠性的同时降低网络延迟。因为UDP是一个简单传输协议，基于UDP可以摆脱TCP传输确认、重传慢启动等因素，建立安全连接只需要一的个往返时间，它还实现了HTTP/2多路复用、头部压缩等功能。&#xA;众所周知UDP比TCP传输速度快，TCP是可靠协议，但是代价是双方确认数据而衍生的一系列消耗。其次TCP是系统内核实现的，如果升级TCP协议，就得让用户升级系统，这个的门槛比较高，而QUIC在UDP基础上由客户端自由发挥，只要有服务器能对接就可以。&#xA;2.指令说明 开启、关闭http3功能。&#xA;Syntax: http3 on | off; Default: http3 on; Context: http, server 开启、关闭对QUIC协议对HTTP/0.9功能的支持。&#xA;Syntax: http3_hq on | off; Default: http3_hq off; Context: http, server 设置在一个Connection内允许的请求stream数目最大值&#xA;Syntax: http3_max_concurrent_streams number; Default: http3_max_concurrent_streams 128; Context: http, server 设置在读写QUIC streams时的缓冲区大小</description>
    </item>
    <item>
      <title>PASV ftp</title>
      <link>https://docs.njet.org.cn/docs/v4.0.1/reference/protocol/pasv_ftp/index.html</link>
      <pubDate>Fri, 15 Aug 2025 11:26:32 +0800</pubDate>
      <guid>https://docs.njet.org.cn/docs/v4.0.1/reference/protocol/pasv_ftp/index.html</guid>
      <description>1.功能描述 文件传输协议（File Transfer Protocol，FTP），基于该协议FTP客户端与服务端可以实现共享文件、上传文件、下载、删除文件。FTP服务器端可以同时提供给多人共享使用。&#xA;FTP服务是Client/Server（简称C/S）模式，基于FTP协议实现FTP文件对外共享及传输的软件称之为FTP服务器源端，客户端程序基于FTP协议，则称之为FTP客户端，FTP客户端可以向FTP服务器上传、下载文件。&#xA;FTP上传和下载文件需要有两个tcp连接：&#xA;一个是控制连接（port:21），控制连接用于在两个主机之间传输控制信息，如口令，用户标识，存放、获取文件等命令&#xA;一个是数据连接(port:20)。数据连接用于实际发送一个文件,发送完文件之后数据连接会关闭&#xA;关于数据连接的建立实际又有两种模式：主动模式和被动模式&#xA;主动模式 Port（服务端连接客户端） 客户端开启一个端口N（&gt;1023）向服务端的21端口，建立连接，同时开启一个N+1端口监听，告诉服务端，我监听的是N+1端口，服务端接到请求之后，用自己的20端口连接到客户端的N+1端口，进行传输&#xA;被动模式 Passive（客户端连接服务端） 客户端同时随机开启两个端口（比如1024，1025），一个端口（1024）跟服务端的21端口建立连接。服务端接到请求之后，随机会开启一个端口（1027）并告诉客户端我开启的是1027端口，客户端用另一个端口（1025）与服务端的（1027）端口进行连接，传输数据&#xA;隐式FTPS FTP服务器要求FTP客户必须初始化SSL握手过程并和FTP服务器之间建立安全的加密控制连接, 加密控制连接建立之后FTP命令才能够被送到FTP服务器. 如果FTP客户不支持SSL功能,或它和服务器之间没有建立安全的加密控制连接,FTP服务器将不对来自FTP客户的命令做出任何反应&#xA;功能支持 支持明文的FTP反向代理 支持隐式FTPS模式（客户端和服务端先建立加密连接，再开始发送命令，数据连接也需要加密） FTP/FTPS被动模式支持（ipv4） FTP/FTPS被动模式支持（ipv6） 2.依赖模块 该功能的实现需要依赖range模块 提供的端口流量转发功能&#xA;njet.conf:&#xA;load_module modules/njt_range_module.so; 3.指令说明 控制通道指令 Syntax ftp_ctrl zone={ftp_zone:10M} proxy_ip={192.168.40.136} min_port={12000} max_port={13000}; Default - Context stream，server 参数说明 端口范围跟真实的ftp服务端端口范围没有必然联系，对于客户端来说，只会看到代理的端口范围，并发数受代理端口范围限制&#xA;参数 类型 必填 描述 zone string 是 配置共享内存以及大小 proxy_ip string 是 代理是ipv4情况下会使用此ip返回给客户端ftp代理的IP，因为可能存在默认的127.0.0.1或者多ip情况，必须明确填写ip min_port int 是 ftp 代理支持的端口范围下限 max_port int 是 ftp 代理支持的端口范围上限（max_port-min_port 表示ftp代理支持的最多ftp并发数据连接） 数据通道指令： Syntax ftp_data zone={ftp_zone}; Default - Context stream，server 参数说明 参数 类型 必填 描述 zone string 是 设置共享内存名称，由控制通道创建，此处只需要指定共享内存名称，与控制通道共享内存名称保持一致 4.配置样例 系统依赖</description>
    </item>
    <item>
      <title>Http2mqtt</title>
      <link>https://docs.njet.org.cn/docs/v4.0.1/reference/protocol/http2mqtt/index.html</link>
      <pubDate>Fri, 15 Aug 2025 11:39:54 +0800</pubDate>
      <guid>https://docs.njet.org.cn/docs/v4.0.1/reference/protocol/http2mqtt/index.html</guid>
      <description>1.功能描述 能够接收http1.1 post消息，通过连接mqtt broker， 把数据发送给mqtt broker。&#xA;2.依赖模块 njet.conf:&#xA;load_module modules/njt_http_mqtt_module.so; 3.指令说明 3.1 upstream块指令 mqtt_server Syntax mqtt_server ip[:port] user={user} password={password} Default - Context upstream mqtt upstream server 配置,匿名的不需要配置user和password，配置了也实际不使用&#xA;mqtt_keepalive Syntax mqtt_keepalive off | max=count Default max=10 Context upstream keep_alive配置: max: 表示最多保持多少长连接&#xA;mqtt_retry_times Syntax mqtt_retry_times {num} Default 1,默认尝试一次 Context upstream 当前mqtt broker不可用时，尝试寻找下一个broker的次数，默认是1，尝试一次&#xA;mqtt_send_buffer_size Syntax mqtt_send_buffer_size {size} Default 4M Context upstream 每个mqtt连接使用的发送队列缓存大小，默认4M，如果发送很长的消息或者频繁发送消息，应该设置该值比较足够大一点&#xA;mqtt_recv_buffer_size Syntax mqtt_recv_buffer_size {size} Default 1M Context upstream 每个mqtt连接使用的接收数据缓存大小，默认1M，一般够用，mqtt主要是发送数据给mqtt broker，接收数据主要是一些状态数据等，所以不需要太大缓存&#xA;mqtt_ping_time Syntax mqtt_ping_time {time} Default 5s Context upstream mqtt broker发送ping包间隔，默认5s</description>
    </item>
    <item>
      <title>grpc代理</title>
      <link>https://docs.njet.org.cn/docs/v4.0.1/reference/protocol/grpc_pass/index.html</link>
      <pubDate>Wed, 10 Sep 2025 11:31:14 +0800</pubDate>
      <guid>https://docs.njet.org.cn/docs/v4.0.1/reference/protocol/grpc_pass/index.html</guid>
      <description>1.功能描述 默认自带 njet_http_grpc_module 允许传递请求 到 gRPC 服务器。&#xA;2.依赖模块 无&#xA;3.指令说明 格式说明:&#xA;语法 (Syntax): 描述了该指令在 njet 配置文件中如何书写。 默认值 (Default): 如果未明确配置该指令，njet 使用的默认值。 如果为 “—&#34;，则表示没有默认值，必须显式配置。 上下文 (Context): 该指令可以在哪些配置块中使用，例如 http,server,location。 grpc_bind 语法 (Syntax) grpc_bind address [transparent] | off 默认值 (Default) — 上下文 (Context) http,server,location 描述 (Description):&#xA;使与 gRPC 服务器建立的传出连接从指定的本地 IP 地址（可选项带有端口）发起。参数值可以包含变量。特殊值 off 取消继承自前一个配置级别的 grpc_bind` 指令的效果，允许系统自动分配本地 IP 地址和端口。&#xA;transparent 参数允许与 gRPC 服务器建立的传出连接从非本地 IP 地址发起，例如，从客户端的真实 IP 地址：&#xA;grpc_bind $remote_addr transparent; 为了使此参数生效，通常需要以超级用户权限运行 njet worker 进程。在 Linux 上，如果指定了 transparent 参数，worker 进程会从 master 进程继承 CAP_NET_RAW 能力，因此不需要。还需要配置内核路由表以拦截来自 gRPC 服务器的网络流量。</description>
    </item>
    <item>
      <title>Http2kafka</title>
      <link>https://docs.njet.org.cn/docs/v4.0.1/reference/protocol/http2kafka/index.html</link>
      <pubDate>Fri, 15 Aug 2025 11:44:57 +0800</pubDate>
      <guid>https://docs.njet.org.cn/docs/v4.0.1/reference/protocol/http2kafka/index.html</guid>
      <description>1.功能描述 能够接收http1.1 post消息，通过连接kafka server， 把数据发送给kafka server。&#xA;2.依赖模块 load_module modules/njt_http_kafka_module.so 3.指令说明 kafka_broker_list Syntax kafka_broker_list {broker1,broker2} Default - Context NJT_HTTP_MAIN_CONF|NJT_CONF_TAKE1 配置kafka broker列表地址，逗号分隔&#xA;kafka_sasl_plaintext Syntax kafka_sasl_plaintext user_name={admin} password={123456} Default - Context NJT_HTTP_MAIN_CONF|NJT_CONF_TAKE2 如果是sasl_plaintext 用户名密码验证模式，则配置该指令，设置用户名和密码&#xA;kafka_topic Syntax kafka_topic {topic_name} Default - Context `NJT_HTTP_LOC_CONF 配置需要发送的topic 名称&#xA;kafka_partition Syntax kafka_partition [auto|partition_number] Default kafka_partition auto Context `NJT_HTTP_LOC_CONF 配置需要发送的partition分区， 默认为auto，不指定特定分区，eg：&#xA;kafka_partition auto; # default value # kafka_partition 0; # kafka_partition 1; 4.配置样例 njet.conf:&#xA;... load_module modules/njt_http_kafka_module.so #动态加载kafka代理模块 ... http { #设置broker list kafka_broker_list 127.0.0.1:9092,127.0.0.1:9093,127.0.0.1:9094; #sasl_plaintext 安全模式， 需要设置用户名和密码 kafka_sasl_plaintext user_name=admin password=123456; server { listen 8080; server_name localhost; location /test1 { kafka_topic test-topic; #设置topic name } location /test2 { kafka_topic test-topic; #设置topic name } } } 5.调用样例 以本地路径/root/tool/ssl_kafka 为示例，说明</description>
    </item>
    <item>
      <title>mqtt 代理</title>
      <link>https://docs.njet.org.cn/docs/v4.0.1/reference/protocol/mqtt_proxy/index.html</link>
      <pubDate>Fri, 15 Aug 2025 14:19:46 +0800</pubDate>
      <guid>https://docs.njet.org.cn/docs/v4.0.1/reference/protocol/mqtt_proxy/index.html</guid>
      <description>1.功能描述 能够满足mqtt 客户端的所有请求，代理跟mqtt server之间的通信对mqtt 客户端无感知,支持mqtt明文以及ssl加密两种方式;非mqtt连接，断开连接;客户端同代理的一次session过程中，代理要保证同server端的正确通信，包括server端无感知切换;提供 mqtt_proxy_clientid 变量，upstream可使用该变量做hash路由;心跳，同server不中断时做转发，但是切换server时，代理要回应client 心跳，然后恢复对新server连接后，重新转发&#xA;stream mqtt代理模块采用静态编译，不再编译动态模块&#xA;2.依赖模块 load_module modules/njt_stream_mqtt_proxy_module.so; #加载mqtt代理模块 3.指令说明 mqtt_proxy_pass Syntax: mqtt_proxy_pass address; Default: — Context: server mqtt代理&#xA;mqtt_proxy_next_upstream Syntax: mqtt_proxy_next_upstream on | off; Default: mqtt_proxy_next_upstream on; Context: stream, server 当前server不可用时，是否自动尝试下一个server连接开关&#xA;mqtt_proxy_next_upstream_timeout Syntax: mqtt_proxy_next_upstream_timeout time; Default: mqtt_proxy_next_upstream_timeout 0; Context: stream, server 尝试连接新server的超时时间，0表示不受此时间限制&#xA;mqtt_proxy_next_upstream_tries Syntax: mqtt_proxy_next_upstream_tries number; Default: mqtt_proxy_next_upstream_tries 0; Context: stream, server 尝试连接新server的次数，0表示不尝试连接新server。该次数内 server仍不可用，则关闭客户端连接，同时如果upstream中所有server都已经尝试连接过，则也会直接关闭客户端连接&#xA;mqtt_proxy_ssl Syntax: mqtt_proxy_ssl on | off; Default: mqtt_proxy_ssl off; Context: stream, server 代理连接server是否开启TLS/SSL 协议</description>
    </item>
    <item>
      <title>Tcc</title>
      <link>https://docs.njet.org.cn/docs/v4.0.1/reference/protocol/tcc/index.html</link>
      <pubDate>Thu, 21 Aug 2025 17:48:13 +0800</pubDate>
      <guid>https://docs.njet.org.cn/docs/v4.0.1/reference/protocol/tcc/index.html</guid>
      <description>动态协议相关功能。</description>
    </item>
    <item>
      <title>Proxy_protocol_V2</title>
      <link>https://docs.njet.org.cn/docs/v4.0.1/reference/protocol/proxy_protocol_v2/index.html</link>
      <pubDate>Tue, 19 Aug 2025 11:06:15 +0800</pubDate>
      <guid>https://docs.njet.org.cn/docs/v4.0.1/reference/protocol/proxy_protocol_v2/index.html</guid>
      <description>1. 功能说明 代理协议(Proxy protocol)，是HAProxy的作者Willy Tarreau于2010年开发和设计的一个Internet协议，通过为tcp添加一个很小的包头信息，来方便的传递客户端信息（协议栈、源IP、目的IP、源端口、目的端口等)，在网络情况复杂又需要获取用户真实IP时非常有用。&#xA;代理协议分为V1和V2两个版本，V1是人类易读的，V2是二进制格式的，并且支持tlv 功能。&#xA;v1介绍 :&#xA;Proxy protocol V1的格式如下:&#xA;PROXY 协议栈 源IP 目的IP 源端口 目的端口rn&#xA;例如：&#xA;PROXY TCP4 192.168.0.1 192.168.0.11 56324 443\r\n GET / HTTP/1.1\r\n Host: 192.168.0.11\r\n \r\n&#xA;v2 介绍 :&#xA;相比V1，v2利用二进制格式以实现更高的解析效率，并可以增加特定的扩展属性（TLV）&#xA;在标准的地址信息后，如果有额外的数据，则该数据是TLV数组。每个tlv结构包括类型（type），length，value。 其中如下的类型数值已经被标准化，应用应该遵循该type的含义，不应用作他途。&#xA;#define PP2_TYPE_ALPN 0x01 #define PP2_TYPE_AUTHORITY 0x02 #define PP2_TYPE_CRC32C 0x03 #define PP2_TYPE_NOOP 0x04 #define PP2_TYPE_UNIQUE_ID 0x05 #define PP2_TYPE_SSL 0x20 #define PP2_SUBTYPE_SSL_VERSION 0x21 #define PP2_SUBTYPE_SSL_CN 0x22 #define PP2_SUBTYPE_SSL_CIPHER 0x23 #define PP2_SUBTYPE_SSL_SIG_ALG 0x24 #define PP2_SUBTYPE_SSL_KEY_ALG 0x25 #define PP2_TYPE_NETNS 0x30 常见应用：</description>
    </item>
    <item>
      <title>国密http3代理</title>
      <link>https://docs.njet.org.cn/docs/v4.0.1/reference/protocol/http3proxy/index.html</link>
      <pubDate>Tue, 19 Aug 2025 10:57:10 +0800</pubDate>
      <guid>https://docs.njet.org.cn/docs/v4.0.1/reference/protocol/http3proxy/index.html</guid>
      <description>1. 功能描述 NJet现已支持HTTP2和HTTP3代理功能，以及使用HTTP3代理时，支持使用国密双证书。&#xA;原国密server以及proxy配置请参考国密支持。&#xA;2. 指令说明 2.1 proxy_http_version Syntax: proxy_http_version 2/3 Default: — Context: http,server,location 例如： proxy_http_version 2; 代理到后端server选择http2协议&#xA;proxy_http_version 3; 代理到后端server选择http3协议 2.2 proxy_ssl_conf_command Syntax: proxy_ssl_conf_command 配置指定的密码套件 Default: — Context: http,server,location 例如：proxy_ssl_conf_command Ciphersuites TLS_SM2ECDH_SM4_GCM_SM3;&#xA;当后端server使用国密双证书时，配置该指令，指定国密算法套件。&#xA;3. 配置样例 njet.conf&#xA;helper broker /etc/njet/modules/njt_helper_broker_module.so conf/mqtt.conf; helper ctrl /etc/njet/modules/njt_helper_ctrl_module.so conf/ctrl.conf; load_module /etc/njet/modules/njt_http_location_module.so; load_module /etc/njet/modules/njt_http_dyn_server_module.so; user root root; worker_processes 2; cluster_name helper; node_name node1; error_log logs/error.log info; pid logs/njet.pid; events { worker_connections 1024; } http { dyn_kv_conf conf/iot-work.conf; include mime.types; default_type application/octet-stream; access_log logs/access.log; sendfile on; keepalive_timeout 65; upstream backend1 { zone backend1 128k; server 127.0.0.1:5431; } upstream backend2 { zone backend2 128k; server 127.0.0.1:5432; } upstream backend3 { zone backend3 128k; server 127.0.0.1:5433; } server { listen 5454; server_name localhost; location / { proxy_http_version 3; proxy_pass https://backend1; } location /proxy_http3 { proxy_ssl_certificate certs/ca/RSA/rsa.client.cer.pem; proxy_ssl_certificate_key certs/ca/RSA/rsa.client.key.pem; proxy_http_version 3; proxy_pass https://backend1; } location /proxy_http2 { proxy_ssl_certificate certs/ca/RSA/rsa.client.cer.pem; proxy_ssl_certificate_key certs/ca/RSA/rsa.client.key.pem; proxy_http_version 2; proxy_pass https://backend2; } location /proxy_ntls { proxy_ssl_ntls on; proxy_ssl_conf_command Ciphersuites TLS_SM2ECDH_SM4_GCM_SM3; proxy_http_version 3; proxy_pass https://backend3; proxy_ssl_certificate certs/ca/NTLS/client_sign.crt certs/ca/NTLS/client_enc.crt; proxy_ssl_certificate_key certs/ca/NTLS/client_sign.key certs/ca/NTLS/client_enc.key; } } server { listen 5431 quic reuseport sndbuf=65535 rcvbuf=65535; listen 5431 ssl; server_name test.server.com; ssl_certificate certs/ca/RSA/rsa.server.cer.pem; ssl_certificate_key certs/ca/RSA/rsa.server.key.pem; ssl_verify_client on; ssl_verify_depth 10; ssl_client_certificate certs/ca/RSA/rootca.cer; ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; ssl_session_cache shared:SSL:1m; ssl_session_timeout 5m; ssl_prefer_server_ciphers on; location / { charset utf-8; default_type text/html; return 200 &#34;5431 test http3 ok&#34;; } } server { listen 5432 ssl; ssl_verify_client on; ssl_verify_depth 10; ssl_client_certificate certs/ca/RSA/rootca.cer; http2 on; ssl_protocols TLSv1.2 TLSv1.3; ssl_certificate certs/ca/RSA/rsa.server.cer.pem; ssl_certificate_key certs/ca/RSA/rsa.server.key.pem; location / { return 200 &#34;5432 test http2 ok&#34;; } } server { listen 5433 quic reuseport sndbuf=65535 rcvbuf=65535; listen 5433 ssl; ssl_verify_client on; ssl_verify_depth 10; ssl_client_certificate certs/ca/NTLS/ca.crt; ssl_ntls on; http3 on; keepalive_requests 20000; keepalive_time 120; http3_max_concurrent_streams 1024; http3_stream_buffer_size 1024k; quic_gso on; ssl_protocols TLSv1.3; ssl_certificate certs/ca/NTLS/server_sign.crt certs/ca/NTLS/server_enc.crt; ssl_certificate_key certs/ca/NTLS/server_sign.key certs/ca/NTLS/server_enc.key; location / { return 200 &#34;5433 test ntls http3 ok&#34;; } } } 4. 调用样例 4.1 代理使用HTTP2协议，后端开启HTTP2协议 发送</description>
    </item>
  </channel>
</rss>