NPS方便调试,比如调试微信api的开发
下载地址:https://github.com/ehang-io/nps/releases

先安装服务端,注意nps服务端启动会占用80,8080,8024端口,所以我用nginx代理通过域名访问
# tar xzvf linux_amd64_server.tar.gz
# ./nps install
# nps start
参考配置
appname = nps
#Boot mode(dev|pro)
runmode = dev
#HTTP(S) proxy port, no startup if empty
http_proxy_ip=0.0.0.0
http_proxy_port=70
https_proxy_port=7443
https_just_proxy=true
#default https certificate setting
https_default_cert_file=conf/server.pem
https_default_key_file=conf/server.key
##bridge
bridge_type=tcp
bridge_port=8024
bridge_ip=0.0.0.0
# Public password, which clients can use to connect to the server
# After the connection, the server will be able to open relevant ports and parse related domain names according to its own configuration file.
public_vkey=123
#Traffic data persistence interval(minute)
#Ignorance means no persistence
#flow_store_interval=1
# log level LevelEmergency->0 LevelAlert->1 LevelCritical->2 LevelError->3 LevelWarning->4 LevelNotice->5 LevelInformational->6 LevelDebug->7
log_level=7
#log_path=nps.log
#Whether to restrict IP access, true or false or ignore
#ip_limit=true
#p2p
#p2p_ip=127.0.0.1
#p2p_port=6000
#web
web_host=a.o.com
web_username=admin #访问的账号
web_password=123456 #访问的密码
web_port = 8080
web_ip=0.0.0.0
web_base_url=
web_open_ssl=false
web_cert_file=conf/server.pem
web_key_file=conf/server.key
# if web under proxy use sub path. like http://host/nps need this.
#web_base_url=/nps
#Web API unauthenticated IP address(the len of auth_crypt_key must be 16)
#Remove comments if needed
#auth_key=test
auth_crypt_key =1234567812345678
#allow_ports=9001-9009,10001,11000-12000
#Web management multi-user login
allow_user_login=false
allow_user_register=false
allow_user_change_username=false
#extension
allow_flow_limit=false
allow_rate_limit=false
allow_tunnel_num_limit=false
allow_local_proxy=false
allow_connection_num_limit=false
allow_multi_ip=false
system_info_display=false
#cache
http_cache=false
http_cache_length=100
#get origin ip
http_add_origin_header=false
#pprof debug options
#pprof_ip=0.0.0.0
#pprof_port=9999
#client disconnect timeout
disconnect_timeout=60
查看版本
[root@iZ94l4vzimfZ ]# nps --version
Version: 0.26.8
Core version: 0.26.0
Same core version of client and server can connect each other
启动后,可访问http://服务器ip:8080/index/

登录成功后,这个客户端连接端口很重要,记得开启防火墙放行这个端口,端口可以自行修改

新增客户端


配置主机

安装客户端,如果是windows的直接解压 双击npc.exe
客户端的配置
[common]
server_addr=服务器ip:8024 #服务器ip和端口,记得防火墙放行
conn_type=tcp
vkey=q5d8z7nb #需要和服务器端添加客户端的的验证密钥一致
auto_reconnection=true
max_conn=1000
flow_limit=1000
rate_limit=1000
crypt=true
compress=true
disconnect_timeout=60
配置域名指向到你的服务器,然后这里添加主机和目标ip端口即可,客户端一旦启动就会在线状态,需要注意的是 你内网的ip和端口不能错,不然访问不了
客户端启动后出现以下信息,表示启动成功,这样你就可以进行域名调试本地服务了

本文介绍了如何使用NPS工具进行微信API的调试。首先,下载并安装NPS服务端,注意启动时可能占用80、8080和8024端口。然后配置NPS,包括HTTP(S)代理、桥接设置、公共验证密钥等。启动NPS后,通过8080端口访问管理页面。客户端配置包括服务器地址、连接类型、验证密钥等。确保开启防火墙允许相关端口。完成设置后,客户端连接成功,即可通过域名调试本地服务。

3296

被折叠的 条评论
为什么被折叠?



