Skip to content

Instantly share code, notes, and snippets.

@taotetek
Created April 9, 2015 14:08
Show Gist options
  • Save taotetek/aaf4593963292459016a to your computer and use it in GitHub Desktop.
Save taotetek/aaf4593963292459016a to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
czmq "github.com/zeromq/goczmq"
)
func main() {
serverCert, _ := czmq.NewCertFromFile("/etc/curve.d/example_curve_server_cert")
serverKey := serverCert.PublicText()
client := czmq.NewSock(czmq.SUB)
defer client.Destroy()
clientCert, _ := czmq.NewCertFromFile("/etc/curve.d/example_curve_client_cert")
defer clientCert.Destroy()
clientCert.Apply(client)
client.SetCurveServerkey(serverKey)
client.SetSubscribe("")
client.Connect("tcp://127.0.0.1:24445")
for {
msg, _, _ := client.RecvFrame()
fmt.Printf("\n%s\n", string(msg))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment