gitee.com/ks-custle/core-gm@v0.0.0-20230922171213-b83bdd97b62c/net/ipv4/sockopt.go (about)

     1  // Copyright 2014 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package ipv4
     6  
     7  import "gitee.com/ks-custle/core-gm/net/internal/socket"
     8  
     9  // Sticky socket options
    10  const (
    11  	ssoTOS                = iota // header field for unicast packet
    12  	ssoTTL                       // header field for unicast packet
    13  	ssoMulticastTTL              // header field for multicast packet
    14  	ssoMulticastInterface        // outbound interface for multicast packet
    15  	ssoMulticastLoopback         // loopback for multicast packet
    16  	ssoReceiveTTL                // header field on received packet
    17  	ssoReceiveDst                // header field on received packet
    18  	ssoReceiveInterface          // inbound interface on received packet
    19  	ssoPacketInfo                // incbound or outbound packet path
    20  	ssoHeaderPrepend             // ipv4 header prepend
    21  	ssoStripHeader               // strip ipv4 header
    22  	ssoICMPFilter                // icmp filter
    23  	ssoJoinGroup                 // any-source multicast
    24  	ssoLeaveGroup                // any-source multicast
    25  	ssoJoinSourceGroup           // source-specific multicast
    26  	ssoLeaveSourceGroup          // source-specific multicast
    27  	ssoBlockSourceGroup          // any-source or source-specific multicast
    28  	ssoUnblockSourceGroup        // any-source or source-specific multicast
    29  	ssoAttachFilter              // attach BPF for filtering inbound traffic
    30  )
    31  
    32  // Sticky socket option value types
    33  const (
    34  	ssoTypeIPMreq = iota + 1
    35  	ssoTypeIPMreqn
    36  	ssoTypeGroupReq
    37  	ssoTypeGroupSourceReq
    38  )
    39  
    40  // A sockOpt represents a binding for sticky socket option.
    41  type sockOpt struct {
    42  	socket.Option
    43  	typ int // hint for option value type; optional
    44  }