Refactor config and improve security

This commit is contained in:
Bolke de Bruin 2020-07-18 19:17:53 +02:00
parent 76e30ffa98
commit c68ec69b92
3 changed files with 17 additions and 9 deletions

7
rdg.go
View file

@ -225,7 +225,12 @@ func handleWebsocketProtocol(conn *websocket.Conn) {
log.Printf("Invalid PAA cookie: %s from %s", cookie, conn.RemoteAddr())
return
}
host = strings.Replace(conf.Server.HostTemplate, "%%", data.(string), 1)
host = conf.Server.HostTemplate
for k, v := range data.(map[string]interface{}) {
if val, ok := v.(string); ok == true {
host = strings.Replace(host, "{{ " + k + " }}", val, 1)
}
}
msg := createTunnelResponse()
log.Printf("Create tunnel response: %x", msg)
conn.WriteMessage(mt, msg)