mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-02-03 22:18:39 +00:00
Generating nextdns config must happen after stopping current ctrld process. Otherwise, config processing may pick wrong IP+Port. While at it, also making logging better when updating listener config: - Change warn to info, prevent confusing that "something is wrong". - Do not emit info when generating working default config, which may cause duplicated messages printed.
32 lines
562 B
Go
32 lines
562 B
Go
package cli
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/Control-D-Inc/ctrld"
|
|
)
|
|
|
|
const nextdnsURL = "https://dns.nextdns.io"
|
|
|
|
func generateNextDNSConfig(uid string) {
|
|
if uid == "" {
|
|
return
|
|
}
|
|
mainLog.Load().Info().Msg("generating ctrld config for NextDNS resolver")
|
|
cfg = ctrld.Config{
|
|
Listener: map[string]*ctrld.ListenerConfig{
|
|
"0": {
|
|
IP: "0.0.0.0",
|
|
Port: 53,
|
|
},
|
|
},
|
|
Upstream: map[string]*ctrld.UpstreamConfig{
|
|
"0": {
|
|
Type: ctrld.ResolverTypeDOH3,
|
|
Endpoint: fmt.Sprintf("%s/%s", nextdnsURL, uid),
|
|
Timeout: 5000,
|
|
},
|
|
},
|
|
}
|
|
}
|