mirror of
https://github.com/soypat/lneto.git
synced 2026-08-21 06:59:04 +00:00
DNS resolution working butter smooth
This commit is contained in:
+6
-6
@@ -65,12 +65,12 @@ func (c *Client) Encapsulate(carrierData []byte, frameOffset int) (int, error) {
|
||||
}
|
||||
c.state = dnsAwaitResponse
|
||||
// Unset don't frag since DNS requests go through LOTS of nodes.
|
||||
if frameOffset >= 28 {
|
||||
version := carrierData[0] >> 4
|
||||
if version == 4 {
|
||||
carrierData[6], carrierData[7] = 0, 0 // unset IP Flags.
|
||||
}
|
||||
}
|
||||
// if frameOffset >= 28 {
|
||||
// version := carrierData[0] >> 4
|
||||
// if version == 4 {
|
||||
// carrierData[6], carrierData[7] = 0, 0 // unset IP Flags.
|
||||
// }
|
||||
// }
|
||||
return len(data), nil
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -626,10 +626,10 @@ func (dst *Message) CopyFrom(m Message) {
|
||||
for i := range dst.Answers {
|
||||
dst.Answers[i].CopyFrom(m.Answers[i])
|
||||
}
|
||||
for i := range dst.Answers {
|
||||
for i := range dst.Authorities {
|
||||
dst.Authorities[i].CopyFrom(m.Authorities[i])
|
||||
}
|
||||
for i := range dst.Answers {
|
||||
for i := range dst.Additionals {
|
||||
dst.Additionals[i].CopyFrom(m.Additionals[i])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -221,3 +221,18 @@ func (m *Message) String() string {
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
func TestDecodeMessage(t *testing.T) {
|
||||
var data = []byte{
|
||||
0x84, 0x05, 0x81, 0x80, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x0b, 0x77, 0x68, 0x69,
|
||||
0x74, 0x74, 0x69, 0x6c, 0x65, 0x61, 0x6b, 0x73, 0x03, 0x63, 0x6f, 0x6d, 0x00, 0x00, 0x01, 0x00,
|
||||
0x01, 0xc0, 0x0c, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x1e, 0xaf, 0x00, 0x04, 0xc6, 0x31, 0x17,
|
||||
0x91, 0x00, 0x00, 0x29, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
}
|
||||
var msg Message
|
||||
msg.LimitResourceDecoding(5, 5, 5, 5)
|
||||
off, incomplete, err := msg.Decode(data)
|
||||
if incomplete || err != nil {
|
||||
t.Fatal(incomplete, err, off)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user