If I do implement a different server type, it would be merely for a proof of concept or example, or a very bare-bones implementation for others to build on. HTTP and Caddy core keep me busy enough. I do strongly encourage anyone interested to write other server types for Caddy.
One user of CoreDNS and Caddy @Jared_Folkins in fact) just told me this week that he loves the consistency in configuring a DNS server and an HTTP server; and looks forward to other server types benefitting from that workflow and automatic, managed TLS.
The Caddy website will be updated in the future to reflect these new capabilities!
Go continues to eat the stack Iām involved with. I have about 15 virtual servers for this one project with Caddy, Coredns, and Boltdb being a big part of that.
Thanks to @matt, @miekg, @abiosoft, and everyone else involved. I very much appreciate the effort and spirit Caddy (& Coredns) are built with.
@matt I think the current interface makes sense (enough). The MakeServers() and Context looks sane. I just need to port stuff over. Looks like I can drop a gazillion things - which is always good.
One thing I missed was some kind of logging frameworks that works within Caddy. The log.Printf("WARN") stuff lacks features (like ratelimiting 'n stuff).
Awesome, yeah, you should be able to lose all the stuff that Caddyās internals take care of.
Well if there are any that replace the standard logger (Iāve heard of some), you can use those. Or you can specify your own for DNS stuff specifically, but the rest of Caddy will still use the standard logger.
Oh, and @miekg, should I make that UDPListener interface a real thing in the caddy package so that other UDP servers can use it? (Is it helpful to you at all?)
The UDPListener wonāt work⦠This is only one of the available packet implementations. Take a look at the net package. It still has Listen and ListenPacket which uses net.PacketConn. This would lead to a werid split where the TCP servers can use a versatile net.Listener and the UDP server are limited to a *UDPConn.
Ah, dang. Would a similar wrapper type work for net.PacketConn instead of for a net.UDPConn? (In other words, we just switch the wrapper type to be for PacketConn.)
Iām leaning towards ServePacket and ListenPacket to be added as well to the interface. I can prolly glue stuff back together in ServerNew or MakeServers.
Hey @miekg, just wanted to check up and see if there was anything else that needed to change to make the DNS plugin work before I release 0.9. I know youāre busy but I just thought Iād check in anyway, since there were still one or two unanswered questions. (I havenāt had a chance to look into PacketConn.)
Busy and travelling, lost week Boston, now in Zurich. Havenāt touched the code once
If you are delaying 0.9 because of me, donāt (but do make clear this plugin stuff might change).
OK. update: this new repo https://github.com/miekg/caddy-coredns contains the current work. I needed to start afresh - doing this as a branch in coredns meant I needed to port too many things at once - hence a new start.
This has one middleware: reflect, that will be hardcoded as there is no config parsing. The README.md lists the next steps. The first ones for me will be: get a binary that calls my new code, make the server start up and listen to TCP, get a reply from the reflect middleware.
Only then I can check the whole UDP vs TCP story.
Just use Caddy! No need for your own main; you can nuke your whole coredns folder I think. All you have to do is import your caddydns package from run.go:
import (
// ...
// this imports the DNS server type and default plugins/directives
_ "github.com/miekg/caddy-coredns/caddydns"
)
Then run Caddy:
$ caddy -type=dns
Where the Caddyfile in that directory is for CoreDNS.
As for the IP address that itās binding to, it probably comes from this line here.