使用winsw实现。
下载地址:winsw
服务安装命令:.\winsw.exe install
服务卸载命令:.\winsw.exe uninstall
目录见下:
xml配置文件:
<service>
<id>tunnel</id>
<name>tunnel</name>
<description>tunnel</description>
<workingdirectory>%BASE%\</workingdirectory>
<executable>tunnel.exe</executable>
<startargument>-c</startargument>
<startargument>tunnel.ini</startargument>
<onfailure action="restart" delay="10 sec"/>
<log mode="roll-by-size">
<sizeThreshold>60</sizeThreshold>
<keepFiles>8</keepFiles>
</log>
<logpath>.\logs</logpath>
<logmode>roll</logmode>
</service>
tunnel.ini中的配置:
[common]
server_addr = www.abc.cn
server_port = 500
token = fewfewfewa
tls_enable = true
tls_cert_file =ssl/client.crt
tls_key_file =ssl/client.key
tls_trusted_ca_file = ssl/ca.crt
[stcp_001_rdp]
type = stcp
sk = BA081ADAF
local_ip = 127.0.0.1
local_port = 3389