Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Modifying rootca path
  • Loading branch information
Evan Langlais committed Apr 9, 2019
1 parent cf2dd11 commit 3c7aa50
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions socketManager.go
Expand Up @@ -45,11 +45,11 @@ func (c *_client) connect() {
c.connLock.Lock() // Shouldn't matter because the other processes will be waiting, but I'm gonna do it anyways
defer c.connLock.Unlock()

rootCAs := x509.NewCertPool() // Initialize a cert pool
rootCert, _ := ioutil.ReadFile("rootCA.pem") // Read our root CA cert
rootCAs.AppendCertsFromPEM(rootCert) // Add it to the pool
rootCAs := x509.NewCertPool() // Initialize a cert pool
rootCert, _ := ioutil.ReadFile("./rootCA.pem") // Read our root CA cert
rootCAs.AppendCertsFromPEM(rootCert) // Add it to the pool

config := &tls.Config{RootCAs: rootCAs,} // Trust our root CA
config := &tls.Config{RootCAs: rootCAs} // Trust our root CA

dialer := websocket.Dialer{ // Create a websocket dialer with our tls config
TLSClientConfig: config,
Expand Down Expand Up @@ -117,7 +117,7 @@ func (c *_client) sendData() {
p := Packet{nextId(), kindData, byteMsg} // Wrap it into a packet
fmt.Printf("Sending packet %v\n", p.ID)

c.connLock.Lock() // Lock to send
c.connLock.Lock() // Lock to send
if err := c.conn.WriteJSON(p); err != nil { // Try to send
fmt.Printf("Error sending %v packet %v: %v\n", p.Kind, p.ID, err) // If we fail, try to reconnect
c.wait.Add(1) // Prevent client things from happening
Expand All @@ -138,7 +138,7 @@ func (c *_client) readIncoming() { // Read messages from gateway
go c.connect() // Reconnect
} else {
switch packet.Kind {
case kindResponse: // Got a response
case kindResponse: // Got a response
go responseManager.received(packet) // Tell the response map
default:
fmt.Printf("Got unknown packet type: %v\n", packet.Kind)
Expand Down

0 comments on commit 3c7aa50

Please sign in to comment.