xpanels

package
v0.4.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PanelBuilder

func PanelBuilder(conf map[string]string) pb.XNodeGrpcServer

PanelBuilder builds a panel (hiddify, xui, etc.) based on the arguments

func StartXPanel

func StartXPanel(conf map[string]string)

Types

type DownUpStat

type DownUpStat struct {
	Downlink int64
	Uplink   int64
}

type HiddifyPanel

type HiddifyPanel struct {
	pb.UnimplementedXNodeGrpcServer
	// contains filtered or unexported fields
}

HiddifyPanel implements pb.XNodeGrpcServer and SubRenovator

func NewHiddifyPanel

func NewHiddifyPanel(xs *XrayService, conf map[string]string) *HiddifyPanel

func (*HiddifyPanel) AddUser

func (panel *HiddifyPanel) AddUser(ctx context.Context, cmd *pb.AddUserCmd) (*pb.Response, error)

func (*HiddifyPanel) GetSub added in v0.2.1

func (panel *HiddifyPanel) GetSub(ctx context.Context, uInfo *pb.UserInfoReq) (*pb.SubContent, error)

func (*HiddifyPanel) GetUserInfo added in v0.2.1

func (panel *HiddifyPanel) GetUserInfo(ctx context.Context, uInfo *pb.UserInfoReq) (*pb.UserInfo, error)

func (*HiddifyPanel) Ping

func (panel *HiddifyPanel) Ping(_ context.Context, _ *pb.Empty) (*pb.Empty, error)

func (*HiddifyPanel) UpgradeUserPackage added in v0.3.1

func (panel *HiddifyPanel) UpgradeUserPackage(ctx context.Context, cmd *pb.AddPackageCmd) (*pb.Response, error)

type HiddifyPanelRepo added in v0.2.1

type HiddifyPanelRepo struct {
	// contains filtered or unexported fields
}

func SetupHiddifyRepo added in v0.2.1

func SetupHiddifyRepo(dbPath string) *HiddifyPanelRepo

func (*HiddifyPanelRepo) GetDomains added in v0.2.1

func (r *HiddifyPanelRepo) GetDomains() ([]string, error)

func (*HiddifyPanelRepo) GetGroupedRules added in v0.2.1

func (r *HiddifyPanelRepo) GetGroupedRules() (map[string][]RenovateRule, error)

GetGroupedRules returns a rules grouped by their remark name.

func (*HiddifyPanelRepo) GetStrConfig added in v0.2.1

func (r *HiddifyPanelRepo) GetStrConfig() (map[string]string, error)

func (*HiddifyPanelRepo) GetUser added in v0.2.1

func (r *HiddifyPanelRepo) GetUser(uid string) (User, error)

func (*HiddifyPanelRepo) InsertRenovateRule added in v0.2.1

func (r *HiddifyPanelRepo) InsertRenovateRule(rule RenovateRule) error

func (*HiddifyPanelRepo) InsertUser added in v0.2.1

func (r *HiddifyPanelRepo) InsertUser(
	uid, username, expireTime, startDate, mode string, lastOnline time.Time,
	trafficAllowed float32, packageDays int64,
) error

func (*HiddifyPanelRepo) ListRenovateRules added in v0.2.1

func (r *HiddifyPanelRepo) ListRenovateRules() ([]RenovateRule, error)

func (*HiddifyPanelRepo) UpdateUserPackage added in v0.3.1

func (r *HiddifyPanelRepo) UpdateUserPackage(uuid, expireTime, startDate, mode string, trafficAllowed float32, packageDays int64) error

type IHiddifyPanelRepo added in v0.2.1

type IHiddifyPanelRepo interface {
	ListRenovateRules() ([]RenovateRule, error)
	GetGroupedRules() (map[string][]RenovateRule, error)
	GetUser(uuid string) (User, error)
	UpdateUserPackage(uuid, expireTime, startDate, mode string, trafficAllowed float32, packageDays int64) error
	InsertUser(uid, username, expireTime, startDate, mode string, lastOnline time.Time, trafficAllowed float32, packageDays int64) error
	InsertRenovateRule(rule RenovateRule) error
	GetDomains() ([]string, error)
	GetStrConfig() (map[string]string, error)
}

type IPanel

type IPanel interface {
	pb.XNodeGrpcServer
}

type KeyVal added in v0.2.1

type KeyVal struct {
	Key string `db:"key"`
	Val string `db:"value"`
}

type RenovateFromFile added in v0.4.2

type RenovateFromFile struct {
	// contains filtered or unexported fields
}

func NewRenovatorFromFile added in v0.4.2

func NewRenovatorFromFile(content string) RenovateFromFile

func (RenovateFromFile) Renovate added in v0.4.2

func (s RenovateFromFile) Renovate(_ io.Reader, uid string) (string, error)

Renovate returns the content of file without modifying it

type RenovateRule added in v0.2.1

type RenovateRule struct {
	Id       uint64 `db:"id"`
	Remark   string `db:"remark"`
	OldValue string `db:"old_value"`
	NewValue string `db:"new_value"`
	Ignore   bool   `db:"ignore"`
}

type RuleRenovator added in v0.4.2

type RuleRenovator struct {
	// contains filtered or unexported fields
}

func (*RuleRenovator) Renovate added in v0.4.2

func (r *RuleRenovator) Renovate(subContent io.Reader, _ string) (string, error)

type SubRenovator added in v0.2.1

type SubRenovator interface {
	Renovate(reader io.Reader, uid string) (string, error)
}

SubRenovator receive an original sub-content (io.Reader) and returns a modified version of it

type User added in v0.2.1

type User struct {
	Id             uint64         `db:"id"`
	Uuid           string         `db:"uuid"`
	Name           string         `db:"name"`
	LastOnline     string         `db:"last_online"`
	ExpiryTime     sql.NullString `db:"expiry_time"`
	UsageLimitGB   float32        `db:"usage_limit_GB"`
	CurrentUsageGB float32        `db:"current_usage_GB"`
}

type XClient

type XClient struct {
	Uuid    string
	Email   string
	Level   uint32
	AlterId uint32
}

type XrayService

type XrayService struct {
	Addr string
	// contains filtered or unexported fields
}

func NewXrayService

func NewXrayService(addr string) *XrayService

func (*XrayService) AddClient

func (x *XrayService) AddClient(c XClient, inboundTag string) error

func (*XrayService) GetInboundStats

func (x *XrayService) GetInboundStats() (map[string]DownUpStat, error)

func (*XrayService) Restart

func (x *XrayService) Restart() error

type XuiPanel

type XuiPanel struct {
	pb.UnimplementedXNodeGrpcServer
}

func NewXuiPanel

func NewXuiPanel(xs *XrayService, conf map[string]string) *XuiPanel

func (*XuiPanel) AddUser

func (panel *XuiPanel) AddUser(ctx context.Context, cmd *pb.AddUserCmd) (*pb.Response, error)

Jump to

Keyboard shortcuts

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