janeczku/go-dnsmasq

Support multiple nameservers for stubzones

Closed this issue · 2 comments

As a user having multiple VPN connections open at once I need to query different nameservers for different domains. All those nameservers are internal nameservers and not available as delegated nameservers from public (root) nameservers. To achieve this through go-dnsmasq I'd need to specify -z parameter multiple times.

Example

VPN1: searchdomain = network1.local, nameserver = 192.168.1.1
VPN2: searchdomain = network2.local, nameserver = 192.168.2.1

Parameters: go-dnsmasq [...] -z network1.local/192.168.1.1 -z network2.local/192.168.2.1 [...]

This overwrites the network1.local configuration while name resolution for network2.local is working.

dig @localhost test.network1.local => NXDOMAIN
dig @localhost test.network2.local => 192.168.2.5

Possible Solutions

  1. Use an argument parser supporting string arrays which is capable of reading multiple -z parameters
  2. Change the parsing format of -z parameter to support a delimiter (for example -z network1.local/192.168.1.1|network2.local/192.168.2.1)

While I prefer solution 1 as it provides the user with the ability to have much cleaner CLI arguments I think solution 2 would be the solution with minimal amount of changes.

You are lucky: codegangsta/cli actually supports solution 1: https://godoc.org/github.com/codegangsta/cli#StringSliceFlag

Wanna submit a PR?

Fixed in bd3a911