webforwarding.go 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. HttpsCert string `gorm:"null"`
  32. HttpsKey string `gorm:"null"`
  33. CreatedAt time.Time
  34. UpdatedAt time.Time
  35. }
  36. func (m *WebForwarding) TableName() string {
  37. return "shd_waf_web"
  38. }
  39. // WebForwardingRule 用于存储Web转发规则
  40. type WebForwardingRule struct {
  41. ID primitive.ObjectID `bson:"_id,omitempty"`
  42. Uid int `bson:"uid" json:"uid"`
  43. HostId int `bson:"host_id" json:"host_id"`
  44. WebId int `bson:"web_id" json:"web_id"`
  45. BackendList []v1.BackendList `bson:"backend_list" json:"backend_list"`
  46. AllowIpList []string `bson:"allow_ip_list" json:"allow_ip_list"`
  47. DenyIpList []string `bson:"deny_ip_list" json:"deny_ip_list"`
  48. AccessRule string `bson:"access_rule" json:"access_rule"`
  49. CreatedAt time.Time `bson:"created_at" json:"created_at"`
  50. UpdatedAt time.Time `bson:"updated_at" json:"updated_at"`
  51. }
  52. func (m *WebForwardingRule) CollectionName() string {
  53. return "web_forwarding_rules"
  54. }