- General improvements
- Parallel download of only needed files at start
- Prettier console output with all streams merged (openvpn, unbound, shadowsocks etc.)
- Simplified Docker final image
- Faster bootup
- DNS over TLS
- Finer grain blocking at DNS level: malicious, ads and surveillance
- Choose your DNS over TLS providers
- Ability to use multiple DNS over TLS providers for DNS split horizon
- Environment variables for DNS logging
- DNS block lists needed are downloaded and built automatically at start, in parallel
- PIA
- A random region is selected if the REGION parameter is left empty (thanks @rorph for your PR)
- Routing and iptables adjusted so it can work as a Kubernetes pod sidecar (thanks @rorph for your PR)
33 lines
793 B
Go
33 lines
793 B
Go
package dns
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/qdm12/private-internet-access-docker/internal/constants"
|
|
)
|
|
|
|
func (c *configurator) SetLocalNameserver() error {
|
|
c.logger.Info("%s: setting local nameserver to 127.0.0.1", logPrefix)
|
|
data, err := c.fileManager.ReadFile(string(constants.ResolvConf))
|
|
if err != nil {
|
|
return err
|
|
}
|
|
s := strings.TrimSuffix(string(data), "\n")
|
|
lines := strings.Split(s, "\n")
|
|
if len(lines) == 1 && lines[0] == "" {
|
|
lines = nil
|
|
}
|
|
found := false
|
|
for i := range lines {
|
|
if strings.HasPrefix(lines[i], "nameserver ") {
|
|
lines[i] = "nameserver 127.0.0.1"
|
|
found = true
|
|
}
|
|
}
|
|
if !found {
|
|
lines = append(lines, "nameserver 127.0.0.1")
|
|
}
|
|
data = []byte(strings.Join(lines, "\n"))
|
|
return c.fileManager.WriteToFile(string(constants.ResolvConf), data)
|
|
}
|