mirror of
https://github.com/juanfont/headscale.git
synced 2025-11-24 17:20:48 +09:00
Added tests, solved some bugs, and code reorg
This commit is contained in:
20
api.go
20
api.go
@@ -9,7 +9,6 @@ import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/fatih/set"
|
||||
"github.com/rs/zerolog/log"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -415,22 +414,3 @@ func (h *Headscale) handleAuthKey(c *gin.Context, db *gorm.DB, idKey wgkey.Key,
|
||||
Str("ip", ip.String()).
|
||||
Msg("Successfully authenticated via AuthKey")
|
||||
}
|
||||
|
||||
func getMapResponseUserProfiles(m Machine, peers Machines) []tailcfg.UserProfile {
|
||||
namespaceSet := set.New(set.ThreadSafe)
|
||||
namespaceSet.Add(m.Namespace)
|
||||
for _, p := range peers {
|
||||
namespaceSet.Add(p.Namespace)
|
||||
}
|
||||
|
||||
profiles := []tailcfg.UserProfile{}
|
||||
for _, namespace := range namespaceSet.List() {
|
||||
profiles = append(profiles,
|
||||
tailcfg.UserProfile{
|
||||
ID: tailcfg.UserID(namespace.(Namespace).ID),
|
||||
LoginName: namespace.(Namespace).Name,
|
||||
DisplayName: namespace.(Namespace).Name,
|
||||
})
|
||||
}
|
||||
return profiles
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user