webforwarding.go 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. package model
  2. import (
  3. v1 "github.com/go-nunu/nunu-layout-advanced/api/v1"
  4. "go.mongodb.org/mongo-driver/bson/primitive"
  5. "time"
  6. )
  7. type WebForwarding struct {
  8. Id int `gorm:"primary"`
  9. HostId int `gorm:"not null"`
  10. WafWebId int `gorm:"not null"` // 修改为与TCP转发一致的命名
  11. Tag string `gorm:"null"`
  12. Port string `gorm:"not null"`
  13. Domain string `gorm:"null"`
  14. CustomHost string `gorm:"null"`
  15. WafGatewayGroupId int `gorm:"not null"`
  16. WebLimitRuleId int `gorm:"not null"`
  17. CcCount int `gorm:"null"`
  18. CcDuration string `gorm:"null"`
  19. CcBlockCount int `gorm:"null"`
  20. CcBlockDuration string `gorm:"null"`
  21. Cc4xxCount int `gorm:"column:cc_4xx_count;null"`
  22. Cc4xxDuration string `gorm:"column:cc_4xx_duration;null"`
  23. Cc4xxBlockCount int `gorm:"column:cc_4xx_block_count;null"`
  24. Cc4xxBlockDuration string `gorm:"column:cc_4xx_block_duration;null"`
  25. Cc5xxCount int `gorm:"column:cc_5xx_count;null"`
  26. Cc5xxDuration string `gorm:"column:cc_5xx_duration;null"`
  27. Cc5xxBlockCount int `gorm:"column:cc_5xx_block_count;null"`
  28. Cc5xxBlockDuration string `gorm:"column:cc_5xx_block_duration;null"`
  29. IsHttps int `gorm:"null"`
  30. Comment string `gorm:"null"`
  31. CreatedAt time.Time
  32. UpdatedAt time.Time
  33. }
  34. func (m *WebForwarding) TableName() string {
  35. return "shd_waf_web"
  36. }
  37. // WebForwardingRule 用于存储Web转发规则
  38. type WebForwardingRule struct {
  39. ID primitive.ObjectID `bson:"_id,omitempty"`
  40. Uid int `bson:"uid" json:"uid"`
  41. HostId int `bson:"host_id" json:"host_id"`
  42. WebId int `bson:"web_id" json:"web_id"`
  43. BackendList []v1.BackendList `bson:"backend_list" json:"backend_list"`
  44. AllowIpList []string `bson:"allow_ip_list" json:"allow_ip_list"`
  45. DenyIpList []string `bson:"deny_ip_list" json:"deny_ip_list"`
  46. AccessRule string `bson:"access_rule" json:"access_rule"`
  47. CreatedAt time.Time `bson:"created_at" json:"created_at"`
  48. UpdatedAt time.Time `bson:"updated_at" json:"updated_at"`
  49. }
  50. func (m *WebForwardingRule) CollectionName() string {
  51. return "web_forwarding_rules"
  52. }