webforwarding.go 1.6 KB

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