Skip to content

Simplify network implementation#346

Merged
9seconds merged 5 commits intomasterfrom
simple-network
Feb 27, 2026
Merged

Simplify network implementation#346
9seconds merged 5 commits intomasterfrom
simple-network

Conversation

@9seconds
Copy link
Copy Markdown
Owner

@9seconds 9seconds commented Feb 27, 2026

This PR refactors network implementation, makes it more streamlined.

As a side-effect now we can support UDP DNS, DoH, DoT.

# Starting from mtg v2.1.12 we have changed a configuration for DNS. Now it
# supports DNS-over-HTTPS, DNS-over-TLS, custom UDP resolver and system
# resolver.
#
# Here is how to define DNS-over-HTTPS:
#  - https://1.1.1.1
#  - https://1.1.1.1/dns-query
#  - https://cloudflare-dns.com/dns-query
#  - https://cloudflare-dns.com
#
# Here is how to define DNS-over-TLS:
#  - tls://1.1.1.1
#  - tls://cloudflare-dns.com
#
# Here is how to define a custom UDP resolver (we support only IPs here)
#  - 1.1.1.1
#  - udp://1.1.1.1
#
# If you set it to empty string, default resolver will be used. But please comment out doh-ip
dns = "https://1.1.1.1"

This also makes old network.doh-ip setting invalid.

@9seconds 9seconds force-pushed the simple-network branch 2 times, most recently from 9a133a9 to a7f5109 Compare February 27, 2026 15:10
@9seconds 9seconds merged commit ffe0526 into master Feb 27, 2026
8 checks passed
@9seconds 9seconds deleted the simple-network branch February 27, 2026 15:25
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 68.54460% with 67 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.84%. Comparing base (282896b) to head (700417b).
⚠️ Report is 6 commits behind head on master.

Files with missing lines Patch % Lines
internal/cli/run_proxy.go 0.00% 22 Missing ⚠️
essentials/conns.go 0.00% 10 Missing ⚠️
network/v2/multi_network.go 66.66% 9 Missing and 1 partial ⚠️
network/v2/sockopts.go 27.27% 4 Missing and 4 partials ⚠️
internal/config/config.go 0.00% 5 Missing ⚠️
network/v2/sockopts_unix.go 54.54% 3 Missing and 2 partials ⚠️
internal/config/type_dns_uri.go 93.93% 1 Missing and 1 partial ⚠️
network/v2/dns.go 93.10% 2 Missing ⚠️
network/v2/proxy_network.go 84.61% 1 Missing and 1 partial ⚠️
internal/config/type_proxy_url.go 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #346      +/-   ##
==========================================
+ Coverage   68.69%   68.84%   +0.15%     
==========================================
  Files          81       90       +9     
  Lines        2750     2940     +190     
==========================================
+ Hits         1889     2024     +135     
- Misses        754      801      +47     
- Partials      107      115       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants