Minor changes
- Added missing environment variables to Dockerfile - Constant ca certificates filepath - Removed dns/os.go unused file - Formatting improvements - Added comments - Readme TODOs update
This commit is contained in:
@@ -36,6 +36,9 @@ ENV USER= \
|
|||||||
REGION="CA Montreal" \
|
REGION="CA Montreal" \
|
||||||
DOT=on \
|
DOT=on \
|
||||||
DOT_PROVIDERS=cloudflare \
|
DOT_PROVIDERS=cloudflare \
|
||||||
|
DOT_VERBOSITY=1 \
|
||||||
|
DOT_VERBOSITY_DETAILS=0 \
|
||||||
|
DOT_VALIDATION_LOGLEVEL=0 \
|
||||||
BLOCK_MALICIOUS=on \
|
BLOCK_MALICIOUS=on \
|
||||||
BLOCK_SURVEILLANCE=off \
|
BLOCK_SURVEILLANCE=off \
|
||||||
BLOCK_ADS=off \
|
BLOCK_ADS=off \
|
||||||
|
|||||||
@@ -322,7 +322,14 @@ Note that not all regions support port forwarding.
|
|||||||
- Setup
|
- Setup
|
||||||
- Logging streams
|
- Logging streams
|
||||||
- More unit tests
|
- More unit tests
|
||||||
- Switch to iptables-go instead of using the shell iptables
|
- Write in Go
|
||||||
|
- DNS over TLS to replace Unbound
|
||||||
|
- HTTP proxy to replace tinyproxy
|
||||||
|
- use [go-Shadowsocks2](https://github.com/shadowsocks/go-shadowsocks2)
|
||||||
|
- DNS over HTTPS, maybe use [github.com/likexian/doh-go](https://github.com/likexian/doh-go)
|
||||||
|
- use [iptables-go](https://github.com/coreos/go-iptables) to replace iptables
|
||||||
|
- wireguard-go
|
||||||
|
- Openvpn to replace openvpn
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ const (
|
|||||||
UnboundConf models.Filepath = "/etc/unbound/unbound.conf"
|
UnboundConf models.Filepath = "/etc/unbound/unbound.conf"
|
||||||
// ResolvConf is the file path to the system resolv.conf file
|
// ResolvConf is the file path to the system resolv.conf file
|
||||||
ResolvConf models.Filepath = "/etc/resolv.conf"
|
ResolvConf models.Filepath = "/etc/resolv.conf"
|
||||||
|
// CACertificates is the file path to the CA certificates file
|
||||||
|
CACertificates models.Filepath = "/etc/ssl/certs/ca-certificates.crt"
|
||||||
// OpenVPNAuthConf is the file path to the OpenVPN auth file
|
// OpenVPNAuthConf is the file path to the OpenVPN auth file
|
||||||
OpenVPNAuthConf models.Filepath = "/etc/openvpn/auth.conf"
|
OpenVPNAuthConf models.Filepath = "/etc/openvpn/auth.conf"
|
||||||
// OpenVPNConf is the file path to the OpenVPN client configuration file
|
// OpenVPNConf is the file path to the OpenVPN client configuration file
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ func generateUnboundConf(settings settings.DNS, client network.Client, logger lo
|
|||||||
"hide-identity": "yes",
|
"hide-identity": "yes",
|
||||||
"hide-version": "yes",
|
"hide-version": "yes",
|
||||||
// Security
|
// Security
|
||||||
"tls-cert-bundle": "\"/etc/ssl/certs/ca-certificates.crt\"",
|
"tls-cert-bundle": fmt.Sprintf("%q", constants.CACertificates),
|
||||||
"root-hints": fmt.Sprintf("%q", constants.RootHints),
|
"root-hints": fmt.Sprintf("%q", constants.RootHints),
|
||||||
"trust-anchor-file": fmt.Sprintf("%q", constants.RootKey),
|
"trust-anchor-file": fmt.Sprintf("%q", constants.RootKey),
|
||||||
"harden-below-nxdomain": "yes",
|
"harden-below-nxdomain": "yes",
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
package dns
|
|
||||||
|
|
||||||
import (
|
|
||||||
"net"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/qdm12/private-internet-access-docker/internal/constants"
|
|
||||||
)
|
|
||||||
|
|
||||||
func (c *configurator) SetNameserver(IP net.IP) error {
|
|
||||||
c.logger.Info("%s: setting local nameserver to %s", logPrefix, IP.String())
|
|
||||||
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 " + IP.String()
|
|
||||||
found = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if !found {
|
|
||||||
lines = append(lines, "nameserver "+IP.String())
|
|
||||||
}
|
|
||||||
data = []byte(strings.Join(lines, "\n"))
|
|
||||||
return c.fileManager.WriteToFile(string(constants.ResolvConf), data)
|
|
||||||
}
|
|
||||||
@@ -63,6 +63,8 @@ type paramsReader struct {
|
|||||||
unsetEnv func(key string) error
|
unsetEnv func(key string) error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewParamsReader returns a paramsReadeer object to read parameters from
|
||||||
|
// environment variables
|
||||||
func NewParamsReader(logger logging.Logger) ParamsReader {
|
func NewParamsReader(logger logging.Logger) ParamsReader {
|
||||||
return ¶msReader{
|
return ¶msReader{
|
||||||
envParams: libparams.NewEnvParams(),
|
envParams: libparams.NewEnvParams(),
|
||||||
|
|||||||
@@ -42,11 +42,11 @@ func (d *DNS) String() string {
|
|||||||
}
|
}
|
||||||
settingsList := []string{
|
settingsList := []string{
|
||||||
"DNS over TLS settings:",
|
"DNS over TLS settings:",
|
||||||
"DNS over TLS provider: \n |--" + strings.Join(providersStr, "\n |--"),
|
"DNS over TLS provider:\n |--" + strings.Join(providersStr, "\n |--"),
|
||||||
"Block malicious: " + blockMalicious,
|
"Block malicious: " + blockMalicious,
|
||||||
"Block surveillance: " + blockSurveillance,
|
"Block surveillance: " + blockSurveillance,
|
||||||
"Block ads: " + blockAds,
|
"Block ads: " + blockAds,
|
||||||
"Allowed hostnames: " + strings.Join(d.AllowedHostnames, ", "),
|
"Allowed hostnames:\n |--" + strings.Join(d.AllowedHostnames, "\n |--"),
|
||||||
"Private addresses:\n |--" + strings.Join(d.PrivateAddresses, "\n |--"),
|
"Private addresses:\n |--" + strings.Join(d.PrivateAddresses, "\n |--"),
|
||||||
"Verbosity level: " + fmt.Sprintf("%d/5", d.VerbosityLevel),
|
"Verbosity level: " + fmt.Sprintf("%d/5", d.VerbosityLevel),
|
||||||
"Verbosity details level: " + fmt.Sprintf("%d/4", d.VerbosityDetailsLevel),
|
"Verbosity details level: " + fmt.Sprintf("%d/4", d.VerbosityDetailsLevel),
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import (
|
|||||||
"github.com/qdm12/private-internet-access-docker/internal/params"
|
"github.com/qdm12/private-internet-access-docker/internal/params"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Splash returns the welcome spash message
|
||||||
func Splash(paramsReader params.ParamsReader) string {
|
func Splash(paramsReader params.ParamsReader) string {
|
||||||
version := paramsReader.GetVersion()
|
version := paramsReader.GetVersion()
|
||||||
vcsRef := paramsReader.GetVcsRef()
|
vcsRef := paramsReader.GetVcsRef()
|
||||||
@@ -40,7 +41,7 @@ func title() []string {
|
|||||||
func annoucement() []string {
|
func annoucement() []string {
|
||||||
timestamp := time.Now().UnixNano() / 1000000000
|
timestamp := time.Now().UnixNano() / 1000000000
|
||||||
if timestamp < constants.AnnoucementExpiration {
|
if timestamp < constants.AnnoucementExpiration {
|
||||||
return []string{emoji.Sprint(":rotating_light: ") + constants.Annoucement}
|
return []string{emoji.Sprint(":mega: ") + constants.Annoucement}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user