From b73e4173a3c1e69e02ad6b4e3b43e425e57a5be9 Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Thu, 9 Feb 2023 22:48:06 +0330 Subject: 3x-ui --- v2ui/models.go | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 v2ui/models.go (limited to 'v2ui/models.go') diff --git a/v2ui/models.go b/v2ui/models.go new file mode 100644 index 00000000..9ac50ed7 --- /dev/null +++ b/v2ui/models.go @@ -0,0 +1,41 @@ +package v2ui + +import "x-ui/database/model" + +type V2Inbound struct { + Id int `gorm:"primaryKey;autoIncrement"` + Port int `gorm:"unique"` + Listen string + Protocol string + Settings string + StreamSettings string + Tag string `gorm:"unique"` + Sniffing string + Remark string + Up int64 + Down int64 + Enable bool +} + +func (i *V2Inbound) TableName() string { + return "inbound" +} + +func (i *V2Inbound) ToInbound(userId int) *model.Inbound { + return &model.Inbound{ + UserId: userId, + Up: i.Up, + Down: i.Down, + Total: 0, + Remark: i.Remark, + Enable: i.Enable, + ExpiryTime: 0, + Listen: i.Listen, + Port: i.Port, + Protocol: model.Protocol(i.Protocol), + Settings: i.Settings, + StreamSettings: i.StreamSettings, + Tag: i.Tag, + Sniffing: i.Sniffing, + } +} -- cgit v1.2.3