ssmapi

package
v1.12.21 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: GPL-2.0 Imports: 32 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewService

func NewService(ctx context.Context, logger log.ContextLogger, tag string, options option.SSMAPIServiceOptions) (adapter.Service, error)

func RegisterService

func RegisterService(registry *boxService.Registry)

Types

type APIServer

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

func NewAPIServer

func NewAPIServer(logger logger.Logger, traffic *TrafficManager, user *UserManager) *APIServer

func (*APIServer) Route

func (s *APIServer) Route(r chi.Router)

type Cache

type Cache struct {
	Endpoints *badjson.TypedMap[string, *EndpointCache] `json:"endpoints"`
}

type EndpointCache

type EndpointCache struct {
	GlobalUplink          int64                             `json:"global_uplink"`
	GlobalDownlink        int64                             `json:"global_downlink"`
	GlobalUplinkPackets   int64                             `json:"global_uplink_packets"`
	GlobalDownlinkPackets int64                             `json:"global_downlink_packets"`
	GlobalTCPSessions     int64                             `json:"global_tcp_sessions"`
	GlobalUDPSessions     int64                             `json:"global_udp_sessions"`
	UserUplink            *badjson.TypedMap[string, int64]  `json:"user_uplink"`
	UserDownlink          *badjson.TypedMap[string, int64]  `json:"user_downlink"`
	UserUplinkPackets     *badjson.TypedMap[string, int64]  `json:"user_uplink_packets"`
	UserDownlinkPackets   *badjson.TypedMap[string, int64]  `json:"user_downlink_packets"`
	UserTCPSessions       *badjson.TypedMap[string, int64]  `json:"user_tcp_sessions"`
	UserUDPSessions       *badjson.TypedMap[string, int64]  `json:"user_udp_sessions"`
	Users                 *badjson.TypedMap[string, string] `json:"users"`
}

type Service

type Service struct {
	boxService.Adapter
	// contains filtered or unexported fields
}

func (*Service) Close

func (s *Service) Close() error

func (*Service) Start

func (s *Service) Start(stage adapter.StartStage) error

type TrafficManager

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

func NewTrafficManager

func NewTrafficManager() *TrafficManager

func (*TrafficManager) ReadGlobal

func (s *TrafficManager) ReadGlobal(swap bool) (uplinkBytes int64, downlinkBytes int64, uplinkPackets int64, downlinkPackets int64, tcpSessions int64, udpSessions int64)

func (*TrafficManager) ReadUser

func (s *TrafficManager) ReadUser(user *UserObject)

func (*TrafficManager) ReadUsers

func (s *TrafficManager) ReadUsers(users []*UserObject, swap bool)

func (*TrafficManager) TrackConnection

func (s *TrafficManager) TrackConnection(conn net.Conn, metadata adapter.InboundContext) net.Conn

func (*TrafficManager) TrackPacketConnection

func (s *TrafficManager) TrackPacketConnection(conn N.PacketConn, metadata adapter.InboundContext) N.PacketConn

func (*TrafficManager) UpdateUsers

func (s *TrafficManager) UpdateUsers(users []string)

type UserManager

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

func NewUserManager

func NewUserManager(inbound adapter.ManagedSSMServer, trafficManager *TrafficManager) *UserManager

func (*UserManager) Add

func (m *UserManager) Add(username string, password string) error

func (*UserManager) Delete

func (m *UserManager) Delete(username string) error

func (*UserManager) Get

func (m *UserManager) Get(username string) (string, bool)

func (*UserManager) List

func (m *UserManager) List() []*UserObject

func (*UserManager) Update

func (m *UserManager) Update(username string, password string) error

type UserObject

type UserObject struct {
	UserName        string `json:"username"`
	Password        string `json:"uPSK,omitempty"`
	DownlinkBytes   int64  `json:"downlinkBytes"`
	UplinkBytes     int64  `json:"uplinkBytes"`
	DownlinkPackets int64  `json:"downlinkPackets"`
	UplinkPackets   int64  `json:"uplinkPackets"`
	TCPSessions     int64  `json:"tcpSessions"`
	UDPSessions     int64  `json:"udpSessions"`
}

Jump to

Keyboard shortcuts

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