mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-25 02:55:29 +00:00
Convert acls.go
This commit is contained in:
parent
0bb2fabc6c
commit
42bf566fff
9
acls.go
9
acls.go
@ -4,11 +4,12 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/rs/zerolog/log"
|
||||||
|
|
||||||
"github.com/tailscale/hujson"
|
"github.com/tailscale/hujson"
|
||||||
"inet.af/netaddr"
|
"inet.af/netaddr"
|
||||||
"tailscale.com/tailcfg"
|
"tailscale.com/tailcfg"
|
||||||
@ -66,7 +67,8 @@ func (h *Headscale) generateACLRules() (*[]tailcfg.FilterRule, error) {
|
|||||||
for j, u := range a.Users {
|
for j, u := range a.Users {
|
||||||
srcs, err := h.generateACLPolicySrcIP(u)
|
srcs, err := h.generateACLPolicySrcIP(u)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Error parsing ACL %d, User %d", i, j)
|
log.Error().
|
||||||
|
Msgf("Error parsing ACL %d, User %d", i, j)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
srcIPs = append(srcIPs, *srcs...)
|
srcIPs = append(srcIPs, *srcs...)
|
||||||
@ -77,7 +79,8 @@ func (h *Headscale) generateACLRules() (*[]tailcfg.FilterRule, error) {
|
|||||||
for j, d := range a.Ports {
|
for j, d := range a.Ports {
|
||||||
dests, err := h.generateACLPolicyDestPorts(d)
|
dests, err := h.generateACLPolicyDestPorts(d)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Error parsing ACL %d, Port %d", i, j)
|
log.Error().
|
||||||
|
Msgf("Error parsing ACL %d, Port %d", i, j)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
destPorts = append(destPorts, *dests...)
|
destPorts = append(destPorts, *dests...)
|
||||||
|
Loading…
Reference in New Issue
Block a user