Rewrite of the entrypoint in Golang (#71)
- 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)
This commit is contained in:
31
internal/pia/modify.go
Normal file
31
internal/pia/modify.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package pia
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"strings"
|
||||
|
||||
"github.com/qdm12/private-internet-access-docker/internal/constants"
|
||||
)
|
||||
|
||||
func (c *configurator) ModifyLines(lines []string, IPs []net.IP, port uint16) (modifiedLines []string) {
|
||||
c.logger.Info("%s: adapting openvpn configuration for server IP addresses and port %d", logPrefix, port)
|
||||
// Remove lines
|
||||
for _, line := range lines {
|
||||
if strings.Contains(line, "privateinternetaccess.com") ||
|
||||
strings.Contains(line, "resolv-retry") {
|
||||
continue
|
||||
}
|
||||
modifiedLines = append(modifiedLines, line)
|
||||
}
|
||||
// Add lines
|
||||
for _, IP := range IPs {
|
||||
modifiedLines = append(modifiedLines, fmt.Sprintf("remote %s %d", IP.String(), port))
|
||||
}
|
||||
modifiedLines = append(modifiedLines, "auth-user-pass "+string(constants.OpenVPNAuthConf))
|
||||
modifiedLines = append(modifiedLines, "auth-retry nointeract")
|
||||
modifiedLines = append(modifiedLines, "pull-filter ignore \"auth-token\"") // prevent auth failed loops
|
||||
modifiedLines = append(modifiedLines, "user nonrootuser")
|
||||
modifiedLines = append(modifiedLines, "mute-replay-warnings")
|
||||
return modifiedLines
|
||||
}
|
||||
Reference in New Issue
Block a user