webforwarding.go 1.6 KB

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