MCPcopy
hub / github.com/nextdns/nextdns / activate

Function activate

activate.go:63–80  ·  view source on GitHub ↗
(c config.Config)

Source from the content-addressed store, hash-verified

61}
62
63func 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
82func deactivate() error {
83 return host.ResetDNS()

Callers 2

activationFunction · 0.85
runFunction · 0.85

Calls 2

SetDNSFunction · 0.92
listenAddrFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…