Giter Site home page Giter Site logo

Comments (3)

ilyaigpetrov avatar ilyaigpetrov commented on August 16, 2024 1

I forgot to add errors to the Corefile. Everything now works as expected. Thank you!

from example.

chrisohaver avatar chrisohaver commented on August 16, 2024

There needs to be a plugin that can answer the query in the plugin chain after example. once an answer is generated, example plugin prints "example" just before sending the answer to the client.

If you included the errors plugin, you'd see a "no next plugin" error, meaning that the example plugin tried passing the query to the next plugin, but there isn't one.

explained in this comment...

func (e Example) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {
	// This function could be simpler. I.e. just fmt.Println("example") here, but we want to show
	// a slightly more complex example as to make this more interesting.
	// Here we wrap the dns.ResponseWriter in a new ResponseWriter and call the next plugin, when the
	// answer comes back, it will print "example".

from example.

ilyaigpetrov avatar ilyaigpetrov commented on August 16, 2024

Thank you for your solution -- if I add forward plugin then it works as expected (prints "example" to output).

$ cat plugin.cfg
errors:errors
log:log
example:example
forward:forward
$ cat Corefile
example.com {
  forward . 9.9.9.9
  example
}

You've mentioned that errors plugin could be useful here so I decided to try it and tested the following configuration:

$ cat plugin.cfg
errors:errors
log:log
example:example
$ cat Corefile
example.com {
  example
}
$ make && ./coredns -dns.port 1337
(another terminal)$ dig @127.0.0.1 -p 1337 example.com
# Expected: "no next plugin" error must appear in the coredns output.
# Actual: no error message is printed to the output.

As you can see no error message is printed. Could you, please, advise me how to use errors plugin in this situation. This is not important so feel free to close this issues without answering my second question.

from example.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.