mirror of
https://github.com/jwhited/wgsd.git
synced 2025-01-19 06:19:33 +08:00
trivial fixes
This commit is contained in:
parent
53c1794798
commit
5c7c582a2a
@ -26,11 +26,12 @@ var (
|
||||
)
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
if len(*deviceFlag) < 1 {
|
||||
log.Fatal("missing device flag")
|
||||
}
|
||||
if len(*dnsZoneFlag) < 1 {
|
||||
log.Fatal("missing dns flag")
|
||||
log.Fatal("missing zone flag")
|
||||
}
|
||||
resolver := net.DefaultResolver
|
||||
if len(*dnsServerFlag) > 0 {
|
||||
@ -59,6 +60,10 @@ func main() {
|
||||
"error retrieving Wireguard device '%s' info: %v",
|
||||
*deviceFlag, err)
|
||||
}
|
||||
if len(wgDevice.Peers) < 1 {
|
||||
log.Println("no peers found")
|
||||
os.Exit(0)
|
||||
}
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
done := make(chan struct{})
|
||||
|
2
wgsd.go
2
wgsd.go
@ -142,7 +142,7 @@ func (p *WGSD) ServeDNS(ctx context.Context, w dns.ResponseWriter,
|
||||
}
|
||||
|
||||
func getHostRR(pubKey, zone string, endpoint *net.UDPAddr) dns.RR {
|
||||
if endpoint.IP == nil {
|
||||
if endpoint == nil || endpoint.IP == nil {
|
||||
return nil
|
||||
}
|
||||
name := fmt.Sprintf("%s.%s", strings.ToUpper(pubKey), zone)
|
||||
|
Loading…
x
Reference in New Issue
Block a user