Ben 1 年之前
父节点
当前提交
72f6df185c
共有 1 个文件被更改,包括 14 次插入26 次删除
  1. 14 26
      cmd/slave.go

+ 14 - 26
cmd/slave.go

@@ -4,7 +4,6 @@ import (
 	"be-vpn/internal/dto"
 	"bytes"
 	"encoding/json"
-	"github.com/gin-gonic/gin"
 	"github.com/tidwall/gjson"
 	"io"
 	"log"
@@ -42,31 +41,20 @@ func main() {
 		log.Printf("err: %+v", err)
 	}
 
-	go func() {
-		for true {
-			// send request
-			reader := bytes.NewBuffer(body)
-			resp, err := http.Post("http://v.starttransfernow.com/register", "application/json", reader)
-			if err != nil {
-				log.Printf("err: %+v", err)
-				continue
-			}
-			respBody, err := io.ReadAll(resp.Body)
-			if err != nil {
-				log.Printf("err: %+v", err)
-			}
-			log.Printf("resp: %s", string(respBody))
-			time.Sleep(3 * time.Second)
+	for true {
+		// send request
+		reader := bytes.NewBuffer(body)
+		resp, err := http.Post("http://v.starttransfernow.com/register", "application/json", reader)
+		if err != nil {
+			log.Printf("err: %+v", err)
+			continue
 		}
-	}()
-
-	r := gin.Default()
-	r.Use(gin.Recovery())
-	r.GET("/health", func(c *gin.Context) {
-		c.JSON(200, gin.H{"status": "1"})
-	})
-
-	if err := r.Run(":80"); err != nil {
-		log.Fatalf("err: %+v", err)
+		respBody, err := io.ReadAll(resp.Body)
+		if err != nil {
+			log.Printf("err: %+v", err)
+		}
+		log.Printf("resp: %s", string(respBody))
+		time.Sleep(3 * time.Second)
 	}
+
 }