diff options
author | 2019-03-03 23:32:38 -0800 | |
---|---|---|
committer | 2019-03-04 07:32:38 +0000 | |
commit | 9dd288943a778c19d5a798e1c1535cd0ba5d53c0 (patch) | |
tree | 2f555f01f74f41c005f75aa5a27659d6c5133410 /plugin/proxy/setup.go | |
parent | dfa413af096646e04882bb8312eef27fe1a160ef (diff) | |
download | coredns-9dd288943a778c19d5a798e1c1535cd0ba5d53c0.tar.gz coredns-9dd288943a778c19d5a798e1c1535cd0ba5d53c0.tar.zst coredns-9dd288943a778c19d5a798e1c1535cd0ba5d53c0.zip |
Move *proxy* to external (#2651)
* Move *proxy* to external
move the proxy plugin into coredns/proxy and remove it as a default
plugin. Link the proxy to deprecated in plugin.cfg
coredns/proxy doesn't compile because of the vendoring :(
Signed-off-by: Miek Gieben <miek@miek.nl>
* Add github.com/coredns/proxy
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Diffstat (limited to 'plugin/proxy/setup.go')
-rw-r--r-- | plugin/proxy/setup.go | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/plugin/proxy/setup.go b/plugin/proxy/setup.go deleted file mode 100644 index 2f3d7dd62..000000000 --- a/plugin/proxy/setup.go +++ /dev/null @@ -1,53 +0,0 @@ -package proxy - -import ( - "github.com/coredns/coredns/core/dnsserver" - "github.com/coredns/coredns/plugin" - "github.com/coredns/coredns/plugin/metrics" - clog "github.com/coredns/coredns/plugin/pkg/log" - - "github.com/mholt/caddy" -) - -var log = clog.NewWithPlugin("proxy") - -func init() { - caddy.RegisterPlugin("proxy", caddy.Plugin{ - ServerType: "dns", - Action: setup, - }) -} - -func setup(c *caddy.Controller) error { - upstreams, err := NewStaticUpstreams(&c.Dispenser) - if err != nil { - return plugin.Error("proxy", err) - } - - t := dnsserver.GetConfig(c).Handler("trace") - P := &Proxy{Trace: t} - dnsserver.GetConfig(c).AddPlugin(func(next plugin.Handler) plugin.Handler { - P.Next = next - P.Upstreams = &upstreams - return P - }) - - c.OnStartup(func() error { - metrics.MustRegister(c, RequestCount, RequestDuration) - return nil - }) - - for i := range upstreams { - u := upstreams[i] - c.OnStartup(func() error { - return u.Exchanger().OnStartup(P) - }) - c.OnShutdown(func() error { - return u.Exchanger().OnShutdown(P) - }) - // Register shutdown handlers. - c.OnShutdown(u.Stop) - } - - return nil -} |