More platforms

This commit is contained in:
Andrey Meshkov 2019-02-27 12:41:37 +03:00
parent aa30728cda
commit bd31151c1f
2 changed files with 18 additions and 6 deletions

View file

@ -4,6 +4,7 @@ import (
"io/ioutil" "io/ioutil"
"os" "os"
"path/filepath" "path/filepath"
"runtime"
"sync" "sync"
"time" "time"
@ -60,8 +61,6 @@ type dnsConfig struct {
UpstreamDNS []string `yaml:"upstream_dns"` UpstreamDNS []string `yaml:"upstream_dns"`
} }
var defaultDNS = []string{"tls://1.1.1.1", "tls://1.0.0.1"}
type tlsConfigSettings struct { type tlsConfigSettings struct {
Enabled bool `yaml:"enabled" json:"enabled"` // Enabled is the encryption (DOT/DOH/HTTPS) status Enabled bool `yaml:"enabled" json:"enabled"` // Enabled is the encryption (DOT/DOH/HTTPS) status
ServerName string `yaml:"server_name" json:"server_name,omitempty"` // ServerName is the hostname of your HTTPS/TLS server ServerName string `yaml:"server_name" json:"server_name,omitempty"` // ServerName is the hostname of your HTTPS/TLS server
@ -99,6 +98,8 @@ type tlsConfig struct {
tlsConfigStatus `yaml:"-" json:",inline"` tlsConfigStatus `yaml:"-" json:",inline"`
} }
var defaultDNS = []string{"tls://1.1.1.1", "tls://1.0.0.1"}
// initialize to default values, will be changed later when reading config or parsing command line // initialize to default values, will be changed later when reading config or parsing command line
var config = configuration{ var config = configuration{
ourConfigFilename: "AdGuardHome.yaml", ourConfigFilename: "AdGuardHome.yaml",
@ -133,6 +134,16 @@ var config = configuration{
SchemaVersion: currentSchemaVersion, SchemaVersion: currentSchemaVersion,
} }
// init initializes default configuration for the current OS&ARCH
func init() {
if runtime.GOARCH == "mips" || runtime.GOARCH == "mipsle" {
// Use plain DNS on MIPS, encryption is too slow
defaultDNS = []string{"1.1.1.1", "1.0.0.1"}
// also change the default config
config.DNS.UpstreamDNS = defaultDNS
}
}
// getConfigFilename returns path to the current config file // getConfigFilename returns path to the current config file
func (c *configuration) getConfigFilename() string { func (c *configuration) getConfigFilename() string {
configFile := config.ourConfigFilename configFile := config.ourConfigFilename

View file

@ -9,11 +9,9 @@ version=`git describe --abbrev=4 --dirty --always --tags`
f() { f() {
make cleanfast; CGO_DISABLED=1 make make cleanfast; CGO_DISABLED=1 make
if [[ $GOOS == darwin ]]; then if [[ $GOOS == darwin ]]; then
rm -f dist/AdGuardHome_"$version"_MacOS.zip
zip dist/AdGuardHome_"$version"_MacOS.zip AdGuardHome README.md LICENSE.txt zip dist/AdGuardHome_"$version"_MacOS.zip AdGuardHome README.md LICENSE.txt
elif [[ $GOOS == windows ]]; then elif [[ $GOOS == windows ]]; then
rm -f dist/AdGuardHome_"$version"_Windows.zip zip dist/AdGuardHome_"$version"_Windows_"$GOARCH".zip AdGuardHome.exe README.md LICENSE.txt
zip dist/AdGuardHome_"$version"_Windows.zip AdGuardHome.exe README.md LICENSE.txt
else else
rm -rf dist/AdguardHome rm -rf dist/AdguardHome
mkdir -p dist/AdGuardHome mkdir -p dist/AdGuardHome
@ -39,3 +37,6 @@ GOOS=linux GOARCH=386 f
GOOS=linux GOARCH=arm GOARM=6 f GOOS=linux GOARCH=arm GOARM=6 f
GOOS=linux GOARCH=arm64 GOARM=6 f GOOS=linux GOARCH=arm64 GOARM=6 f
GOOS=windows GOARCH=amd64 f GOOS=windows GOARCH=amd64 f
GOOS=windows GOARCH=386 f
GOOS=linux GOARCH=mipsle f
GOOS=linux GOARCH=mips f