mirror of
https://github.com/coredns/coredns.git
synced 2026-06-16 14:10:11 -04:00
feat(forward): add doh support (#8004)
* chore(pkg/proxy): prepare for DoH implementation Signed-off-by: Thomas Gosteli <thomas.gosteli@protonmail.ch> * chore(pkg/proxy): prepare for DoH implementation Signed-off-by: Thomas Gosteli <thomas.gosteli@protonmail.ch> * feat(proxy): implement basic DoH resolution Signed-off-by: Thomas Gosteli <thomas.gosteli@protonmail.ch> * feat(forward): implement DoH forwarding Signed-off-by: Thomas Gosteli <thomas.gosteli@protonmail.ch> * feat(proxy): add basic DoH health checker Signed-off-by: Thomas Gosteli <thomas.gosteli@protonmail.ch> * chore: align http transport with Go's DefaultTransport and resolve some of the TODOs Signed-off-by: Thomas Gosteli <thomas.gosteli@protonmail.ch> * docs(forward): add basic documentation for DoH Signed-off-by: Thomas Gosteli <thomas.gosteli@protonmail.ch> * chore: add basic tests to cover DoH Signed-off-by: Thomas Gosteli <thomas.gosteli@protonmail.ch> * chore(health): unify default timeout to 1s Signed-off-by: Thomas Gosteli <thomas.gosteli@protonmail.ch> * feat(forward): make doh method configurable Signed-off-by: Thomas Gosteli <thomas.gosteli@protonmail.ch> * chore: remove maxIdleConnsPerHost setting & update docs Signed-off-by: Thomas Gosteli <thomas.gosteli@protonmail.ch> * chore(forward): reject https upstreams with path Signed-off-by: Thomas Gosteli <thomas.gosteli@protonmail.ch> --------- Signed-off-by: Thomas Gosteli <thomas.gosteli@protonmail.ch>
This commit is contained in:
@@ -2,6 +2,7 @@ package proxy
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"net/http"
|
||||
"sort"
|
||||
"sync"
|
||||
"time"
|
||||
@@ -19,12 +20,13 @@ type persistConn struct {
|
||||
// Transport hold the persistent cache.
|
||||
type Transport struct {
|
||||
avgDialTime int64 // kind of average time of dial time
|
||||
conns [typeTotalCount][]*persistConn // Buckets for udp, tcp and tcp-tls.
|
||||
conns [typeTotalCount][]*persistConn // Buckets for udp and tcp connections
|
||||
expire time.Duration // After this duration an idle connection is expired.
|
||||
maxAge time.Duration // After this duration a connection is closed regardless of activity; 0 means unlimited.
|
||||
maxIdleConns int // Max idle connections per transport type; 0 means unlimited.
|
||||
maxIdleConns int // Max idle connections per protocol type; 0 means unlimited.
|
||||
addr string
|
||||
tlsConfig *tls.Config
|
||||
httpClient *http.Client
|
||||
proxyName string
|
||||
|
||||
mu sync.Mutex
|
||||
@@ -40,6 +42,7 @@ func newTransport(proxyName, addr string) *Transport {
|
||||
stop: make(chan struct{}),
|
||||
proxyName: proxyName,
|
||||
}
|
||||
|
||||
return t
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user