Skip to content

Commit 3037740

Browse files
committed
Merge pull request #54 from arduino/certificates
Delete the CA when requested
2 parents 814dba3 + 314ef07 commit 3037740

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

Diff for: certificates.go

+6
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,12 @@ func certHandler(c *gin.Context) {
229229
})
230230
}
231231

232+
func deleteCertHandler(c *gin.Context) {
233+
os.Remove("ca.cert.pem")
234+
os.Remove("ca.cert.cer")
235+
os.Remove("ca.key.pem")
236+
}
237+
232238
const noFirefoxTemplateHTML = `<!DOCTYPE html>
233239
<html>
234240
<head>

Diff for: conn.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
package main
44

55
import (
6+
"net/http"
7+
"strconv"
8+
69
log "github.com/Sirupsen/logrus"
710
"github.com/gin-gonic/gin"
811
"github.com/googollee/go-socket.io"
9-
"net/http"
10-
"strconv"
1112
)
1213

1314
type connection struct {
@@ -101,6 +102,7 @@ func wsHandler() *WsServer {
101102
so.On("command", func(message string) {
102103
h.broadcast <- []byte(message)
103104
})
105+
104106
so.On("disconnection", func() {
105107
h.unregister <- c
106108
})

Diff for: main.go

+1
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ func main() {
235235

236236
r.GET("/", homeHandler)
237237
r.GET("/certificate.crt", certHandler)
238+
r.DELETE("/certificate.crt", deleteCertHandler)
238239
r.POST("/upload", uploadHandler)
239240
r.GET("/socket.io/", socketHandler)
240241
r.POST("/socket.io/", socketHandler)

0 commit comments

Comments
 (0)