func (p *protocol) MinimumPacketSize() int {
	return header.IPv6MinimumSize
}
MinimumPacketSize returns the minimum valid ipv6 packet size.
package ipv6
import (
	tcpip "github.com/brewlin/net-protocol/protocol"
	"github.com/brewlin/net-protocol/pkg/buffer"
	"github.com/brewlin/net-protocol/protocol/header"
	"github.com/brewlin/net-protocol/stack"
)
const (
	ProtocolName = "ipv6"
	ProtocolNumber = header.IPv6ProtocolNumber
	maxPayloadSize = 0xffff
	defaultIPv6HopLimit = 255
)
type endpoint struct {
	nicid         tcpip.NICID
	id            stack.NetworkEndpointID
	linkEP        stack.LinkEndpoint
	linkAddrCache stack.LinkAddressCache
	dispatcher    stack.TransportDispatcher
}
func (e *endpoint) DefaultTTL() uint8 {
	return 255
}
func (e *endpoint) MTU() uint32 {
	return calculateMTU(e.linkEP.MTU())
}
func (e *endpoint) NICID() tcpip.NICID {
	return e.nicid
}
func (e *endpoint) ID() *stack.NetworkEndpointID {
	return &e.id
}
func (e *endpoint) Capabilities() stack.LinkEndpointCapabilities {
	return e.linkEP.Capabilities()
}
func (e *endpoint) MaxHeaderLength() uint16 {
	return e.linkEP.MaxHeaderLength() + header.IPv6MinimumSize
}
func (e *endpoint) WritePacket(r *stack.Route, hdr buffer.Prependable, payload buffer.VectorisedView, protocol tcpip.TransportProtocolNumber, ttl uint8) *tcpip.Error {
	length := uint16(hdr.UsedLength() + payload.Size())
	ip := header.IPv6(hdr.Prepend(header.IPv6MinimumSize))
	ip.Encode(&header.IPv6Fields{
		PayloadLength: length,
		NextHeader:    uint8(protocol),
		HopLimit:      ttl,
		SrcAddr:       r.LocalAddress,
		DstAddr:       r.RemoteAddress,
	})
	r.Stats().IP.PacketsSent.Increment()
	return e.linkEP.WritePacket(r, hdr, payload, ProtocolNumber)
}
func (e *endpoint) HandlePacket(r *stack.Route, vv buffer.VectorisedView) {
	h := header.IPv6(vv.First())
	if !h.IsValid(vv.Size()) {
		return
	}
	vv.TrimFront(header.IPv6MinimumSize)
	vv.CapLength(int(h.PayloadLength()))
	p := h.TransportProtocol()
	if p == header.ICMPv6ProtocolNumber {
		e.handleICMP(r, vv)
		return
	}
	r.Stats().IP.PacketsDelivered.Increment()
	e.dispatcher.DeliverTransportPacket(r, p, vv)
}
func (*endpoint) Close() {}
type protocol struct{}
func NewProtocol() stack.NetworkProtocol {
	return &protocol{}
}
func (p *protocol) Number() tcpip.NetworkProtocolNumber {
	return ProtocolNumber
}