session

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BbsSession

type BbsSession struct {
	ID           int // Unique identifier for the session/node
	Conn         gossh.Conn
	Channel      gossh.Channel // Store the SSH channel for direct I/O
	Term         *term.Terminal
	User         *user.User // Logged-in user, nil if not logged in
	Width        int
	Height       int
	RemoteAddr   net.Addr
	CurrentMenu  string               // Tracks the current ViSiON/2 menu the user is in
	Activity     string               // Descriptive activity text for Who's Online (e.g., "Reading Messages")
	NodeID       int                  // Node ID for the session
	AssetsPath   string               // Store required path directly
	Mutex        sync.RWMutex         // For thread-safe access to session state if needed later
	Pty          *ssh.Pty             // Store PTY info
	AutoRunLog   types.AutoRunTracker // Tracks run-once commands executed (Use types.AutoRunTracker)
	LastMenu     string               // Tracks the previously visited menu
	StartTime    time.Time            // Tracks the session start time
	LastActivity time.Time            // Tracks last user input for idle calculation
	PendingPages []string             // Queued page messages for delivery at next prompt
	Invisible    bool                 // True if user logged in invisibly (SysOp/CoSysOp only)
}

Session represents an active user connection to the BBS.

func (*BbsSession) AddPage

func (s *BbsSession) AddPage(msg string)

AddPage queues a page message for delivery at the user's next menu prompt.

func (*BbsSession) DrainPages

func (s *BbsSession) DrainPages() []string

DrainPages returns all pending pages and clears the queue.

type SessionRegistry

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

SessionRegistry tracks all active BBS sessions.

func NewSessionRegistry

func NewSessionRegistry() *SessionRegistry

func (*SessionRegistry) ActiveCount

func (r *SessionRegistry) ActiveCount() int

ActiveCount returns the number of currently active sessions.

func (*SessionRegistry) Get

func (r *SessionRegistry) Get(nodeID int) *BbsSession

func (*SessionRegistry) ListActive

func (r *SessionRegistry) ListActive() []*BbsSession

func (*SessionRegistry) Register

func (r *SessionRegistry) Register(s *BbsSession)

func (*SessionRegistry) Unregister

func (r *SessionRegistry) Unregister(nodeID int)

Jump to

Keyboard shortcuts

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