firewall.go 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. package adminModel
  2. import "gopkg.in/guregu/null.v4"
  3. type FirewallGlobalInfo struct {
  4. ID int64 `xorm:"id pk autoincr" json:"id"`
  5. Name string `xorm:"name"`
  6. Enable string `xorm:"enable"`
  7. }
  8. func (*FirewallGlobalInfo) TableName() string {
  9. return "t_firewall_global"
  10. }
  11. type FirewallAutoDefenceRuleVO struct {
  12. Name string `xorm:"name" json:"name"`
  13. Port int64 `xorm:"port" json:"port"`
  14. Protocol string `xorm:"protocol" json:"protocol"`
  15. PacketCount int64 `xorm:"packet_count" json:"packetCount"`
  16. Interval int64 `xorm:"time_interval" json:"interval"`
  17. }
  18. type FirewallAutoDefenceRule struct {
  19. ID int64 `xorm:"id pk autoincr" json:"id"`
  20. FirewallAutoDefenceRuleVO `xorm:"extends"`
  21. }
  22. func (*FirewallAutoDefenceRule) TableName() string {
  23. return "t_firewall_auto_defence"
  24. }
  25. type FirewallCommonRule struct {
  26. ID int64 `xorm:"id pk autoincr" json:"id"`
  27. Name null.String `xorm:"name" json:"name"`
  28. StartPort string `xorm:"start_port" json:"startPort"`
  29. EndPort string `xorm:"end_port" json:"endPort"`
  30. Protocol null.String `xorm:"protocol" json:"protocol"`
  31. Ip null.String `xorm:"ip" json:"ip"`
  32. Netmask null.String `xorm:"netmask" json:"netmask"`
  33. Mac null.String `xorm:"mac" json:"mac"`
  34. Action null.String `xorm:"rule_action" json:"action"`
  35. Priority int64 `xorm:"priority" json:"priority"`
  36. }
  37. func (*FirewallCommonRule) TableName() string {
  38. return " t_firewall_common"
  39. }
  40. type GeoipRule struct {
  41. ID int64 `xorm:"id pk autoincr" json:"id"`
  42. CountryName string `xorm:"country_name" json:"countryName"`
  43. }
  44. func (*GeoipRule) TableName() string {
  45. return " t_firewall_geoip"
  46. }
  47. type GeoIPNames struct {
  48. Names []GeoipRule `json:"names"`
  49. }
  50. type FailToBan struct {
  51. ID int64 `xorm:"id pk autoincr" json:"id"`
  52. Name string `xorm:"name" json:"name"`
  53. Enable bool `xorm:"enable" json:"enable"`
  54. MaxRetry int64 `xorm:"max_retry" json:"maxRetry"`
  55. FindTime int64 `xorm:"find_time" json:"findTime"`
  56. BanTime int64 `xorm:"ban_time" json:"banTime"`
  57. }
  58. func (*FailToBan) TableName() string {
  59. return " t_fail2ban_basic"
  60. }
  61. type FailToBanIgnored struct {
  62. ID int64 `xorm:"id pk autoincr" json:"id"`
  63. Name string `xorm:"name" json:"name"`
  64. Enable int `xorm:"enable" json:"enable"`
  65. Https int `xorm:"protocol_https" json:"https"`
  66. Iax int `xorm:"protocol_iax" json:"iax"`
  67. Sip int `xorm:"protocol_sip" json:"sip"`
  68. Ssh int `xorm:"protocol_ssh" json:"ssh"`
  69. Ip string `xorm:"ip" json:"ip"`
  70. Netmask string `xorm:"netmask" json:"netmask"`
  71. NetmaskLength int `xorm:"netmask_length"`
  72. }
  73. func (*FailToBanIgnored) TableName() string {
  74. return " t_fail2ban_ignored"
  75. }
  76. type UpdatePriority struct {
  77. Action string `json:"action"`
  78. ID int64 `json:"id"`
  79. }