Skip to content

Building from source

Ian Cameron edited this page Jan 5, 2019 · 2 revisions

How to build dnscrypt-proxy


  • Minimum requirement is go 1.10+

  • Building on a non-Android OS: You cannot build the android version without following this guide first.

  • Building on Android: You cannot build for an android/arch different to your device's, nor can you build for Linux/any arch. Windows with any arch seems to work however.

1. Build tools and starting up

Windows: Install git and go. Or use chocolatey:

choco install git golang

Now open a Powershell window (Win+X > Windows Powershell).

Linux: Open a terminal window, install git and go:

<pkg-install-command> git golang

Android: Install Termux and start it. Then install git and go:

pkg install git golang

2. Create your working directory

mkdir dnscrypt-proxy-src
cd dnscrypt-proxy-src

3. Clone this repo

Must be cloned into a folder called src.

git clone src

4. Set environment variables

GOOS and GOARCH don't need to be set if you're only building for your current OS install, they're already set to the right values (see go env GOOS GOARCH). Otherwise, possible values can be found here. You may also want to set GOARM when using GOARCH=arm, see GoArm wiki.

# Windows

# Linux
export GOPATH=$PWD
export GOOS=linux 
export GOARCH=amd64

# Android
export GOPATH=$PWD
export GOOS=android 
export GOARCH=arm64 (or: export GOARCH=arm; export GOARM=7)

5. Build dnscrypt-proxy

Change the output path as appropriate for your OS/arch.

cd src/dnscrypt-proxy
go clean

# Windows
go build -ldflags="-s -w" -o $env:GOPATH/win64/dnscrypt-proxy.exe

# Linux
go build -ldflags="-s -w" -o $GOPATH/linux-amd64/dnscrypt-proxy

# Android
go build -ldflags="-s -w" -o $GOPATH/android-arm64/dnscrypt-proxy
go build -ldflags="-s -w" -o $GOPATH/android-arm/dnscrypt-proxy

6. Copy the example config and installation files

Change the destination paths as appropriate.

# Windows
gci $env:GOPATH/src/dnscrypt-proxy/example-* | cp -dest $env:GOPATH/win64
gci $env:GOPATH/src/windows/* | cp -dest $env:GOPATH/win64

# Linux
cp $GOPATH/src/dnscrypt-proxy/example-* $GOPATH/linux-amd64

# Android
cp $GOPATH/src/dnscrypt-proxy/example-* $GOPATH/android-arm64

7. Binary location


The binary should be inside C:/Users/<USERNAME>/dnscrypt-proxy-src/win64, which you can open with Invoke-Item:

ii $env:GOPATH/win64


The binary should be inside /home/<USERNAME>/dnscrypt-proxy-src/linux-amd64


The binary should be inside /data/data/com.termux/files/home/dnscrypt-proxy-src/android-arm64

You will need root to access it directly (or even use dnscrypt-proxy). Otherwise, you can try copying it to internal storage.

Clone this wiki locally
You can’t perform that action at this time.