mirror of
https://github.com/miekg/dns.git
synced 2025-08-17 15:06:57 +02:00
some minor tweaks
This commit is contained in:
parent
38d15b76e2
commit
9330f16c5c
@ -20,7 +20,7 @@ func NewFunkenSturm() *FunkenSturm {
|
||||
f.Default = send
|
||||
|
||||
f.Funk = make([]*Funk, 1) // 1 Funk chain
|
||||
f.Funk[0] = NewFunk()
|
||||
f.Funk[0] = new(Funk)
|
||||
f.Funk[0].Match = func(m *dns.Msg) (*dns.Msg, bool) { return m, true }
|
||||
f.Funk[0].Action = send
|
||||
return f
|
||||
|
@ -52,7 +52,7 @@ func NewFunkenSturm() *FunkenSturm {
|
||||
f.Setup = func() bool { previous = time.Nanoseconds(); return true }
|
||||
|
||||
f.Funk = make([]*Funk, 1)
|
||||
f.Funk[0] = NewFunk()
|
||||
f.Funk[0] = new(Funk)
|
||||
f.Funk[0].Match = match
|
||||
f.Funk[0].Action = delay
|
||||
return f
|
||||
|
@ -91,7 +91,7 @@ func NewFunkenSturm() *FunkenSturm {
|
||||
f := new(FunkenSturm)
|
||||
f.Funk = make([]*Funk, 1)
|
||||
f.Setup = func() bool { cache = NewCache(); return true }
|
||||
f.Funk[0] = NewFunk()
|
||||
f.Funk[0] = new(Funk)
|
||||
f.Funk[0].Match = func(m *dns.Msg) (*dns.Msg, bool) { return m, true }
|
||||
f.Funk[0].Action = checkcache
|
||||
return f
|
||||
|
@ -76,11 +76,12 @@ Activate: 20110122104659`
|
||||
// Return the configration
|
||||
func NewFunkenSturm() *FunkenSturm {
|
||||
f := new(FunkenSturm)
|
||||
f.Funk = make([]*Funk, 1) // 1 Chain
|
||||
f.Funk = make([]*Funk, 1)
|
||||
f.Setup = setup
|
||||
f.Default = send
|
||||
|
||||
f.Funk[0] = NewFunk(1)
|
||||
f.Funk[0].Matches[0].Func = match
|
||||
f.Funk[0] = new(Funk)
|
||||
f.Funk[0].Match = func(m *dns.Msg) (*dns.Msg, bool) { return m, m.Question[0].Name == "www.example.org." }
|
||||
f.Funk[0].Action = send
|
||||
return f
|
||||
}
|
||||
|
@ -35,11 +35,6 @@ type Funk struct {
|
||||
Action func(*dns.Msg) []byte
|
||||
}
|
||||
|
||||
func NewFunk() *Funk {
|
||||
f := new(Funk)
|
||||
return f
|
||||
}
|
||||
|
||||
// Hold the information.
|
||||
type FunkenSturm struct {
|
||||
Setup func() bool // Inital setup (for extra resolvers, or loading keys, or ...)
|
||||
@ -60,6 +55,10 @@ func doFunkenSturm(pkt *dns.Msg) (ret []byte) {
|
||||
return
|
||||
}
|
||||
}
|
||||
if f.Default == nil {
|
||||
println("No f.Default set!")
|
||||
return
|
||||
}
|
||||
ret = f.Default(pkt)
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user