use system nameserver if DNS field is empty #26

This commit is contained in:
octeep 2022-03-31 09:32:43 +01:00
parent 787fb595a1
commit c6cc97c90d
4 changed files with 105 additions and 21 deletions

View file

@ -28,7 +28,7 @@ allowed_ip=0.0.0.0/0`, conf.SelfSecretKey, conf.PeerPublicKey, conf.PeerEndpoint
return setting, nil
}
func StartWireguard(conf *DeviceConfig) (*netstack.Net, error) {
func StartWireguard(conf *DeviceConfig) (*VirtualTun, error) {
setting, err := createIPCRequest(conf)
if err != nil {
return nil, err
@ -49,5 +49,8 @@ func StartWireguard(conf *DeviceConfig) (*netstack.Net, error) {
return nil, err
}
return tnet, nil
return &VirtualTun{
tnet: tnet,
systemDNS: len(setting.dns) == 0,
}, nil
}