mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-25 06:25:44 +03:00
ae8de95d89
Merge in DNS/adguard-home from 2234-move-to-internal to master Squashed commit of the following: commit d26a288cabeac86f9483fab307677b1027c78524 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Oct 30 12:44:18 2020 +0300 * all: move internal Go packages to internal/ Closes #2234.
31 lines
1.1 KiB
Go
31 lines
1.1 KiB
Go
package dhcpd
|
|
|
|
import (
|
|
"bytes"
|
|
"net"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestRA(t *testing.T) {
|
|
ra := icmpv6RA{
|
|
managedAddressConfiguration: false,
|
|
otherConfiguration: true,
|
|
mtu: 1500,
|
|
prefix: net.ParseIP("1234::"),
|
|
prefixLen: 64,
|
|
recursiveDNSServer: net.ParseIP("fe80::800:27ff:fe00:0"),
|
|
sourceLinkLayerAddress: []byte{0x0a, 0x00, 0x27, 0x00, 0x00, 0x00},
|
|
}
|
|
data := createICMPv6RAPacket(ra)
|
|
dataCorrect := []byte{
|
|
0x86, 0x00, 0x00, 0x00, 0x40, 0x40, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x03, 0x04, 0x40, 0xc0, 0x00, 0x00, 0x0e, 0x10, 0x00, 0x00, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00,
|
|
0x12, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x05, 0x01, 0x00, 0x00, 0x00, 0x00, 0x05, 0xdc, 0x01, 0x01, 0x0a, 0x00, 0x27, 0x00, 0x00, 0x00,
|
|
0x19, 0x03, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x10, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x08, 0x00, 0x27, 0xff, 0xfe, 0x00, 0x00, 0x00,
|
|
}
|
|
assert.True(t, bytes.Equal(data, dataCorrect))
|
|
}
|