mirror of
https://github.com/juanfont/headscale.git
synced 2026-09-16 05:22:04 +09:00
util: remove dead helpers and stale comments
This commit is contained in:
@@ -3,10 +3,7 @@ package util
|
||||
import (
|
||||
"crypto/rand"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"tailscale.com/tailcfg"
|
||||
)
|
||||
|
||||
// GenerateRandomBytes returns securely generated random bytes.
|
||||
@@ -79,40 +76,3 @@ func MustGenerateRandomStringDNSSafe(size int) string {
|
||||
|
||||
return hash
|
||||
}
|
||||
|
||||
func TailNodesToString(nodes []*tailcfg.Node) string {
|
||||
temp := make([]string, len(nodes))
|
||||
|
||||
for index, node := range nodes {
|
||||
temp[index] = node.Name
|
||||
}
|
||||
|
||||
return fmt.Sprintf("[ %s ](%d)", strings.Join(temp, ", "), len(temp))
|
||||
}
|
||||
|
||||
func TailMapResponseToString(resp tailcfg.MapResponse) string {
|
||||
return fmt.Sprintf(
|
||||
"{ Node: %s, Peers: %s }",
|
||||
resp.Node.Name,
|
||||
TailNodesToString(resp.Peers),
|
||||
)
|
||||
}
|
||||
|
||||
func TailcfgFilterRulesToString(rules []tailcfg.FilterRule) string {
|
||||
var sb strings.Builder
|
||||
|
||||
for index, rule := range rules {
|
||||
fmt.Fprintf(&sb, `
|
||||
{
|
||||
SrcIPs: %v
|
||||
DstIPs: %v
|
||||
}
|
||||
`, rule.SrcIPs, rule.DstPorts)
|
||||
|
||||
if index < len(rules)-1 {
|
||||
sb.WriteString(", ")
|
||||
}
|
||||
}
|
||||
|
||||
return fmt.Sprintf("[ %s ](%d)", sb.String(), len(rules))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user