(c config.Config)
| 61 | } |
| 62 | |
| 63 | func activate(c config.Config) error { |
| 64 | if len(c.Listens) == 0 { |
| 65 | return errors.New("missing listen setting") |
| 66 | } |
| 67 | listen := c.Listens[0] |
| 68 | if c.SetupRouter { |
| 69 | // Setup router might make nextdns listen on a custom port so it can |
| 70 | // be chained behind dnsmasq for instance. To make the router use |
| 71 | // nextdns, we want it to go thru the whole chain so it benefits |
| 72 | // from dnsmasq cache. |
| 73 | listen = "127.0.0.1:53" |
| 74 | } |
| 75 | listenIP, listenPort, err := listenAddr(listen) |
| 76 | if err != nil { |
| 77 | return err |
| 78 | } |
| 79 | return host.SetDNS(listenIP, listenPort) |
| 80 | } |
| 81 | |
| 82 | func deactivate() error { |
| 83 | return host.ResetDNS() |
no test coverage detected
searching dependent graphs…