Commit graph

14 commits

Author SHA1 Message Date
Miek Gieben
d1f17fa7e0 Cleanup: put middleware helper functions in pkgs (#245)
Move all (almost all) Go files in middleware into their
own packages. This makes for better naming and discoverability.

Lot of changes elsewhere to make this change.

The middleware.State was renamed to request.Request which is better,
but still does not cover all use-cases. It was also moved out middleware
because it is used by `dnsserver` as well.

A pkg/dnsutil packages was added for shared, handy, dns util functions.

All normalize functions are now put in normalize.go
2016-09-07 11:10:16 +01:00
Miek Gieben
c30671f4c0 Allow debug queries to etcd middleware (#150)
With this you can retreive the raw data that the etcd middleware
used to create the reply. The debug data is put in TXT records
that are stuffed in the CH classs. This is only enabled if you
specify `debug` in the etcd stanza.

You can retrieve it by prefixing your query with 'o-o.debug.'
For instance:

; <<>> DiG 9.10.3-P4-Ubuntu <<>> @localhost -p 1053 SRV o-o.debug.production.*.skydns.local
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 47798
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 3

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;o-o.debug.production.*.skydns.local. IN	SRV

;; ANSWER SECTION:
production.*.skydns.local. 154	IN	SRV	10 50 8080 service1.example.com.
production.*.skydns.local. 154	IN	SRV	10 50 8080 service2.example.com.

;; ADDITIONAL SECTION:
skydns.local.skydns.east.production.rails.1. 154 CH TXT	"service1.example.com:8080(10,0,,false)[0,]"
skydns.local.skydns.west.production.rails.2. 154 CH TXT	"service2.example.com:8080(10,0,,false)[0,]"
2016-05-22 21:16:26 +01:00
Miek Gieben
e635b4e773 middleware/proxy: multiple enhancements (#145)
Add port 53 in the proxy host if not specified.
Check if the host is actually an IP address (v4 or v6)
Remove the http headers and other TODOs
2016-04-30 15:54:41 +01:00
Miek Gieben
1aa1a92198 Add middleware/dnssec (#133)
This adds an online dnssec middleware. The middleware will sign
responses on the fly. Negative responses are signed with NSEC black
lies.
2016-04-26 17:57:11 +01:00
Miek Gieben
27ff83e70f Stub forward/proxy tests (#108)
Test the handling of EDNS0 payloads and forwarding to stubzones
servers.
2016-04-12 21:30:08 +01:00
Miek Gieben
ad221f4b2a correct EDNS responses (#96)
Tests updated as well and all the middleware. And Prometheus renamed to
metrics (directive is still prometheus).
2016-04-09 16:17:53 +01:00
Miek Gieben
e4c72719bf Test and fix notify
More tests and add RemoteAddr to State, prolly LocalAddr will be

useful as well.

Fixed and tested IsNotify method.
2016-04-07 07:42:58 +01:00
Miek Gieben
45ac2dd0c0 Small documenation updates 2016-04-04 09:10:07 +00:00
Miek Gieben
84dfdab584 Cache elements of State
Cache the size and the do bit whenever someone asked for it. We can

probably add more:



PASS

BenchmarkStateDo-4  	100000000	        11.9 ns/op

BenchmarkStateSize-4	 5000000	       265 ns/op

ok  	github.com/miekg/coredns/middleware	2.828s



PASS

BenchmarkStateDo-4  	1000000000	         2.86 ns/op

BenchmarkStateSize-4	500000000	         3.10 ns/op

ok  	github.com/miekg/coredns/middleware	5.032s



This PR also includes some testing cleanups as well.
2016-04-04 08:19:06 +01:00
Miek Gieben
5387c162c9 Implement a DNS zone
Full implementation, DNS (and in the future DNSSEC). Returns answer in a
hopefully standards compliant way.
Testing with my miek.nl zone are included as well.
This should correctly handle nodata, nxdomain and cnames.
2016-03-28 10:15:05 +01:00
Miek Gieben
90f73c50cf Add Scrub function
This function will make the message fit for the client's buffer, or
set the TC bit.
2016-03-26 09:26:54 +00:00
Miek Gieben
16e50ec5f8 Add state.SizeAndDo()
This methods returns an OPT record which can be used to create a new
message with the same bufsize and Do bit as the original one.
2016-03-25 17:23:06 +00:00
Miek Gieben
b6341e8b63 more etcd stuff 2016-03-20 21:36:55 +00:00
Miek Gieben
f907311cdf Use context.Context
Rename the old Context to State and use context.Context in the
middleware for intra-middleware communication and more.
2016-03-19 07:32:50 +00:00
Renamed from middleware/context.go (Browse further)