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 -}