constants.go 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. // +build linux
  2. package ipvs
  3. const (
  4. genlCtrlID = 0x10
  5. )
  6. // GENL control commands
  7. const (
  8. genlCtrlCmdUnspec uint8 = iota
  9. genlCtrlCmdNewFamily
  10. genlCtrlCmdDelFamily
  11. genlCtrlCmdGetFamily
  12. )
  13. // GENL family attributes
  14. const (
  15. genlCtrlAttrUnspec int = iota
  16. genlCtrlAttrFamilyID
  17. genlCtrlAttrFamilyName
  18. )
  19. // IPVS genl commands
  20. const (
  21. ipvsCmdUnspec uint8 = iota
  22. ipvsCmdNewService
  23. ipvsCmdSetService
  24. ipvsCmdDelService
  25. ipvsCmdGetService
  26. ipvsCmdNewDest
  27. ipvsCmdSetDest
  28. ipvsCmdDelDest
  29. ipvsCmdGetDest
  30. ipvsCmdNewDaemon
  31. ipvsCmdDelDaemon
  32. ipvsCmdGetDaemon
  33. ipvsCmdSetConfig
  34. ipvsCmdGetConfig
  35. ipvsCmdSetInfo
  36. ipvsCmdGetInfo
  37. ipvsCmdZero
  38. ipvsCmdFlush
  39. )
  40. // Attributes used in the first level of commands
  41. const (
  42. ipvsCmdAttrUnspec int = iota
  43. ipvsCmdAttrService
  44. ipvsCmdAttrDest
  45. ipvsCmdAttrDaemon
  46. ipvsCmdAttrTimeoutTCP
  47. ipvsCmdAttrTimeoutTCPFin
  48. ipvsCmdAttrTimeoutUDP
  49. )
  50. // Attributes used to describe a service. Used inside nested attribute
  51. // ipvsCmdAttrService
  52. const (
  53. ipvsSvcAttrUnspec int = iota
  54. ipvsSvcAttrAddressFamily
  55. ipvsSvcAttrProtocol
  56. ipvsSvcAttrAddress
  57. ipvsSvcAttrPort
  58. ipvsSvcAttrFWMark
  59. ipvsSvcAttrSchedName
  60. ipvsSvcAttrFlags
  61. ipvsSvcAttrTimeout
  62. ipvsSvcAttrNetmask
  63. ipvsSvcAttrStats
  64. ipvsSvcAttrPEName
  65. )
  66. // Attributes used to describe a destination (real server). Used
  67. // inside nested attribute ipvsCmdAttrDest.
  68. const (
  69. ipvsDestAttrUnspec int = iota
  70. ipvsDestAttrAddress
  71. ipvsDestAttrPort
  72. ipvsDestAttrForwardingMethod
  73. ipvsDestAttrWeight
  74. ipvsDestAttrUpperThreshold
  75. ipvsDestAttrLowerThreshold
  76. ipvsDestAttrActiveConnections
  77. ipvsDestAttrInactiveConnections
  78. ipvsDestAttrPersistentConnections
  79. ipvsDestAttrStats
  80. ipvsDestAttrAddressFamily
  81. )
  82. // IPVS Svc Statistics constancs
  83. const (
  84. ipvsSvcStatsUnspec int = iota
  85. ipvsSvcStatsConns
  86. ipvsSvcStatsPktsIn
  87. ipvsSvcStatsPktsOut
  88. ipvsSvcStatsBytesIn
  89. ipvsSvcStatsBytesOut
  90. ipvsSvcStatsCPS
  91. ipvsSvcStatsPPSIn
  92. ipvsSvcStatsPPSOut
  93. ipvsSvcStatsBPSIn
  94. ipvsSvcStatsBPSOut
  95. )
  96. // Destination forwarding methods
  97. const (
  98. // ConnectionFlagFwdmask indicates the mask in the connection
  99. // flags which is used by forwarding method bits.
  100. ConnectionFlagFwdMask = 0x0007
  101. // ConnectionFlagMasq is used for masquerade forwarding method.
  102. ConnectionFlagMasq = 0x0000
  103. // ConnectionFlagLocalNode is used for local node forwarding
  104. // method.
  105. ConnectionFlagLocalNode = 0x0001
  106. // ConnectionFlagTunnel is used for tunnel mode forwarding
  107. // method.
  108. ConnectionFlagTunnel = 0x0002
  109. // ConnectionFlagDirectRoute is used for direct routing
  110. // forwarding method.
  111. ConnectionFlagDirectRoute = 0x0003
  112. )
  113. const (
  114. // RoundRobin distributes jobs equally amongst the available
  115. // real servers.
  116. RoundRobin = "rr"
  117. // LeastConnection assigns more jobs to real servers with
  118. // fewer active jobs.
  119. LeastConnection = "lc"
  120. // DestinationHashing assigns jobs to servers through looking
  121. // up a statically assigned hash table by their destination IP
  122. // addresses.
  123. DestinationHashing = "dh"
  124. // SourceHashing assigns jobs to servers through looking up
  125. // a statically assigned hash table by their source IP
  126. // addresses.
  127. SourceHashing = "sh"
  128. // WeightedRoundRobin assigns jobs to real servers proportionally
  129. // to there real servers' weight. Servers with higher weights
  130. // receive new jobs first and get more jobs than servers
  131. // with lower weights. Servers with equal weights get
  132. // an equal distribution of new jobs
  133. WeightedRoundRobin = "wrr"
  134. // WeightedLeastConnection assigns more jobs to servers
  135. // with fewer jobs and relative to the real servers' weight
  136. WeightedLeastConnection = "wlc"
  137. )
  138. const (
  139. // ConnFwdMask is a mask for the fwd methods
  140. ConnFwdMask = 0x0007
  141. // ConnFwdMasq denotes forwarding via masquerading/NAT
  142. ConnFwdMasq = 0x0000
  143. // ConnFwdLocalNode denotes forwarding to a local node
  144. ConnFwdLocalNode = 0x0001
  145. // ConnFwdTunnel denotes forwarding via a tunnel
  146. ConnFwdTunnel = 0x0002
  147. // ConnFwdDirectRoute denotes forwarding via direct routing
  148. ConnFwdDirectRoute = 0x0003
  149. // ConnFwdBypass denotes forwarding while bypassing the cache
  150. ConnFwdBypass = 0x0004
  151. )