Skip to content

Commit f270cfc

Browse files
committed
Merge branch 'master' of github.com:DNSCrypt/dnscrypt-proxy
2 parents 5740f59 + 00914a4 commit f270cfc

237 files changed

Lines changed: 19122 additions & 4094 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/releases.yml

Lines changed: 55 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,14 @@ jobs:
2525
steps:
2626
- name: Get the version
2727
id: get_version
28-
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
28+
run: |
29+
if [[ $GITHUB_REF == refs/tags/* ]]; then
30+
VERSION=${GITHUB_REF/refs\/tags\//}
31+
else
32+
VERSION="dev-$(date +'%Y%m%d-%H%M%S')-${GITHUB_SHA::8}"
33+
fi
34+
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
35+
echo "Tag version: $VERSION"
2936
3037
- name: Check out code
3138
uses: actions/checkout@v4
@@ -45,12 +52,10 @@ jobs:
4552
cd -
4653
4754
- name: Build all
48-
if: startsWith(github.ref, 'refs/tags/')
4955
run: |
5056
.ci/ci-build.sh "${{ steps.get_version.outputs.VERSION }}"
5157
5258
- name: Package
53-
if: startsWith(github.ref, 'refs/tags/')
5459
run: |
5560
.ci/ci-package.sh "${{ steps.get_version.outputs.VERSION }}"
5661
@@ -70,26 +75,63 @@ jobs:
7075
echo | /tmp/bin/minisign -s /tmp/minisign.key -Sm *.tar.gz *.zip
7176
ls -l dnscrypt-proxy*
7277
73-
- name: Create release
74-
id: create_release
75-
uses: actions/create-release@v1
78+
- name: Upload artifacts
79+
uses: actions/upload-artifact@v4
80+
with:
81+
name: dnscrypt-proxy-${{ steps.get_version.outputs.VERSION }}
82+
path: |
83+
dnscrypt-proxy/*.zip
84+
dnscrypt-proxy/*.tar.gz
85+
retention-days: 30
86+
if-no-files-found: error
87+
88+
- name: Check if release exists
89+
id: check_release
90+
if: startsWith(github.ref, 'refs/tags/')
91+
run: |
92+
TAG="${GITHUB_REF#refs/tags/}"
93+
HTTP_CODE=$(curl -s -o response.json -w "%{http_code}" \
94+
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
95+
https://api.github.com/repos/${{ github.repository }}/releases/tags/$TAG)
96+
if [ "$HTTP_CODE" = "200" ]; then
97+
echo "release_exists=true" >> $GITHUB_ENV
98+
else
99+
echo "release_exists=false" >> $GITHUB_ENV
100+
fi
101+
102+
- name: Debug Release Existence
76103
if: startsWith(github.ref, 'refs/tags/')
104+
run: echo "Release exists? ${{ env.release_exists }}"
105+
106+
- name: Create release and upload assets
107+
id: create_release
108+
uses: softprops/action-gh-release@v2
109+
if: startsWith(github.ref, 'refs/tags/') && env.release_exists == 'false'
77110
env:
78111
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
79112
with:
80-
tag_name: ${{ github.ref }}
81-
release_name: Release ${{ github.ref }}
113+
name: Release ${{ github.ref }}
82114
draft: false
83115
prerelease: false
84-
85-
- name: Upload release assets
86-
uses: softprops/action-gh-release@ab50eebb6488051c6788d97fa95232267c6a4e23
87-
if: startsWith(github.ref, 'refs/tags/')
116+
make_latest: true
117+
fail_on_unmatched_files: false
118+
files: |
119+
dnscrypt-proxy/*.zip
120+
dnscrypt-proxy/*.tar.gz
121+
dnscrypt-proxy/*.minisig
122+
dnscrypt-proxy/*.msi
123+
124+
- name: Upload assets to existing release
125+
id: upload_to_existing_release
126+
uses: softprops/action-gh-release@v2
127+
if: startsWith(github.ref, 'refs/tags/') && env.release_exists == 'true'
88128
env:
89129
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
90130
with:
131+
tag_name: ${{ steps.get_version.outputs.VERSION }}
132+
fail_on_unmatched_files: false
91133
files: |
92134
dnscrypt-proxy/*.zip
93135
dnscrypt-proxy/*.tar.gz
94136
dnscrypt-proxy/*.minisig
95-
dnscrypt-proxy/*.msi
137+
dnscrypt-proxy/*.msi

.github/workflows/shiftleft-analysis.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ dnscrypt-proxy/dnscrypt-proxy
1717
contrib/msi/*.msi
1818
contrib/msi/*.wixpdb
1919
contrib/msi/*.wixobj
20+
TODO.md

ChangeLog

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,49 @@
1+
# Version 2.1.12
2+
- A new Weighted Power of Two (WP2) load balancing strategy has been
3+
implemented as the default, providing improved distribution across resolvers.
4+
- An optional Prometheus metrics endpoint has been added for monitoring and
5+
observability.
6+
- Memory usage for the cache has been reduced.
7+
- The monitoring dashboard has received significant improvements including
8+
better security, performance optimizations, WebSocket rate limiting, and HTTP
9+
caching headers.
10+
- The monitoring UI has been refined with stable sorting to prevent
11+
flickering, query type limitations, and improved scrolling behavior.
12+
- Additional records in queries are now properly removed before forwarding.
13+
- The simple view UI has been removed as it provided limited utility.
14+
15+
# Version 2.1.11
16+
- The sievecache dependency was updated to fix a bug causing the cache to crash.
17+
18+
# Version 2.1.10
19+
- Hot-reloading of configuration files is now optional and disabled by default.
20+
It can be enabled by setting `enable_hot_reload = true` in the configuration file.
21+
- The file system monitoring for hot-reloading now uses efficient OS-native
22+
file notifications instead of polling, reducing CPU usage and improving responsiveness.
23+
24+
# Version 2.1.9
25+
- A live web-based monitoring UI has been added, allowing you to monitor DNS
26+
query activity and performance metrics through an interactive dashboard.
27+
- Hot-reloading of configuration files has been implemented, allowing you to
28+
modify filtering rules and other configurations without restarting the proxy.
29+
Simply edit a configuration file (like blocked-names.txt) and changes are
30+
applied instantaneously.
31+
- HTTP/3 probing is now supported via the `http3_probe` option, which will
32+
try HTTP/3 first for DoH servers, even if they don't advertise support via
33+
Alt-Svc.
34+
- Authentication for the monitoring UI can be disabled by setting the
35+
username to an empty string in the configuration.
36+
- Several race conditions have been fixed.
37+
- Dependencies have been updated.
38+
- DHCP DNS detector instances have been reduced to improve performance.
39+
- Tor isolation for dnscrypt-proxy has been documented to enhance privacy.
40+
- The default example configuration file has been improved for clarity and
41+
usability.
42+
- The cache lock contention has been reduced to improve performance under
43+
high load.
44+
- generate-domains-blocklist: added parallel downloading of block lists for
45+
significantly improved performance.
46+
147
# Version 2.1.8
248
- Dependencies have been updated, notably the QUIC implementation,
349
which could be vulnerable to denial-of-service attacks.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Available as source code and pre-built binaries for most operating systems and a
2828
* Filtering: block ads, malware, and other unwanted content. Compatible with all DNS services
2929
* Time-based filtering, with a flexible weekly schedule
3030
* Transparent redirection of specific domains to specific resolvers
31+
* Optional hot-reloading of configuration files (disabled by default from v2.1.10)
3132
* DNS caching, to reduce latency and improve privacy
3233
* Local IPv6 blocking to reduce latency on IPv4-only networks
3334
* Load balancing: pick a set of resolvers, dnscrypt-proxy will automatically measure and keep track of their speed, and balance the traffic across the fastest available ones.

dnscrypt-proxy/common.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"os"
99
"strconv"
1010
"strings"
11+
"sync"
1112
"unicode"
1213
)
1314

@@ -40,6 +41,7 @@ var (
4041
var (
4142
FileDescriptors = make([]*os.File, 0)
4243
FileDescriptorNum = uintptr(0)
44+
FileDescriptorsMu sync.Mutex
4345
)
4446

4547
const (
@@ -144,6 +146,8 @@ func TrimAndStripInlineComments(str string) string {
144146
return strings.TrimSpace(str)
145147
}
146148

149+
// ExtractHostAndPort parses a string containing a host and optional port.
150+
// If no port is present or cannot be parsed, the defaultPort is returned.
147151
func ExtractHostAndPort(str string, defaultPort int) (host string, port int) {
148152
host, port = str, defaultPort
149153
if idx := strings.LastIndex(str, ":"); idx >= 0 && idx < len(str)-1 {
@@ -154,11 +158,14 @@ func ExtractHostAndPort(str string, defaultPort int) (host string, port int) {
154158
return
155159
}
156160

161+
// ReadTextFile reads a file and returns its contents as a string.
162+
// It automatically removes UTF-8 BOM if present.
157163
func ReadTextFile(filename string) (string, error) {
158164
bin, err := os.ReadFile(filename)
159165
if err != nil {
160166
return "", err
161167
}
168+
// Remove UTF-8 BOM if present
162169
bin = bytes.TrimPrefix(bin, []byte{0xef, 0xbb, 0xbf})
163170
return string(bin), nil
164171
}

0 commit comments

Comments
 (0)