From 2dc2a0946a28f41736228db1065654716907c5b8 Mon Sep 17 00:00:00 2001
From: Aleksey Dmitrevskiy <ad@adguard.com>
Date: Tue, 26 Feb 2019 15:32:56 +0300
Subject: [PATCH] Fix #595 - Start using GO 1.12

---
 .travis.yml |  6 +++---
 README.md   |  2 +-
 app.go      | 11 +++++++++++
 go.mod      |  2 ++
 4 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 6d690463..f4319221 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,7 +2,7 @@ language: go
 sudo: false
 
 go:
-  - 1.11.x
+  - 1.12.x
   - 1.x
 os:
   - linux
@@ -38,7 +38,7 @@ matrix:
     # Release build configuration
     - name: release
       go:
-        - 1.11.x
+        - 1.12.x
       os:
         - linux
 
@@ -66,7 +66,7 @@ matrix:
     - name: docker
       if: type != pull_request AND (branch = master OR tag = true)
       go:
-        - 1.11.x
+        - 1.12.x
       os:
         - linux
       services:
diff --git a/README.md b/README.md
index 054fc951..84f1a194 100644
--- a/README.md
+++ b/README.md
@@ -70,7 +70,7 @@ Alternatively, you can use our [official Docker image](https://hub.docker.com/r/
 
 You will need:
 
- * [go](https://golang.org/dl/) v1.11 or later.
+ * [go](https://golang.org/dl/) v1.12 or later.
  * [node.js](https://nodejs.org/en/download/) v10 or later.
 
 You can either install it via the provided links or use [brew.sh](https://brew.sh/) if you're on Mac:
diff --git a/app.go b/app.go
index 0b55b6fa..1178678e 100644
--- a/app.go
+++ b/app.go
@@ -71,6 +71,9 @@ func run(args options) {
 	// configure log level and output
 	configureLogger(args)
 
+	// enable TLS 1.3
+	enableTLS13()
+
 	// print the first message after logger is configured
 	log.Printf("AdGuard Home, version %s\n", VersionString)
 	log.Tracef("Current working directory is %s", config.ourWorkingDir)
@@ -291,6 +294,14 @@ func configureLogger(args options) {
 	}
 }
 
+// TODO after GO 1.13 release TLS 1.3 will be enabled by default. Remove this afterward
+func enableTLS13() {
+	err := os.Setenv("GODEBUG", os.Getenv("GODEBUG")+",tls13=1")
+	if err != nil {
+		log.Fatalf("Failed to enable TLS 1.3: %s", err)
+	}
+}
+
 func cleanup() {
 	log.Printf("Stopping AdGuard Home")
 
diff --git a/go.mod b/go.mod
index cba63387..2f28b7e8 100644
--- a/go.mod
+++ b/go.mod
@@ -1,5 +1,7 @@
 module github.com/AdguardTeam/AdGuardHome
 
+go 1.12
+
 require (
 	github.com/AdguardTeam/dnsproxy v0.11.1
 	github.com/StackExchange/wmi v0.0.0-20180725035823-b12b22c5341f // indirect