wgengine/tsdns: add test and prevent useless updates (#449)

Signed-Off-By: Dmytro Shynkevych <dmytro@tailscale.com>
This commit is contained in:
Dmytro Shynkevych
2020-06-09 13:09:43 -04:00
committed by GitHub
parent 511840b1f6
commit 07e02ec9d3
4 changed files with 329 additions and 48 deletions

View File

@ -242,16 +242,19 @@ func (q *ParsedPacket) UDPHeader() UDPHeader {
}
// Buffer returns the entire packet buffer.
// This is a read-only view; that is, q retains the ownership of the buffer.
func (q *ParsedPacket) Buffer() []byte {
return q.b
}
// Sub returns the IP subprotocol section.
// This is a read-only view; that is, q retains the ownership of the buffer.
func (q *ParsedPacket) Sub(begin, n int) []byte {
return q.b[q.subofs+begin : q.subofs+begin+n]
}
// Payload returns the payload of the IP subprotocol section.
// This is a read-only view; that is, q retains the ownership of the buffer.
func (q *ParsedPacket) Payload() []byte {
return q.b[q.dataofs:q.length]
}