mirror of https://github.com/qwqdanchun/nps.git
add sdk md
This commit is contained in:
parent
eab5708b33
commit
899d1e9e2e
|
@ -12,6 +12,7 @@
|
|||
|
||||
* [基本使用](use.md)
|
||||
* [增强功能](npc_extend.md)
|
||||
* [sdk](npc_sdk.md)
|
||||
|
||||
* 扩展
|
||||
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
# npc sdk文档
|
||||
|
||||
```
|
||||
命令行模式启动客户端
|
||||
p0->连接地址
|
||||
p1->vkey
|
||||
p2->连接类型(tcp or udp)
|
||||
p3->连接代理
|
||||
|
||||
extern GoInt StartClientByVerifyKey(char* p0, char* p1, char* p2, char* p3);
|
||||
|
||||
查看当前启动的客户端状态,在线为1,离线为0
|
||||
extern GoInt GetClientStatus();
|
||||
|
||||
关闭客户端
|
||||
extern void CloseClient();
|
||||
|
||||
获取当前客户端版本
|
||||
extern char* Version();
|
||||
|
||||
获取日志,实时更新
|
||||
extern char* Logs();
|
||||
```
|
|
@ -18,6 +18,8 @@
|
|||
- 停止:`npc.exe stop`
|
||||
- 如果需要更换命令内容需要先卸载`npc.exe -service=uninstall`,再重新注册
|
||||
|
||||
注册到服务后,日志文件windows位于当前目录下,linux和darwin位于/var/log/npc.log
|
||||
|
||||
## 客户端更新
|
||||
首先进入到对于的客户端二进制文件目录
|
||||
|
||||
|
|
50
update.sh
50
update.sh
|
@ -1,50 +0,0 @@
|
|||
#/bash/sh
|
||||
echo "start upgrading to the latest version"
|
||||
if [ $1 == "latest" ]
|
||||
then
|
||||
version=`wget -qO- -t1 -T2 "https://api.github.com/repos/cnlh/nps/releases/latest" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g'`
|
||||
else
|
||||
version=$1
|
||||
fi
|
||||
echo "the current latest version is "$version""
|
||||
download_base_url=https://github.com/cnlh/nps/releases/download/$version/
|
||||
|
||||
if [ $4 ]
|
||||
then
|
||||
filename=""$2"_"$3"_v"$4"_"server".tar.gz"
|
||||
else
|
||||
filename=""$2"_"$3"_"server".tar.gz"
|
||||
fi
|
||||
complete_download_url=""$download_base_url""$filename""
|
||||
echo "start download file from "$complete_download_url""
|
||||
|
||||
dir_name=`echo $RANDOM`
|
||||
mkdir $dir_name && cd $dir_name
|
||||
wget $complete_download_url >/dev/null 2>&1
|
||||
if [ ! -f "$filename" ]; then
|
||||
echo "download file failed!"
|
||||
rm -rf $dir_name
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "start extracting files"
|
||||
mkdir nps
|
||||
tar -xvf $filename -C ./nps >/dev/null 2>&1
|
||||
cd nps
|
||||
|
||||
if [ -f "../../nps" ]; then
|
||||
echo "replace "../../nps"!"
|
||||
cp -rf nps ../../
|
||||
fi
|
||||
|
||||
usr_dir=`which nps`
|
||||
|
||||
if [ -f "$usr_dir" ]; then
|
||||
echo "replace "$usr_dir"!"
|
||||
cp -rf nps $usr_dir
|
||||
fi
|
||||
|
||||
cd ../../ && rm -rf $dir_name
|
||||
|
||||
echo "update complete!"
|
||||
echo -e "\033[32m please restart nps \033[0m"
|
Loading…
Reference in New Issue