Готовая реализация handshake

This commit is contained in:
set
2026-03-10 15:49:29 +02:00
parent 1f706385f8
commit c9aade2be3
4 changed files with 65 additions and 4 deletions

View File

@@ -1,16 +1,25 @@
package main
import (
"g365sfu/logger"
"g365sfu/socket"
"net/http"
"os"
"github.com/joho/godotenv"
)
func main() {
godotenv.Load()
if os.Getenv("SECRET") == "" {
logger.LogErrorMessage("server failed to start because not set secret key in .env variables")
return
}
http.HandleFunc("/", socket.HandleWebSocket)
port := os.Getenv("PORT")
if port == "" {
port = "1001"
}
logger.LogInfoMessage("server started at x.x.x.x:" + port)
http.ListenAndServe(":"+port, nil)
}