Skip to content

Commit

Permalink
Strip /32 prefix to fix #33
Browse files Browse the repository at this point in the history
  • Loading branch information
NHAS committed Mar 2, 2023
1 parent d0105dd commit a06307a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
Binary file modified internal/router/bpf_bpfeb.o
Binary file not shown.
Binary file modified internal/router/bpf_bpfel.o
Binary file not shown.
9 changes: 8 additions & 1 deletion internal/webserver/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"net/http"
"net/url"
"sort"
"strings"
"time"

"github.com/NHAS/wag/internal/config"
Expand Down Expand Up @@ -408,13 +409,19 @@ func registerDevice(w http.ResponseWriter, r *http.Request) {
return
}

dnsWithOutSubnet := config.Values().Wireguard.DNS

for i := 0; i < len(dnsWithOutSubnet); i++ {
dnsWithOutSubnet[i] = strings.TrimSuffix(dnsWithOutSubnet[i], "/32")
}

i := resources.Interface{
ClientPrivateKey: keyStr,
ClientAddress: address,
ServerAddress: fmt.Sprintf("%s:%d", config.Values().ExternalAddress, wgPort),
ServerPublicKey: wgPublicKey.String(),
CapturedAddresses: append(acl.Allow, acl.Mfa...),
DNS: config.Values().Wireguard.DNS,
DNS: dnsWithOutSubnet,
ClientPresharedKey: presharedKey,
}

Expand Down

0 comments on commit a06307a

Please sign in to comment.