mirror of
				https://github.com/TeaOSLab/EdgeAPI.git
				synced 2025-11-04 07:50:25 +08:00 
			
		
		
		
	改进细节
This commit is contained in:
		@@ -3,8 +3,9 @@ package main
 | 
			
		||||
import (
 | 
			
		||||
	"flag"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAPI/internal/utils"
 | 
			
		||||
	"net"
 | 
			
		||||
	"github.com/iwind/gosock/pkg/gosock"
 | 
			
		||||
	"os"
 | 
			
		||||
	"os/exec"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func main() {
 | 
			
		||||
@@ -24,11 +25,21 @@ func main() {
 | 
			
		||||
		stderr("need '-cmd=COMMAND' argument")
 | 
			
		||||
	} else if cmd == "test" {
 | 
			
		||||
		// 检查是否正在运行
 | 
			
		||||
		path := os.TempDir() + "/edge-dns.sock"
 | 
			
		||||
		conn, err := net.Dial("unix", path)
 | 
			
		||||
		if err == nil {
 | 
			
		||||
			_ = conn.Close()
 | 
			
		||||
			stderr("test dns node status: edge dns node is running now, can not install again")
 | 
			
		||||
		var sock = gosock.NewTmpSock("edge-dns")
 | 
			
		||||
		if sock.IsListening() {
 | 
			
		||||
			// 从systemd中停止
 | 
			
		||||
			systemctl, _ := exec.LookPath("systemctl")
 | 
			
		||||
			if len(systemctl) > 0 {
 | 
			
		||||
				systemctlCmd := exec.Command(systemctl, "stop", "edge-dns")
 | 
			
		||||
				_ = systemctlCmd.Run()
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			// 从进程中停止
 | 
			
		||||
			if sock.IsListening() {
 | 
			
		||||
				_, _ = sock.Send(&gosock.Command{
 | 
			
		||||
					Code: "stop",
 | 
			
		||||
				})
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	} else if cmd == "unzip" { // 解压
 | 
			
		||||
		if len(zipPath) == 0 {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
package teaconst
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	Version = "0.2.8.2"
 | 
			
		||||
	Version = "0.2.9"
 | 
			
		||||
 | 
			
		||||
	ProductName   = "Edge API"
 | 
			
		||||
	ProcessName   = "edge-api"
 | 
			
		||||
 
 | 
			
		||||
@@ -90,7 +90,7 @@ func (this *HTTPAccessLogDAO) CreateHTTPAccessLogsWithDAO(tx *dbs.Tx, daoWrapper
 | 
			
		||||
 | 
			
		||||
		// TODO 根据集群、服务设置获取IP
 | 
			
		||||
		if tableDef.HasRemoteAddr {
 | 
			
		||||
			fields["remoteAddr"] = accessLog.RawRemoteAddr
 | 
			
		||||
			fields["remoteAddr"] = accessLog.RemoteAddr
 | 
			
		||||
		}
 | 
			
		||||
		if tableDef.HasDomain {
 | 
			
		||||
			fields["domain"] = accessLog.Host
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user