File tree Expand file tree Collapse file tree 3 files changed +13
-2
lines changed Expand file tree Collapse file tree 3 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,11 @@ func (w *WGPool) AddPoolPeerByPubKey(publicKey wgtypes.Key) {
47
47
}
48
48
}
49
49
50
+ func (w * WGPool ) HasSubdomain (subdomain string ) bool {
51
+ _ , ok := w .subdomains [subdomain ]
52
+ return ok
53
+ }
54
+
50
55
func (w * WGPool ) GetPeerAddressBySubdomain (subdomain string ) net.IP {
51
56
return w .subdomains [subdomain ].address
52
57
}
Original file line number Diff line number Diff line change @@ -43,9 +43,10 @@ func (h *HTTPServer) StartServer() chan error {
43
43
}
44
44
45
45
var rr dns.RR
46
+ var subdomain = strings .Split (question .Name , "." )[0 ]
46
47
switch question .Qtype {
47
48
case dns .TypeA :
48
- if val := h .server .GetPeerAddressFor (strings .ToLower (question . Name )); val != nil {
49
+ if val := h .server .GetPeerAddressFor (strings .ToLower (subdomain )); val != nil {
49
50
rr = & dns.A {
50
51
Hdr : dns.RR_Header {
51
52
Name : question .Name ,
Original file line number Diff line number Diff line change @@ -217,7 +217,12 @@ func (s *WGServer) StopServer() {
217
217
}
218
218
219
219
func (s * WGServer ) GetPeerAddressFor (subdomain string ) net.IP {
220
- return s .wgPool .GetPeerAddressBySubdomain (subdomain )
220
+ s .logger .Verbosef ("GetPeerAddressFor %s" , subdomain )
221
+ if s .wgPool .HasSubdomain (subdomain ) {
222
+ return s .wgPool .GetPeerAddressBySubdomain (subdomain )
223
+ } else {
224
+ return nil
225
+ }
221
226
}
222
227
223
228
func checkIsRoot (logger * device.Logger ) (bool , error ) {
You can’t perform that action at this time.
0 commit comments