func (b TCP) SetDestinationPort(port uint16) {
	binary.BigEndian.PutUint16(b[dstPort:], port)
}
SetDestinationPort sets the "destination port" field of the tcp header.
package header
import (
	"encoding/binary"
	tcpip "github.com/brewlin/net-protocol/protocol"
	"github.com/brewlin/net-protocol/pkg/seqnum"
)
const (
	srcPort     = 0
	dstPort     = 2
	seqNum      = 4
	ackNum      = 8
	dataOffset  = 12
	tcpFlags    = 13
	winSize     = 14
	tcpChecksum = 16
	urgentPtr   = 18
)
const (
	MaxWndScale = 14
	TCPMaxSACKBlocks = 4
)
const (
	TCPFlagFin = 1 << iota
	TCPFlagSyn
	TCPFlagRst
	TCPFlagPsh
	TCPFlagAck
	TCPFlagUrg
)
const (
	TCPOptionEOL           = 0
	TCPOptionNOP           = 1
	TCPOptionMSS           = 2
	TCPOptionWS            = 3
	TCPOptionTS            = 8
	TCPOptionSACKPermitted = 4
	TCPOptionSACK          = 5
)
type TCPFields struct {
	SrcPort uint16
	DstPort uint16
	SeqNum uint32
	AckNum uint32
	DataOffset uint8
	Flags uint8
	WindowSize uint16
	Checksum uint16
	UrgentPointer uint16
}
type TCPSynOptions struct {
	MSS uint16
	WS int
	TS bool
	TSVal uint32
	TSEcr uint32
	SACKPermitted bool
}
type SACKBlock struct {
	Start seqnum.Value
	End seqnum.Value
}
type TCPOptions struct {
	TS bool
	TSVal uint32
	TSEcr uint32
	SACKBlocks []SACKBlock
}
type TCP []byte
const (
	TCPMinimumSize = 20
	TCPProtocolNumber tcpip.TransportProtocolNumber = 6
)
func (b TCP) SourcePort() uint16 {
	return binary.BigEndian.Uint16(b[srcPort:])
}
func (b TCP) DestinationPort() uint16 {
	return binary.BigEndian.Uint16(b[dstPort:])
}
func (b TCP) SequenceNumber() uint32 {
	return binary.BigEndian.Uint32(b[seqNum:])
}
func (b TCP) AckNumber() uint32 {
	return binary.BigEndian.Uint32(b[ackNum:])
}
func (b TCP) DataOffset() uint8 {
	return (b[dataOffset] >> 4) * 4
}
func (b TCP) Payload() []byte {
	return b[b.DataOffset():]
}
func (b TCP) Flags() uint8 {
	return b[tcpFlags]
}
func (b TCP) WindowSize() uint16 {
	return binary.BigEndian.Uint16(b[winSize:])
}
func (b TCP) Checksum() uint16 {
	return binary.BigEndian.Uint16(b[tcpChecksum:])
}
func (b TCP) SetSourcePort(port uint16) {
	binary.BigEndian.PutUint16(b[srcPort:], port)
}