github.com/zhuohuang-hust/src-cbuild@v0.0.0-20230105071821-c7aab3e7c840/mergeCode/libnetwork/ipvs/constants.go (about)

     1  // +build linux
     2  
     3  package ipvs
     4  
     5  const (
     6  	genlCtrlID = 0x10
     7  )
     8  
     9  // GENL control commands
    10  const (
    11  	genlCtrlCmdUnspec uint8 = iota
    12  	genlCtrlCmdNewFamily
    13  	genlCtrlCmdDelFamily
    14  	genlCtrlCmdGetFamily
    15  )
    16  
    17  // GENL family attributes
    18  const (
    19  	genlCtrlAttrUnspec int = iota
    20  	genlCtrlAttrFamilyID
    21  	genlCtrlAttrFamilyName
    22  )
    23  
    24  // IPVS genl commands
    25  const (
    26  	ipvsCmdUnspec uint8 = iota
    27  	ipvsCmdNewService
    28  	ipvsCmdSetService
    29  	ipvsCmdDelService
    30  	ipvsCmdGetService
    31  	ipvsCmdNewDest
    32  	ipvsCmdSetDest
    33  	ipvsCmdDelDest
    34  	ipvsCmdGetDest
    35  	ipvsCmdNewDaemon
    36  	ipvsCmdDelDaemon
    37  	ipvsCmdGetDaemon
    38  	ipvsCmdSetConfig
    39  	ipvsCmdGetConfig
    40  	ipvsCmdSetInfo
    41  	ipvsCmdGetInfo
    42  	ipvsCmdZero
    43  	ipvsCmdFlush
    44  )
    45  
    46  // Attributes used in the first level of commands
    47  const (
    48  	ipvsCmdAttrUnspec int = iota
    49  	ipvsCmdAttrService
    50  	ipvsCmdAttrDest
    51  	ipvsCmdAttrDaemon
    52  	ipvsCmdAttrTimeoutTCP
    53  	ipvsCmdAttrTimeoutTCPFin
    54  	ipvsCmdAttrTimeoutUDP
    55  )
    56  
    57  // Attributes used to describe a service. Used inside nested attribute
    58  // ipvsCmdAttrService
    59  const (
    60  	ipvsSvcAttrUnspec int = iota
    61  	ipvsSvcAttrAddressFamily
    62  	ipvsSvcAttrProtocol
    63  	ipvsSvcAttrAddress
    64  	ipvsSvcAttrPort
    65  	ipvsSvcAttrFWMark
    66  	ipvsSvcAttrSchedName
    67  	ipvsSvcAttrFlags
    68  	ipvsSvcAttrTimeout
    69  	ipvsSvcAttrNetmask
    70  	ipvsSvcAttrStats
    71  	ipvsSvcAttrPEName
    72  )
    73  
    74  // Attributes used to describe a destination (real server). Used
    75  // inside nested attribute ipvsCmdAttrDest.
    76  const (
    77  	ipvsDestAttrUnspec int = iota
    78  	ipvsDestAttrAddress
    79  	ipvsDestAttrPort
    80  	ipvsDestAttrForwardingMethod
    81  	ipvsDestAttrWeight
    82  	ipvsDestAttrUpperThreshold
    83  	ipvsDestAttrLowerThreshold
    84  	ipvsDestAttrActiveConnections
    85  	ipvsDestAttrInactiveConnections
    86  	ipvsDestAttrPersistentConnections
    87  	ipvsDestAttrStats
    88  )
    89  
    90  // Destination forwarding methods
    91  const (
    92  	// ConnectionFlagFwdmask indicates the mask in the connection
    93  	// flags which is used by forwarding method bits.
    94  	ConnectionFlagFwdMask = 0x0007
    95  
    96  	// ConnectionFlagMasq is used for masquerade forwarding method.
    97  	ConnectionFlagMasq = 0x0000
    98  
    99  	// ConnectionFlagLocalNode is used for local node forwarding
   100  	// method.
   101  	ConnectionFlagLocalNode = 0x0001
   102  
   103  	// ConnectionFlagTunnel is used for tunnel mode forwarding
   104  	// method.
   105  	ConnectionFlagTunnel = 0x0002
   106  
   107  	// ConnectionFlagDirectRoute is used for direct routing
   108  	// forwarding method.
   109  	ConnectionFlagDirectRoute = 0x0003
   110  )
   111  
   112  const (
   113  	// RoundRobin distributes jobs equally amongst the available
   114  	// real servers.
   115  	RoundRobin = "rr"
   116  
   117  	// LeastConnection assigns more jobs to real servers with
   118  	// fewer active jobs.
   119  	LeastConnection = "lc"
   120  
   121  	// DestinationHashing assigns jobs to servers through looking
   122  	// up a statically assigned hash table by their destination IP
   123  	// addresses.
   124  	DestinationHashing = "dh"
   125  
   126  	// SourceHashing assigns jobs to servers through looking up
   127  	// a statically assigned hash table by their source IP
   128  	// addresses.
   129  	SourceHashing = "sh"
   130  )