Prechádzať zdrojové kódy

优化修改sshd代码模块结构

niujiuru 1 týždeň pred
rodič
commit
70a230721a

sshd/ssh_client.ini → sshd/ssh_client/config.ini


+ 23 - 0
sshd/ssh_client/main.go

@@ -0,0 +1,23 @@
+package main
+
+import (
+	"strings"
+	"time"
+)
+
+const (
+	fastTimeout = 10 * time.Second
+	slowTimeout = 10 * time.Minute
+)
+
+func GetCmdDefaultTimeout(cmd string) int { // 单位: 秒
+	switch {
+	case strings.HasPrefix(cmd, "curl"):
+		return int(slowTimeout.Seconds())
+	default:
+		return int(fastTimeout.Seconds())
+	}
+}
+
+func main() {
+}

+ 0 - 1
sshd/ssh_client_main.go

@@ -1 +0,0 @@
-package sshd

+ 1 - 1
utils/shell/execute.go

@@ -17,7 +17,7 @@ import (
 )
 
 const (
-	defaultTimeout    = 5 * time.Second
+	defaultTimeout    = 8 * time.Second
 	gracePeriod       = 2 * time.Second
 	forceKillWait     = 2 * time.Second
 	exitTimeoutCode   = 124