Documentation
¶
Index ¶
- type MigrationRepo
- type MigrationUsecase
- type Node
- type NodeRepo
- type NodeUsecase
- func (uc *NodeUsecase) CreateNode(ctx context.Context, name string, tags []string, port uint16, address string, ...) (*Node, error)
- func (uc *NodeUsecase) DeleteNode(ctx context.Context, id int) error
- func (uc *NodeUsecase) FilterNodeList(ctx context.Context, page, size int32, search string, nodeGroupID *int64) (int32, []*Node, error)
- func (uc *NodeUsecase) QueryNodeTags(ctx context.Context) ([]string, error)
- func (uc *NodeUsecase) ResetNodeSort(ctx context.Context, sortItems []*SortItem) error
- func (uc *NodeUsecase) ToggleNodeStatus(ctx context.Context, id int, enable *bool) (*Node, error)
- func (uc *NodeUsecase) UpdateNode(ctx context.Context, id int, name string, tags []string, port uint16, ...) (*Node, error)
- type Server
- type ServerOnlineIP
- type ServerOnlineUser
- type ServerRepo
- type ServerResourceStatus
- type ServerStatus
- type ServerUsecase
- func (uc *ServerUsecase) CreateServer(ctx context.Context, name, country, city, address string, sort int64, ...) (*Server, error)
- func (uc *ServerUsecase) DeleteServer(ctx context.Context, id int) error
- func (uc *ServerUsecase) FilterServerList(ctx context.Context, page, size int32, search string) (int32, []*Server, error)
- func (uc *ServerUsecase) GetServerProtocols(ctx context.Context, id int) ([]*server.Protocol, error)
- func (uc *ServerUsecase) ResetServerSort(ctx context.Context, sortItems []*SortItem) error
- func (uc *ServerUsecase) UpdateServer(ctx context.Context, id int, name, country, city, address string, sort int64, ...) (*Server, error)
- type SortItem
- type UserSubscribeInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MigrationRepo ¶
type MigrationUsecase ¶
type MigrationUsecase struct {
// contains filtered or unexported fields
}
MigrationUsecase is the migration use case
func NewMigrationUsecase ¶
func NewMigrationUsecase(repo MigrationRepo, logger log.Logger) *MigrationUsecase
NewMigrationUsecase creates a new migration use case
func (*MigrationUsecase) HasMigrateServerNode ¶
func (uc *MigrationUsecase) HasMigrateServerNode(ctx context.Context) (bool, error)
HasMigrateServerNode checks if there's data to migrate
func (*MigrationUsecase) MigrateServerNode ¶
MigrateServerNode migrates server and node data
type NodeRepo ¶
type NodeRepo interface {
CreateNode(ctx context.Context, node *Node) (*Node, error)
UpdateNode(ctx context.Context, node *Node) (*Node, error)
DeleteNode(ctx context.Context, id int) error
FilterNodeList(ctx context.Context, page, size int32, search string, nodeGroupID *int64) (int32, []*Node, error)
ToggleNodeStatus(ctx context.Context, id int, enable *bool) (*Node, error)
QueryNodeTags(ctx context.Context) ([]string, error)
ResetNodeSort(ctx context.Context, sortItems []*SortItem) error
ClearNodeCache(ctx context.Context, serverIDs []int) error
GetServerProtocols(ctx context.Context, id int) ([]*server.Protocol, error)
}
type NodeUsecase ¶
type NodeUsecase struct {
// contains filtered or unexported fields
}
func NewNodeUsecase ¶
func NewNodeUsecase(repo NodeRepo, logger log.Logger) *NodeUsecase
func (*NodeUsecase) CreateNode ¶
func (*NodeUsecase) DeleteNode ¶
func (uc *NodeUsecase) DeleteNode(ctx context.Context, id int) error
func (*NodeUsecase) FilterNodeList ¶
func (*NodeUsecase) QueryNodeTags ¶
func (uc *NodeUsecase) QueryNodeTags(ctx context.Context) ([]string, error)
func (*NodeUsecase) ResetNodeSort ¶
func (uc *NodeUsecase) ResetNodeSort(ctx context.Context, sortItems []*SortItem) error
func (*NodeUsecase) ToggleNodeStatus ¶
type Server ¶
type Server struct {
ID int64
Name string
Country string
City string
Address string
Sort int
Protocols []*server.Protocol
LastReportedAt int64
Status *ServerStatus
CreatedAt int64
UpdatedAt int64
}
Server represents a proxy server
type ServerOnlineIP ¶
type ServerOnlineUser ¶
type ServerRepo ¶
type ServerRepo interface {
CreateServer(ctx context.Context, server *Server) (*Server, error)
UpdateServer(ctx context.Context, server *Server) (*Server, error)
DeleteServer(ctx context.Context, id int) error
GetServerByID(ctx context.Context, id int) (*Server, error)
FilterServerList(ctx context.Context, page, size int32, search string) (int32, []*Server, error)
GetServerProtocols(ctx context.Context, id int) ([]*server.Protocol, error)
ResetServerSort(ctx context.Context, sortItems []*SortItem) error
GetServerStatus(ctx context.Context, serverID int) (*ServerResourceStatus, error)
GetOnlineUsers(ctx context.Context, serverID int64, protocol string, port uint16) (map[int64][]string, error)
GetOnlineUsersByServer(ctx context.Context, serverID int64) (map[string]map[int64][]string, error)
GetUserSubscribeInfo(ctx context.Context, subscribeID int) (*UserSubscribeInfo, error)
}
type ServerResourceStatus ¶
type ServerStatus ¶
type ServerUsecase ¶
type ServerUsecase struct {
// contains filtered or unexported fields
}
func NewServerUsecase ¶
func NewServerUsecase(repo ServerRepo, nodeRepo NodeRepo, logger log.Logger) *ServerUsecase
func (*ServerUsecase) CreateServer ¶
func (*ServerUsecase) DeleteServer ¶
func (uc *ServerUsecase) DeleteServer(ctx context.Context, id int) error
func (*ServerUsecase) FilterServerList ¶
func (*ServerUsecase) GetServerProtocols ¶
func (*ServerUsecase) ResetServerSort ¶
func (uc *ServerUsecase) ResetServerSort(ctx context.Context, sortItems []*SortItem) error
Click to show internal directories.
Click to hide internal directories.