core

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2023 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddXNode

func AddXNode(node *models.Xnode) error

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 (u *UserService) CreatePurchase(user *models.Tuser, pck *models.Package, msgId int) error

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) Status

func (u *UserService) Status(uid uint64) (*models.Tuser, error)

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

func (*UserService) Upgrade

func (u *UserService) Upgrade(user *models.Tuser, pck *models.Package) error

Upgrade the user to a new package then send a command to all the available servers

Directories

Path Synopsis
e

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL