constants.go 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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. )
  81. // Destination forwarding methods
  82. const (
  83. // ConnectionFlagFwdmask indicates the mask in the connection
  84. // flags which is used by forwarding method bits.
  85. ConnectionFlagFwdMask = 0x0007
  86. // ConnectionFlagMasq is used for masquerade forwarding method.
  87. ConnectionFlagMasq = 0x0000
  88. // ConnectionFlagLocalNode is used for local node forwarding
  89. // method.
  90. ConnectionFlagLocalNode = 0x0001
  91. // ConnectionFlagTunnel is used for tunnel mode forwarding
  92. // method.
  93. ConnectionFlagTunnel = 0x0002
  94. // ConnectionFlagDirectRoute is used for direct routing
  95. // forwarding method.
  96. ConnectionFlagDirectRoute = 0x0003
  97. )
  98. const (
  99. // RoundRobin distributes jobs equally amongst the available
  100. // real servers.
  101. RoundRobin = "rr"
  102. // LeastConnection assigns more jobs to real servers with
  103. // fewer active jobs.
  104. LeastConnection = "lc"
  105. // DestinationHashing assigns jobs to servers through looking
  106. // up a statically assigned hash table by their destination IP
  107. // addresses.
  108. DestinationHashing = "dh"
  109. // SourceHashing assigns jobs to servers through looking up
  110. // a statically assigned hash table by their source IP
  111. // addresses.
  112. SourceHashing = "sh"
  113. )