Move localhost check to utils
This commit is contained in:
parent
6d10be8fff
commit
68dab0fe7b
2 changed files with 8 additions and 8 deletions
8
app.go
8
app.go
|
@ -221,14 +221,6 @@ func (h *Headscale) watchForKVUpdatesWorker() {
|
||||||
// more functions will come here in the future
|
// more functions will come here in the future
|
||||||
}
|
}
|
||||||
|
|
||||||
func IsLocalhost(host string) bool {
|
|
||||||
if strings.Contains(host, LOCALHOST_V4) || strings.Contains(host, LOCALHOST_V6) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func (h *Headscale) grpcAuthenticationInterceptor(ctx context.Context,
|
func (h *Headscale) grpcAuthenticationInterceptor(ctx context.Context,
|
||||||
req interface{},
|
req interface{},
|
||||||
info *grpc.UnaryServerInfo,
|
info *grpc.UnaryServerInfo,
|
||||||
|
|
8
utils.go
8
utils.go
|
@ -156,3 +156,11 @@ func tailNodesToString(nodes []*tailcfg.Node) string {
|
||||||
func tailMapResponseToString(resp tailcfg.MapResponse) string {
|
func tailMapResponseToString(resp tailcfg.MapResponse) string {
|
||||||
return fmt.Sprintf("{ Node: %s, Peers: %s }", resp.Node.Name, tailNodesToString(resp.Peers))
|
return fmt.Sprintf("{ Node: %s, Peers: %s }", resp.Node.Name, tailNodesToString(resp.Peers))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func IsLocalhost(host string) bool {
|
||||||
|
if strings.Contains(host, LOCALHOST_V4) || strings.Contains(host, LOCALHOST_V6) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue