Documentation
¶
Index ¶
- type Admin
- type Adminchat
- type Config
- type Database
- func (d *Database) AddUser(user *User) (*User, error)
- func (d *Database) Close() error
- func (d *Database) DatabasePath() string
- func (d *Database) GetUser(user *tgbotapi.User) (*User, error)
- func (d *Database) Getadminchat() (map[int64]string, error)
- func (d *Database) InitDb() error
- func (d *Database) QuaryAdmin(UserID int64) *Admin
- func (d *Database) RemoveUser(user *tgbotapi.User) (*User, error)
- func (d *Database) UpdateUser(newuser *tgbotapi.User, Id string) (*User, error)
- type Event
- type Gift
- type GiftLog
- type Inbound
- type Metadata
- type Outbound
- type PointLog
- type Reffral
- type SboxConfigs
- type UsageHistory
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Admin ¶
type Admin struct {
Id int64
}
All thinsgs Downthere will store in ram until program kill
type Config ¶
type Config struct {
Id int64 `gorm:"primaryKey"`
Name string
UUID string `gorm:"not null;uniqueIndex"`
Type string
Password string
Active bool
UserID int64 `gorm:"not null;column:user_id"`
InboundID int16 `gorm:"not null"`
OutboundID int16 `gorm:"not null"`
Inbound Inbound `gorm:"foreignKey:ID"`
Outbound Outbound `gorm:"foreignKey:ID"`
Usage C.Bwidth // total usage for this month as byte
Download C.Bwidth // total download for this month as byte
Upload C.Bwidth // total uploads for this month as byte
Quota C.Bwidth // changes every day when according to groups user
LoginLimit int16
}
func (*Config) UpdateUsages ¶
func (c *Config) UpdateUsages(status sbox.Sboxstatus)
type Database ¶
func (*Database) DatabasePath ¶
func (*Database) QuaryAdmin ¶
func (*Database) RemoveUser ¶
return removed user
type Gift ¶
type Gift struct {
ID int64 `gorm:"primaryKey"`
Sender int64
Reciver int64
SendValid bool // used by watchman
ReciveValid bool //used by watchman when prosessing batch records in preprosess
Bandwidth C.Bwidth
Date time.Time
Valid bool // used by watchman
ComQuota C.Bwidth //Maincommon quota which was exist when gift was created
}
func (*Gift) Isgifttimeover ¶
type Metadata ¶
type Metadata struct {
Id int32
CommonQuota C.Bwidth //common quota for all use which is changing over many condition like verified user count capped user count capped total addtional, how ever actual user quota calculated based on this quota
Maxconfigcount int16
ChannelId int64
GroupID int64
Channelusercount int64
Groupusercount int64
VerifiedUserCount int64
Dbusercount int64
LoginLimit int32
BandwidthAvelable C.Bwidth
CheckCount int32 // current check count
ResetCount int32 //neded ChecCounts for reset db
RefreshRate int32 //rate of refreshing in hours
PublicDomain string
PublicIp string
}
type SboxConfigs ¶
type UsageHistory ¶
type User ¶
type User struct {
CheckID uint
TgID int64 `gorm:"primaryKey;column:tg_id"`
Name string `gorm:"type:varchar(100)"`
Username sql.NullString `gorm:"type:varchar(100);column:username"`
Lang string `gorm:"type:varchar(50);column:lang"`
IsTgPremium bool `gorm:"column:is_tg_premium"`
IsInChannel bool `gorm:"column:is_in_channel"`
IsInGroup bool `gorm:"column:is_in_group"`
IsRemoved bool `gorm:"column:is_removed"` //common for group and channel
Restricted bool `gorm:"column:restricted"` // admin can restrict users
GroupBanned bool `gorm:"column:group_banned"`
ChannelBanned bool `gorm:"column:channel_banned"`
IsVipUser bool `gorm:"column:is_vip_user"`
IsBotStarted bool `gorm:"column:is_bot_started"`
//IsAdmin bool `gorm:"column:is_admin"`
IsDistributedUser bool `gorm:"column:is_dis_user"`
IsCapped bool `gorm:"column:is_capped"`
IsMonthLimited bool `gorm:"column:is_month_limited"`
RecheckVerificity bool `gorm:"column:recheck_verificity"`
Points int64
CalculatedQuota C.Bwidth // This value includes Main User quota which is calculated on watchman + Giftquota
AdditionalQuota C.Bwidth `gorm:"column:additional_quota"` // this is static does not reset, value always in byte (this value does not use yet in codebase may be future)
GiftQuota C.Bwidth // this value can be +,-
CappedQuota C.Bwidth `gorm:"column:capped_quota"`
UsedQuota C.Bwidth // current total quota used by the user
SavedQuota C.Bwidth //this value used for when a user over use month usage this value store next months savings from him (his quota - fake usage)
MonthUsage C.Bwidth `gorm:"column:month_usage"` //Usage of current Month will reset with end of month
AlltimeUsage C.Bwidth `gorm:"column:all_time_usage"`
AddtionalConfig int16 `gorm:"column:max_config_count"`
ConfigCount int16 `gorm:"column:config_count"`
DeletedConfCount int16 `gorm:"column:deleted_conf_count"`
WebToken sql.NullString `gorm:"type:varchar(200);column:web_token"`
Configs []Config `gorm:"foreignKey:UserID"`
Captime time.Time
//Gifttime time.Time
Joined time.Time
LeaveTime time.Time `gorm:"column:leave_time"`
CreatedAt time.Time
UpdatedAt time.Time
}
func (*User) GenaralQuotSum ¶
retuns sum of addtional + gift +
func (*User) Iscaptimeover ¶
Click to show internal directories.
Click to hide internal directories.