package peer

/*
func TestIFReader_IPv4(t *testing.T) {
	p1, p2, _ := NewPeersForTesting()

	pkt := make([]byte, 1234)
	pkt[0] = 4 << 4
	pkt[19] = 2 // IP.

	p1.IFace.UserWrite(pkt)
	p1.IFReader.handleNextPacket(newBuf())

	packets := p2.Conn.Packets()
	if len(packets) != 1 {
		t.Fatal(packets)
	}
}

func TestIFReader_IPv6(t *testing.T) {
	p1, p2, _ := NewPeersForTesting()

	pkt := make([]byte, 1234)
	pkt[0] = 6 << 4
	pkt[39] = 2 // IP.

	p1.IFace.UserWrite(pkt)
	p1.IFReader.handleNextPacket(newBuf())

	packets := p2.Conn.Packets()
	if len(packets) != 1 {
		t.Fatal(packets)
	}
}

func TestIFReader_parsePacket_emptyPacket(t *testing.T) {
	r := NewIFReader(nil, nil)
	pkt := make([]byte, 0)
	if ip, ok := r.parsePacket(pkt); ok {
		t.Fatal(ip, ok)
	}
}

func TestIFReader_parsePacket_invalidIPVersion(t *testing.T) {
	r := NewIFReader(nil, nil)

	for i := byte(1); i < 16; i++ {
		if i == 4 || i == 6 {
			continue
		}
		pkt := make([]byte, 1234)
		pkt[0] = i << 4

		if ip, ok := r.parsePacket(pkt); ok {
			t.Fatal(i, ip, ok)
		}
	}
}

func TestIFReader_parsePacket_shortIPv4(t *testing.T) {
	r := NewIFReader(nil, nil)

	pkt := make([]byte, 19)
	pkt[0] = 4 << 4

	if ip, ok := r.parsePacket(pkt); ok {
		t.Fatal(ip, ok)
	}
}

func TestIFReader_parsePacket_shortIPv6(t *testing.T) {
	r := NewIFReader(nil, nil)

	pkt := make([]byte, 39)
	pkt[0] = 6 << 4

	if ip, ok := r.parsePacket(pkt); ok {
		t.Fatal(ip, ok)
	}
}
*/
