webforwarding.go 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. CdnWebId int `gorm:"not null"`
  11. Port string `gorm:"not null"`
  12. Domain string `gorm:"null"`
  13. IsHttps int `gorm:"null"`
  14. Comment string `gorm:"null"`
  15. HttpsCert string `gorm:"null"`
  16. HttpsKey string `gorm:"null"`
  17. SslCertId int `gorm:"null"`
  18. SslPolicyId int
  19. Proxy bool `gorm:"null"`
  20. Cc bool
  21. ThresholdMethod string
  22. Level string
  23. Limit5s int
  24. Limit60s int
  25. Limit300s int
  26. CreatedAt time.Time
  27. UpdatedAt time.Time
  28. }
  29. func (m *WebForwarding) TableName() string {
  30. return "shd_waf_web"
  31. }
  32. // WebForwardingRule 用于存储Web转发规则
  33. type WebForwardingRule struct {
  34. ID primitive.ObjectID `bson:"_id,omitempty"`
  35. Uid int `bson:"uid" json:"uid"`
  36. HostId int `bson:"host_id" json:"host_id"`
  37. WebId int `bson:"web_id" json:"web_id"`
  38. CdnOriginIds map[string]int64 `bson:"cdn_origin_ids" json:"cdn_origin_ids"`
  39. BackendList []v1.BackendList `bson:"backend_list" json:"backend_list"`
  40. CreatedAt time.Time `bson:"created_at" json:"created_at"`
  41. UpdatedAt time.Time `bson:"updated_at" json:"updated_at"`
  42. }
  43. func (m *WebForwardingRule) CollectionName() string {
  44. return "web_forwarding_rules"
  45. }