最新版本1
This commit is contained in:
1 parent
cd35d403df
commit
ff9315ba63
5 files changed
+34
-66
No files matched your search
@@ -28,7 +28,7 @@ func SetupCert() {
|
||||
|
||||
//获取证书路径
|
||||
dir, _ := os.Getwd()
|
||||
certPath := dir+"/piserver_root.crt" // 替换为您的证书路径
|
||||
certPath := dir+"/rootCA.crt" // 替换为您的证书路径
|
||||
|
||||
if CheckCertIsInstalled() == "yes"{
|
||||
return
|
||||
@@ -119,7 +119,7 @@ func printCertificateInfo(pCertContext uintptr) string {
|
||||
size, _, _ := procCertGetNameString.Call(pCertContext, 5, 0, 0, uintptr(unsafe.Pointer(&buffer)), 200)
|
||||
issuer := syscall.UTF16ToString(buffer[:size])
|
||||
fmt.Println("Certificate Issuer:", issuer)
|
||||
if issuer == "mkcert pi@pi-laptop"{
|
||||
if issuer == "SX"{
|
||||
return "yes"
|
||||
}
|
||||
return "no"
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"time"
|
||||
"syscall"
|
||||
"time"
|
||||
)
|
||||
|
||||
// 执行exe 文件,开启视频监控的服务进程
|
||||
@@ -18,7 +18,8 @@ func RunPiServerExe() {
|
||||
//执行exe的路径
|
||||
exePath := dir + "/piVideo/piVideo.exe"
|
||||
fmt.Println("piVide 可执行路径:", exePath)
|
||||
killPiServerExe()
|
||||
killPiServerExe("piVideo.exe") //杀 piVideo 进程
|
||||
killPiServerExe("RTSPtoWeb.exe") //杀 RRTSPtoWeb 进程
|
||||
time.Sleep(3 * time.Second)
|
||||
cmd := exec.Command(exePath) // 替换为您的可执行文件路径
|
||||
// os.Chdir("piVideo")
|
||||
@@ -29,10 +30,11 @@ func RunPiServerExe() {
|
||||
fmt.Println("执行成功", string(output))
|
||||
}
|
||||
}
|
||||
|
||||
func killPiServerExe() {
|
||||
func killPiServerExe(exeName string) {
|
||||
// 定义要关闭的程序的名称(或路径)
|
||||
exeName := "piVideo.exe"
|
||||
if exeName == "" {
|
||||
exeName = "piVideo.exe"
|
||||
}
|
||||
// 使用exec.Command函数创建一个Cmd结构体,用于执行命令
|
||||
cmd := exec.Command("taskkill", "/f", "/im", exeName)
|
||||
cmd.SysProcAttr = &syscall.SysProcAttr{HideWindow:true}
|
||||
|
||||
Reference in new issue
Block a user