mirror of
https://github.com/miekg/dns.git
synced 2025-08-17 23:16:58 +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.Default = send
|
||||||
|
|
||||||
f.Funk = make([]*Funk, 1) // 1 Funk chain
|
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].Match = func(m *dns.Msg) (*dns.Msg, bool) { return m, true }
|
||||||
f.Funk[0].Action = send
|
f.Funk[0].Action = send
|
||||||
return f
|
return f
|
||||||
|
@ -52,7 +52,7 @@ func NewFunkenSturm() *FunkenSturm {
|
|||||||
f.Setup = func() bool { previous = time.Nanoseconds(); return true }
|
f.Setup = func() bool { previous = time.Nanoseconds(); return true }
|
||||||
|
|
||||||
f.Funk = make([]*Funk, 1)
|
f.Funk = make([]*Funk, 1)
|
||||||
f.Funk[0] = NewFunk()
|
f.Funk[0] = new(Funk)
|
||||||
f.Funk[0].Match = match
|
f.Funk[0].Match = match
|
||||||
f.Funk[0].Action = delay
|
f.Funk[0].Action = delay
|
||||||
return f
|
return f
|
||||||
|
@ -91,7 +91,7 @@ func NewFunkenSturm() *FunkenSturm {
|
|||||||
f := new(FunkenSturm)
|
f := new(FunkenSturm)
|
||||||
f.Funk = make([]*Funk, 1)
|
f.Funk = make([]*Funk, 1)
|
||||||
f.Setup = func() bool { cache = NewCache(); return true }
|
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].Match = func(m *dns.Msg) (*dns.Msg, bool) { return m, true }
|
||||||
f.Funk[0].Action = checkcache
|
f.Funk[0].Action = checkcache
|
||||||
return f
|
return f
|
||||||
|
@ -26,7 +26,7 @@ func sign(m *dns.Msg) *dns.Msg {
|
|||||||
sg.TypeCovered = an.Header().Rrtype
|
sg.TypeCovered = an.Header().Rrtype
|
||||||
sg.Labels = dns.Labels(an.Header().Name)
|
sg.Labels = dns.Labels(an.Header().Name)
|
||||||
sg.OrigTtl = an.Header().Ttl
|
sg.OrigTtl = an.Header().Ttl
|
||||||
switch p:=privkey.(type) {
|
switch p := privkey.(type) {
|
||||||
case *rsa.PrivateKey:
|
case *rsa.PrivateKey:
|
||||||
sg.Sign(p, []dns.RR{an})
|
sg.Sign(p, []dns.RR{an})
|
||||||
}
|
}
|
||||||
@ -76,11 +76,12 @@ Activate: 20110122104659`
|
|||||||
// Return the configration
|
// Return the configration
|
||||||
func NewFunkenSturm() *FunkenSturm {
|
func NewFunkenSturm() *FunkenSturm {
|
||||||
f := new(FunkenSturm)
|
f := new(FunkenSturm)
|
||||||
f.Funk = make([]*Funk, 1) // 1 Chain
|
f.Funk = make([]*Funk, 1)
|
||||||
f.Setup = setup
|
f.Setup = setup
|
||||||
|
f.Default = send
|
||||||
|
|
||||||
f.Funk[0] = NewFunk(1)
|
f.Funk[0] = new(Funk)
|
||||||
f.Funk[0].Matches[0].Func = match
|
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
|
f.Funk[0].Action = send
|
||||||
return f
|
return f
|
||||||
}
|
}
|
||||||
|
@ -35,11 +35,6 @@ type Funk struct {
|
|||||||
Action func(*dns.Msg) []byte
|
Action func(*dns.Msg) []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewFunk() *Funk {
|
|
||||||
f := new(Funk)
|
|
||||||
return f
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hold the information.
|
// Hold the information.
|
||||||
type FunkenSturm struct {
|
type FunkenSturm struct {
|
||||||
Setup func() bool // Inital setup (for extra resolvers, or loading keys, or ...)
|
Setup func() bool // Inital setup (for extra resolvers, or loading keys, or ...)
|
||||||
@ -60,6 +55,10 @@ func doFunkenSturm(pkt *dns.Msg) (ret []byte) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if f.Default == nil {
|
||||||
|
println("No f.Default set!")
|
||||||
|
return
|
||||||
|
}
|
||||||
ret = f.Default(pkt)
|
ret = f.Default(pkt)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user