github.com/GeniusesGroup/libgo@v0.0.0-20220929090155-5ff932cb408e/tcp/option.go (about)

     1  /* For license and copyright information please see the LEGAL file in the code repository */
     2  
     3  package tcp
     4  
     5  /*
     6  type option struct {
     7  	Kind    byte
     8  	Payload []byte // Can be nil in some kinds
     9  }
    10  */
    11  type Options []byte
    12  
    13  func (o Options) Kind() optionKind { return optionKind(o[0]) }
    14  func (o Options) Payload() []byte  { return o[1:] }
    15  
    16  // OptionKind represents a TCP option kind code.
    17  type optionKind byte
    18  
    19  // https://www.iana.org/assignments/tcp-parameters/tcp-parameters.xhtml
    20  // https://datatracker.ietf.org/doc/html/rfc4413#section-4.3.1
    21  const (
    22  	OptionKind_EndList optionKind = iota
    23  	OptionKind_Nop
    24  	OptionKind_MSS                             // len = 4, Maximum Segment Size
    25  	OptionKind_WindowScale                     // len = 3
    26  	OptionKind_SACKPermitted                   // len = 2
    27  	OptionKind_SACK                            // len = n
    28  	OptionKind_Echo                            // len = 6, obsolete
    29  	OptionKind_EchoReply                       // len = 6, obsolete
    30  	OptionKind_Timestamps                      // len = 10
    31  	OptionKind_PartialOrderConnectionPermitted // len = 2, obsolete
    32  	OptionKind_PartialOrderServiceProfile      // len = 3, obsolete
    33  	OptionKind_CC                              // obsolete
    34  	OptionKind_CCNew                           // obsolete
    35  	OptionKind_CCEcho                          // obsolete
    36  	OptionKind_AltChecksum                     // len = 3, obsolete
    37  	OptionKind_AltChecksumData                 // len = n, obsolete
    38  )