udpforwarding.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. package model
  2. import (
  3. "go.mongodb.org/mongo-driver/bson/primitive"
  4. "time"
  5. )
  6. type UdpForWarding struct {
  7. Id int `gorm:"primary"`
  8. HostId int `gorm:"not null"`
  9. CdnWebId int `gorm:"not null"`
  10. Port string `gorm:"not null"`
  11. Comment string `gorm:"null"`
  12. CreatedAt time.Time
  13. UpdatedAt time.Time
  14. }
  15. func (m *UdpForWarding) TableName() string {
  16. return "shd_waf_udp"
  17. }
  18. // UdpForwardingRule 用于存储UDP转发规则
  19. type UdpForwardingRule struct {
  20. ID primitive.ObjectID `bson:"_id,omitempty"`
  21. Uid int `bson:"uid" json:"uid"`
  22. HostId int `bson:"host_id" json:"host_id"`
  23. UdpId int `bson:"udp_id" json:"udp_id"`
  24. CdnOriginIds map[string]int64 `bson:"cdn_origin_ids" json:"cdn_origin_ids"`
  25. BackendList []string `bson:"backend_list" json:"backend_list"`
  26. CreatedAt time.Time `bson:"created_at" json:"created_at"`
  27. UpdatedAt time.Time `bson:"updated_at" json:"updated_at"`
  28. }
  29. func (m *UdpForwardingRule) CollectionName() string {
  30. return "udp_forwarding_rules"
  31. }