jwhited/wgsd

self endpoint unspecified returns socket bind addr over UDP

jwhited opened this issue · 0 comments

with this config:

.:5353 {
  debug
  wgsd example.com. wg0 {
    self
  }
}

querying for the host info returns:

% dig @<redacted> -p 5353 xmgkylsmekjzm7vkc3maxxfvvjf3mpayf6uj4fwwu66tf4hltzpq====._wireguard._udp.example.com. SRV
[...]
;; ADDITIONAL SECTION:
xmgkylsmekjzm7vkc3maxxfvvjf3mpayf6uj4fwwu66tf4hltzpq====._wireguard._udp.example.com. 0	IN AAAA	::
xmgkylsmekjzm7vkc3maxxfvvjf3mpayf6uj4fwwu66tf4hltzpq====._wireguard._udp.example.com. 0	IN TXT "txtvers=1" "pub=uwysLkwik5Z+qhbYC9y1qku2PBgvqJ4W1qe9MvDrnl8=" "allowed="

using tcp we get the actual addr:

% dig +tcp @<redacted>-p 5353 xmgkylsmekjzm7vkc3maxxfvvjf3mpayf6uj4fwwu66tf4hltzpq====._wireguard._udp.example.com. SRV
[...]
;; ADDITIONAL SECTION:
xmgkylsmekjzm7vkc3maxxfvvjf3mpayf6uj4fwwu66tf4hltzpq====._wireguard._udp.example.com. 0	IN A 172.31.1.108
xmgkylsmekjzm7vkc3maxxfvvjf3mpayf6uj4fwwu66tf4hltzpq====._wireguard._udp.example.com. 0	IN TXT "txtvers=1" "pub=uwysLkwik5Z+qhbYC9y1qku2PBgvqJ4W1qe9MvDrnl8=" "allowed="

We populate the A/AAAA data from the dns.ResponseWriter.LocalAddr() which comes from https://github.com/miekg/dns/blob/master/server.go