From 9ad429d7030a3b07286fdc63f62181783149f494 Mon Sep 17 00:00:00 2001
From: Ruben Pollan <meskio@sindominio.net>
Date: Sat, 26 May 2018 13:51:45 +0200
Subject: [PATCH] [pkg] windows doesn't have curve

Let's have our own hasCurve() func to don't use curve if is windows.
---
 bitmask/darwin.go  | 10 +++++++++-
 bitmask/events.go  |  2 +-
 bitmask/unix.go    | 10 +++++++++-
 bitmask/windows.go |  4 ++++
 4 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/bitmask/darwin.go b/bitmask/darwin.go
index 32a9b079..f4250780 100644
--- a/bitmask/darwin.go
+++ b/bitmask/darwin.go
@@ -16,8 +16,16 @@
 
 package bitmask
 
-import "os"
+import (
+	"os"
+
+	"github.com/pebbe/zmq4"
+)
 
 const coreEndpoint = "ipc:///var/tmp/bitmask.core.sock"
 
 var ConfigPath = os.Getenv("HOME") + "/Library/Preferences/leap"
+
+func hasCurve() bool {
+	return zmq4.HasCurve()
+}
diff --git a/bitmask/events.go b/bitmask/events.go
index 3fbdc438..f8b3725c 100644
--- a/bitmask/events.go
+++ b/bitmask/events.go
@@ -35,7 +35,7 @@ func initEvents() (*zmq4.Socket, error) {
 		return nil, err
 	}
 
-	if zmq4.HasCurve() {
+	if hasCurve() {
 		err = initCurve(socket)
 		if err != nil {
 			return nil, err
diff --git a/bitmask/unix.go b/bitmask/unix.go
index a9768571..321f1c0b 100644
--- a/bitmask/unix.go
+++ b/bitmask/unix.go
@@ -16,8 +16,16 @@
 
 package bitmask
 
-import "os"
+import (
+	"os"
+
+	"github.com/pebbe/zmq4"
+)
 
 const coreEndpoint = "ipc:///var/tmp/bitmask.core.sock"
 
 var ConfigPath = os.Getenv("HOME") + "/.config/leap"
+
+func hasCurve() bool {
+	return zmq4.HasCurve()
+}
diff --git a/bitmask/windows.go b/bitmask/windows.go
index b3d41aa4..18024057 100644
--- a/bitmask/windows.go
+++ b/bitmask/windows.go
@@ -21,3 +21,7 @@ import "os"
 const coreEndpoint = "tcp://127.0.0.1:5001"
 
 var ConfigPath = os.Getenv("APPDATA") + "\\leap"
+
+func hasCurve() bool {
+	return false
+}
-- 
GitLab