initial: ZeroTier-like P2P mesh VPN server with multi-tenant Web UI

This commit is contained in:
xieyao
2026-06-17 03:50:23 +08:00
commit ee5f036325
74 changed files with 9517 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
package handler
import "github.com/gin-gonic/gin"
func userID(c *gin.Context) uint {
id, exists := c.Get("user_id")
if !exists {
return 0
}
uid, ok := id.(uint)
if !ok {
return 0
}
return uid
}
func isAdmin(c *gin.Context) bool {
role, exists := c.Get("role")
if !exists {
return false
}
return role.(string) == "admin"
}