mirror of
https://github.com/khairul169/vaulterm.git
synced 2025-04-29 00:59:40 +07:00
20 lines
344 B
Go
20 lines
344 B
Go
package ws
|
|
|
|
import (
|
|
"github.com/gofiber/contrib/websocket"
|
|
"github.com/gofiber/fiber/v2"
|
|
)
|
|
|
|
func Router(app *fiber.App) {
|
|
router := app.Group("/ws")
|
|
|
|
router.Use(func(c *fiber.Ctx) error {
|
|
if websocket.IsWebSocketUpgrade(c) {
|
|
return c.Next()
|
|
}
|
|
return fiber.ErrUpgradeRequired
|
|
})
|
|
|
|
router.Get("/term", websocket.New(HandleTerm))
|
|
}
|