udpforwarding.go 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. AllowIpList []string `bson:"allow_ip_list" json:"allow_ip_list"`
  27. DenyIpList []string `bson:"deny_ip_list" json:"deny_ip_list"`
  28. AccessRule string `bson:"access_rule" json:"access_rule"`
  29. CreatedAt time.Time `bson:"created_at" json:"created_at"`
  30. UpdatedAt time.Time `bson:"updated_at" json:"updated_at"`
  31. }
  32. func (m *UdpForwardingRule) CollectionName() string {
  33. return "udp_forwarding_rules"
  34. }