ssm

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package ssm implements the Shadowsocks Server Management API v1.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetServerInfo

func GetServerInfo(c *fiber.Ctx) error

GetServerInfo returns information about the API server.

Types

type ServerInfo

type ServerInfo struct {
	Name       string `json:"server"`
	APIVersion string `json:"apiVersion"`
}

ServerInfo contains information about the API server.

type ServerManager

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

ServerManager handles server management API requests.

func NewServerManager

func NewServerManager() *ServerManager

NewServerManager returns a new server manager.

func (*ServerManager) AddServer

func (sm *ServerManager) AddServer(name string, cms *cred.ManagedServer, sc stats.Collector)

AddServer adds a server to the server manager.

func (*ServerManager) AddUser

func (sm *ServerManager) AddUser(c *fiber.Ctx) error

AddUser adds a new user credential to the server.

func (*ServerManager) CheckMultiUserSupport

func (sm *ServerManager) CheckMultiUserSupport(c *fiber.Ctx) error

CheckMultiUserSupport is a middleware for the users group. It checks whether the selected server supports user management.

func (*ServerManager) ContextManagedServer

func (sm *ServerManager) ContextManagedServer(c *fiber.Ctx) error

ContextManagedServer is a middleware for the servers group. It adds the server with the given name to the request context.

func (*ServerManager) DeleteUser

func (sm *ServerManager) DeleteUser(c *fiber.Ctx) error

DeleteUser deletes a user's credential.

func (*ServerManager) GetStats

func (sm *ServerManager) GetStats(c *fiber.Ctx) error

GetStats returns server traffic statistics.

func (*ServerManager) GetUser

func (sm *ServerManager) GetUser(c *fiber.Ctx) error

GetUser returns information about a user.

func (*ServerManager) ListServers

func (sm *ServerManager) ListServers(c *fiber.Ctx) error

ListServers lists all managed servers.

func (*ServerManager) ListUsers

func (sm *ServerManager) ListUsers(c *fiber.Ctx) error

ListUsers lists server users.

func (*ServerManager) RegisterRoutes

func (sm *ServerManager) RegisterRoutes(v1 fiber.Router)

RegisterRoutes sets up routes for the /servers endpoint.

func (*ServerManager) UpdateUser

func (sm *ServerManager) UpdateUser(c *fiber.Ctx) error

UpdateUser updates a user's credential.

type StandardError

type StandardError struct {
	Message string `json:"error"`
}

StandardError is the standard error response.

type UserInfo

type UserInfo struct {
	cred.UserCredential
	stats.Traffic
}

UserInfo contains information about a user.

type UserList

type UserList struct {
	Users []cred.UserCredential `json:"users"`
}

UserList contains a list of user credentials.

Jump to

Keyboard shortcuts

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