ssrpanel

package module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: MIT Imports: 30 Imported by: 0

README

a plugin with xray core , for ssrpanel

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InStr

func InStr(s string, list []string) bool

Types

type Config

type Config struct {
	NodeID             uint         `json:"nodeId"`
	CheckRate          int          `json:"checkRate"`
	IPLimit            int64        `json:"ipLimit"`
	MySQL              *MySQLConfig `json:"mysql"`
	UserConfig         *UserConfig  `json:"user"`
	IgnoreEmptyVmessID bool         `json:"ignoreEmptyVmessID"`
	// contains filtered or unexported fields
}

type DB

type DB struct {
	DB         *gorm.DB
	RetryTimes int64
}

func NewMySQLConn

func NewMySQLConn(config *MySQLConfig) (*DB, error)

func (*DB) GetAllUsers

func (db *DB) GetAllUsers(nodeID uint) ([]UserModel, error)

func (*DB) GetNode

func (db *DB) GetNode(id uint) (*Node, error)

type HandlerServiceClient

type HandlerServiceClient struct {
	command.HandlerServiceClient
	// contains filtered or unexported fields
}

func NewHandlerServiceClient

func NewHandlerServiceClient(client *grpc.ClientConn, inboundTag string) *HandlerServiceClient

func (*HandlerServiceClient) AddUser

func (h *HandlerServiceClient) AddUser(user *protocol.User) error

func (*HandlerServiceClient) AlterInbound

func (h *HandlerServiceClient) AlterInbound(req *command.AlterInboundRequest) error

func (*HandlerServiceClient) DelUser

func (h *HandlerServiceClient) DelUser(email string) error

type MySQLConfig

type MySQLConfig struct {
	Host     string `json:"host"`
	Port     int    `json:"port"`
	User     string `json:"user"`
	Password string `json:"password"`
	DBName   string `json:"dbname"`
}

func (*MySQLConfig) FormatDSN

func (c *MySQLConfig) FormatDSN() (string, error)

type Node

type Node struct {
	ID          uint    `gorm:"primary_key"`
	TrafficRate float64 `gorm:"traffic_rate"`
	NodeLevel   int     `gorm:"column:level"`
	NodeGroup   int     `gorm:"column:node_group"`
}

func (*Node) TableName

func (*Node) TableName() string

type NodeIP

type NodeIP struct {
	ID        uint `gorm:"primary_key"`
	NodeID    uint
	UserID    uint
	Port      int
	IPList    string `gorm:"column:ip"`
	CreatedAt int64
}

func (*NodeIP) BeforeCreate

func (n *NodeIP) BeforeCreate(scope *gorm.Scope) error

func (*NodeIP) TableName

func (*NodeIP) TableName() string

type NodeInfo

type NodeInfo struct {
	ID      uint `gorm:"primary_key"`
	NodeID  uint
	Uptime  time.Duration
	Load    string
	LogTime int64
}

func (*NodeInfo) BeforeCreate

func (l *NodeInfo) BeforeCreate(scope *gorm.Scope) error

func (*NodeInfo) TableName

func (*NodeInfo) TableName() string

type NodeOnlineLog

type NodeOnlineLog struct {
	ID         uint `gorm:"primary_key"`
	NodeID     uint
	OnlineUser int
	LogTime    int64
}

func (*NodeOnlineLog) BeforeCreate

func (l *NodeOnlineLog) BeforeCreate(scope *gorm.Scope) error

func (*NodeOnlineLog) TableName

func (*NodeOnlineLog) TableName() string

type Panel

type Panel struct {
	*Config
	// contains filtered or unexported fields
}

func NewPanel

func NewPanel(gRPCConn *grpc.ClientConn, db *DB, cfg *Config) (*Panel, error)

func (*Panel) Start

func (p *Panel) Start()

type StatsServiceClient

type StatsServiceClient struct {
	statsservice.StatsServiceClient
}

func NewStatsServiceClient

func NewStatsServiceClient(client *grpc.ClientConn) *StatsServiceClient

type UserConfig

type UserConfig struct {
	InboundTag  string `json:"inboundTag"`
	Level       uint32 `json:"level"`
	AlterID     uint32 `json:"alterId"`
	Flow        string `json:"flow"`
	SecurityStr string `json:"securityConfig"`
	// contains filtered or unexported fields
}

func (*UserConfig) UnmarshalJSON

func (c *UserConfig) UnmarshalJSON(data []byte) error

type UserModel

type UserModel struct {
	ID      uint
	VmessID string
	Email   string `gorm:"column:username"`
	Port    int
}

func (*UserModel) TableName

func (*UserModel) TableName() string

type UserTrafficLog

type UserTrafficLog struct {
	ID       uint `gorm:"primary_key"`
	UserID   uint
	Uplink   uint64 `gorm:"column:u"`
	Downlink uint64 `gorm:"column:d"`
	NodeID   uint
	Rate     float64
	Traffic  string
	LogTime  int64
}

func (*UserTrafficLog) BeforeCreate

func (l *UserTrafficLog) BeforeCreate(scope *gorm.Scope) error

Jump to

Keyboard shortcuts

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