mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 16:24:19 -04:00
Cleanup ParseHostOrFile (#2100)
Create plugin/pkg/transport that holds the transport related functions. This needed to be a new pkg to prevent cyclic import errors. This cleans up a bunch of duplicated code in core/dnsserver that also tried to parse a transport (now all done in transport.Parse). Signed-off-by: Miek Gieben <miek@miek.nl>
This commit is contained in:
@@ -18,7 +18,7 @@ type Proxy struct {
|
||||
|
||||
// Connection caching
|
||||
expire time.Duration
|
||||
transport *transport
|
||||
transport *Transport
|
||||
|
||||
// health checking
|
||||
probe *up.Probe
|
||||
@@ -26,7 +26,7 @@ type Proxy struct {
|
||||
}
|
||||
|
||||
// NewProxy returns a new proxy.
|
||||
func NewProxy(addr string, protocol int) *Proxy {
|
||||
func NewProxy(addr, trans string) *Proxy {
|
||||
p := &Proxy{
|
||||
addr: addr,
|
||||
fails: 0,
|
||||
@@ -34,7 +34,7 @@ func NewProxy(addr string, protocol int) *Proxy {
|
||||
transport: newTransport(addr),
|
||||
avgRtt: int64(maxTimeout / 2),
|
||||
}
|
||||
p.health = NewHealthChecker(protocol)
|
||||
p.health = NewHealthChecker(trans)
|
||||
runtime.SetFinalizer(p, (*Proxy).finalizer)
|
||||
return p
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user