From 4a60c94000b0c131db6f6897fc9ee22c9fd75d52 Mon Sep 17 00:00:00 2001 From: mmarcel Date: Wed, 4 May 2022 16:58:56 +0100 Subject: [PATCH] =?UTF-8?q?=E2=80=9Eclient.go=E2=80=9C=20l=C3=B6schen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client.go | 53 ----------------------------------------------------- 1 file changed, 53 deletions(-) delete mode 100644 client.go diff --git a/client.go b/client.go deleted file mode 100644 index d5b2e43..0000000 --- a/client.go +++ /dev/null @@ -1,53 +0,0 @@ -package proxy - -import ( - "crypto/tls" - "fmt" - "net/url" - "time" - - "github.com/gorilla/websocket" -) - -var connection *websocket.Conn - -// proxy-client -func Start_client(v string, w string) { - var err error - - for { - - u := url.URL{Scheme: "wss", Host: v, Path: "/ws/" + w} - - dialer := websocket.DefaultDialer - dialer.TLSClientConfig = &tls.Config{ - InsecureSkipVerify: true, - } - - fmt.Println("Connect to node", v, "using wallet address", w) - connection, _, err = websocket.DefaultDialer.Dial(u.String(), nil) - if err != nil { - time.Sleep(5 * time.Second) - fmt.Println(err) - continue - } - - for { - msg_type, recv_data, err := connection.ReadMessage() - if msg_type != websocket.TextMessage || err != nil { - break - } else { - fmt.Println(string(recv_data)) - //edit_blob(recv_data) - go SendTemplatesToNode(recv_data) - } - } - - } -} - -func SendToDaemon(buffer []byte) { - connection.SetWriteDeadline(time.Now().Add(100 * time.Millisecond)) - connection.WriteMessage(websocket.TextMessage, buffer) - return -}