mirror of
https://github.com/lwch/natpass.git
synced 2024-04-21 12:41:54 +00:00
拆分配置文件
This commit is contained in:
+10
-3
@@ -88,9 +88,16 @@ func build(t target) {
|
||||
os.RemoveAll(buildDir)
|
||||
runtime.Assert(os.MkdirAll(buildDir, 0755))
|
||||
|
||||
err := copyFile(path.Join("conf", "client.yaml"), path.Join(buildDir, "client.yaml"))
|
||||
runtime.Assert(err)
|
||||
err = copyFile(path.Join("conf", "server.yaml"), path.Join(buildDir, "server.yaml"))
|
||||
err := filepath.Walk("conf", func(path string, info fs.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
path = strings.TrimPrefix(path, "conf")
|
||||
if info.IsDir() {
|
||||
return os.MkdirAll(filepath.Join(buildDir, path), 0755)
|
||||
}
|
||||
return copyFile("conf"+path, filepath.Join(buildDir, path))
|
||||
})
|
||||
runtime.Assert(err)
|
||||
err = copyFile("CHANGELOG.md", path.Join(buildDir, "CHANGELOG.md"))
|
||||
runtime.Assert(err)
|
||||
|
||||
+4
-27
@@ -1,29 +1,6 @@
|
||||
id: this # 客户端ID
|
||||
server: 127.0.0.1:6154 # 服务器地址
|
||||
secret: 0123456789 # 预共享密钥,必须与server端相同,否则握手失败
|
||||
link:
|
||||
connections: 3 # 与server的连接数
|
||||
read_timeout: 1s # 读取数据包超时时间
|
||||
write_timeout: 1s # 发送数据包超时时间
|
||||
log:
|
||||
dir: ./logs # 路径
|
||||
size: 50M # 单个文件大小
|
||||
rotate: 7 # 保留数量
|
||||
tunnel: # 远端tunnel列表可为空
|
||||
- name: rdp # 链路名称
|
||||
target: that # 目标客户端ID
|
||||
type: tcp # 连接类型tcp或udp
|
||||
local_addr: 0.0.0.0 # 本地监听地址
|
||||
local_port: 3389 # 本地监听端口号
|
||||
remote_addr: 127.0.0.1 # 目标客户端连接地址
|
||||
remote_port: 3389 # 目标客户端连接端口号
|
||||
- name: shell # 链路名称
|
||||
target: that # 目标客户端ID
|
||||
type: shell # web shell
|
||||
local_addr: 0.0.0.0 # 本地监听地址
|
||||
local_port: 8080 # 本地监听端口号
|
||||
#exec: /bin/bash # 运行命令
|
||||
# windows默认powershell或cmd
|
||||
# 其他系统bash或sh
|
||||
env: # 环境变量设置
|
||||
- TERM=xterm
|
||||
#include conf.d/connection.yaml
|
||||
#include conf.d/log.yaml
|
||||
tunnel: # tunnel列表
|
||||
#include tunnel.d/*.yaml
|
||||
@@ -0,0 +1,5 @@
|
||||
secret: 0123456789 # 预共享密钥,否则握手失败
|
||||
link:
|
||||
connections: 3 # 连接数,仅client有效
|
||||
read_timeout: 1s # 读取数据包超时时间
|
||||
write_timeout: 1s # 发送数据包超时时间
|
||||
@@ -0,0 +1,4 @@
|
||||
log:
|
||||
dir: ./logs # 路径
|
||||
size: 50M # 单个文件大小
|
||||
rotate: 7 # 保留数量
|
||||
+1
-9
@@ -1,12 +1,4 @@
|
||||
listen: 6154 # 监听端口号
|
||||
secret: 0123456789 # 预共享密钥
|
||||
link:
|
||||
read_timeout: 5s # 读取数据包超时时间
|
||||
write_timeout: 5s # 发送数据包超时时间
|
||||
log:
|
||||
dir: ./logs # 路径
|
||||
size: 50M # 单个文件大小
|
||||
rotate: 7 # 保留数量
|
||||
listen: 6154 # 监听端口号
|
||||
tls:
|
||||
key: /dir/to/tls/key/file # tls密钥
|
||||
crt: /dir/to/tls/crt/file # tls证书
|
||||
@@ -0,0 +1,10 @@
|
||||
- name: shell # 链路名称
|
||||
target: that # 目标客户端ID
|
||||
type: shell # web shell
|
||||
local_addr: 0.0.0.0 # 本地监听地址
|
||||
local_port: 8080 # 本地监听端口号
|
||||
#exec: /bin/bash # 运行命令
|
||||
# windows默认powershell或cmd
|
||||
# 其他系统bash或sh
|
||||
env: # 环境变量设置
|
||||
- TERM=xterm
|
||||
@@ -0,0 +1,7 @@
|
||||
- name: rdp # 链路名称
|
||||
target: that # 目标客户端ID
|
||||
type: tcp # 连接类型tcp或udp
|
||||
local_addr: 0.0.0.0 # 本地监听地址
|
||||
local_port: 3389 # 本地监听端口号
|
||||
remote_addr: 127.0.0.1 # 目标客户端连接地址
|
||||
remote_port: 3389 # 目标客户端连接端口号
|
||||
Reference in New Issue
Block a user