修复权限失效放行并加固证书推送事务和超时回滚

This commit is contained in:
xuans committed 2026-09-15 20:00:38 +08:00
1 parent d74f74b631
commit 05e05a1a23
15 files changed
+861 -178

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
package deployment
import "sync"
const commandOutputLimit = 64 << 10
// commandOutput 限制远程标准输出和错误输出占用,防止异常命令耗尽管理端内存。
type commandOutput struct {
mu sync.Mutex
data []byte
}
func (b *commandOutput) Write(data []byte) (int, error) {
b.mu.Lock()
defer b.mu.Unlock()
remaining := commandOutputLimit - len(b.data)
if remaining > len(data) {
remaining = len(data)
}
b.data = append(b.data, data[:remaining]...)
return len(data), nil
}
func (b *commandOutput) Bytes() []byte {
b.mu.Lock()
defer b.mu.Unlock()
return append([]byte(nil), b.data...)
}