tcpforwarding.go 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package model
  2. import (
  3. "go.mongodb.org/mongo-driver/bson/primitive"
  4. "time"
  5. )
  6. type Tcpforwarding struct {
  7. Id int `gorm:"primary"`
  8. HostId int `gorm:"not null"`
  9. WafTcpId int `gorm:"not null"`
  10. Tag string `gorm:"null"`
  11. Port string `gorm:"not null"`
  12. WafGatewayGroupId int `gorm:"null"`
  13. TcpLimitRuleId int `gorm:"not null"`
  14. CcCount int `gorm:"default:0"`
  15. CcDuration string `gorm:"default:0s"`
  16. CcBlockCount int `gorm:"default:0"`
  17. CcBlockDuration string `gorm:"null"`
  18. BackendProtocol string `gorm:"default:tcp"`
  19. BackendTimeout string `gorm:"null"`
  20. Comment string `gorm:"null"`
  21. CreatedAt time.Time
  22. UpdatedAt time.Time
  23. }
  24. func (m *Tcpforwarding) TableName() string {
  25. return "shd_waf_tcp"
  26. }
  27. type TcpForwardingRule struct {
  28. ID primitive.ObjectID `bson:"_id,omitempty"`
  29. Uid int `bson:"uid" json:"uid"`
  30. HostId int `bson:"host_id" json:"host_id"`
  31. TcpId int `bson:"tcp_id" json:"tcp_id"`
  32. BackendList []string `bson:"backend_list" json:"backend_list"`
  33. AllowIpList []string `bson:"allow_ip_list" json:"allow_ip_list"`
  34. DenyIpList []string `bson:"deny_ip_list" json:"deny_ip_list"`
  35. AccessRule string `bson:"access_rule" json:"access_rule"`
  36. CreatedAt time.Time `bson:"created_at" json:"created_at"`
  37. UpdatedAt time.Time `bson:"updated_at" json:"updated_at"`
  38. }
  39. func (m *TcpForwardingRule) CollectionName() string {
  40. return "tcp_forwarding_rules"
  41. }