|
@@ -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)
|
|
|
}
|
|
|
+
|
|
|
}
|