Documentation
¶
Index ¶
- func AddXNode(node *models.Xnode) error
- func ConnectToXNode(node *models.Xnode) (pb.XNodeGrpcClient, error)
- type Notification
- type NotificationType
- type SubService
- type UserService
- func (u *UserService) ConfirmPurchase(purchaseId string) error
- func (u *UserService) CreatePurchase(user *models.Tuser, pck *models.Package, msgId int) error
- func (u *UserService) DisabledCallback() error
- func (u *UserService) GetRandomBankCard() (string, error)
- func (u *UserService) ListAvailablePackages() ([]*models.Package, error)
- func (u *UserService) ProcessPurchaseOnReceipt(user *models.Tuser) (repo.PurchaseNotify, error)
- func (u *UserService) Register(tid uint64, username string, packageName string) error
- func (u *UserService) RejectPurchase(purchaseId string) error
- func (u *UserService) SpawnRunners()
- func (u *UserService) Status(uid uint64) (*models.Tuser, error)
- func (u *UserService) SubscribeNotification(ch chan<- Notification)
- func (u *UserService) TrafficUsageRunner()
- func (u *UserService) Unregister(uid uint64) error
- func (u *UserService) Upgrade(user *models.Tuser, pck *models.Package) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnectToXNode ¶
func ConnectToXNode(node *models.Xnode) (pb.XNodeGrpcClient, error)
Types ¶
type Notification ¶ added in v0.3.1
type Notification struct {
Type NotificationType
User *models.Tuser
Extra interface{}
}
type NotificationType ¶ added in v0.3.1
type NotificationType int
const ( PurchaseSuccessful NotificationType = iota PurchaseRejected PurchaseFailed UserMaxTrafficReached )
type SubService ¶ added in v0.2.1
type SubService struct {
// contains filtered or unexported fields
}
func NewSubService ¶ added in v0.2.1
func NewSubService() *SubService
func (*SubService) GenerateUserSub ¶ added in v0.2.1
func (s *SubService) GenerateUserSub(token string) (string, error)
GenerateUserSub requests user's sub-content from xNodes and merge them together
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
func NewUserService ¶
func NewUserService() *UserService
func (*UserService) ConfirmPurchase ¶ added in v0.3.1
func (u *UserService) ConfirmPurchase(purchaseId string) error
func (*UserService) CreatePurchase ¶ added in v0.3.1
func (*UserService) DisabledCallback ¶
func (u *UserService) DisabledCallback() error
DisabledCallback is a callback-function to be called by XrayPanels when they have disabled a user due to traffic limit
func (*UserService) GetRandomBankCard ¶ added in v0.3.1
func (u *UserService) GetRandomBankCard() (string, error)
func (*UserService) ListAvailablePackages ¶ added in v0.3.1
func (u *UserService) ListAvailablePackages() ([]*models.Package, error)
func (*UserService) ProcessPurchaseOnReceipt ¶ added in v0.3.1
func (u *UserService) ProcessPurchaseOnReceipt(user *models.Tuser) (repo.PurchaseNotify, error)
ProcessPurchaseOnReceipt process a purchase when the user paid the price and sent a receipt to the admins
func (*UserService) Register ¶
func (u *UserService) Register(tid uint64, username string, packageName string) error
Register a user on local repo and send a "AddClient" request to panels
func (*UserService) RejectPurchase ¶ added in v0.3.1
func (u *UserService) RejectPurchase(purchaseId string) error
func (*UserService) SpawnRunners ¶ added in v0.2.1
func (u *UserService) SpawnRunners()
func (*UserService) SubscribeNotification ¶ added in v0.3.1
func (u *UserService) SubscribeNotification(ch chan<- Notification)
func (*UserService) TrafficUsageRunner ¶ added in v0.2.1
func (u *UserService) TrafficUsageRunner()
TrafficUsageRunner runs periodically to fetch the latest traffic-usage from xPanels
func (*UserService) Unregister ¶
func (u *UserService) Unregister(uid uint64) error
Click to show internal directories.
Click to hide internal directories.