Resolve hostname to localhost

This commit is contained in:
Daniel
2021-11-18 16:28:26 +01:00
parent 8794d72318
commit e092ab9831
2 changed files with 11 additions and 2 deletions

View File

@@ -4,6 +4,7 @@ import (
"context"
"fmt"
"net"
"os"
"strconv"
"github.com/safing/portbase/log"
@@ -46,6 +47,12 @@ func start() error {
return fmt.Errorf("failed to parse nameserver listen address: %w", err)
}
hostname, err = os.Hostname()
if err != nil {
log.Warningf("nameserver: failed to get hostname: %s", err)
}
hostname += "."
// Start listener(s).
if ip2 == nil {
// Start a single listener.