session

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Processor

type Processor interface {
	// ProcessServer determines whether the provided packet, originating from the server, should be forwarded to the client.
	// It returns true if the packet should be forwarded, otherwise false.
	ProcessServer(packet packet.Packet) bool
	// ProcessClient determines whether the provided packet, originating from the client, should be forwarded to the server.
	// It returns true if the packet should be forwarded, otherwise false.
	ProcessClient(packet packet.Packet) bool

	// ProcessPreTransfer is called before transferring the client to a different server.
	// It can be used for pre-processing tasks before the client transfer starts.
	// The 'addr' parameter represents the address of the target server.
	// It returns true if the transfer process should proceed, otherwise false.
	ProcessPreTransfer(addr string) bool
	// ProcessPostTransfer is called after transferring the client to a different server.
	// It can be used for post-processing tasks after the client transfer completes.
	// The 'addr' parameter represents the address of the target server.
	// Although this method returns a boolean value, it is not currently used and exists for the sake of completeness.
	ProcessPostTransfer(addr string) bool

	// ProcessDisconnection is called when the client disconnects from the server.
	// It can be used for post-processing tasks after the disconnection occurs.
	// Although this method returns a boolean value, it is not currently used and exists for the sake of completeness.
	ProcessDisconnection() bool
}

Processor is an interface defining methods for handling events such as packet sending/receiving, transfers and disconnection.

type Registry

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

func NewRegistry

func NewRegistry() *Registry

func (*Registry) AddSession

func (r *Registry) AddSession(xuid string, session *Session)

func (*Registry) GetSession

func (r *Registry) GetSession(xuid string) *Session

func (*Registry) GetSessionByUsername

func (r *Registry) GetSessionByUsername(username string) *Session

func (*Registry) GetSessions

func (r *Registry) GetSessions() []*Session

func (*Registry) RemoveSession

func (r *Registry) RemoveSession(xuid string)

type Session

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

func NewSession

func NewSession(clientConn *minecraft.Conn, logger internal.Logger, registry *Registry, discovery server.Discovery, opts util.Opts, transport transport.Transport) *Session

func (*Session) Animation added in v0.0.4

func (s *Session) Animation() animation.Animation

func (*Session) Client added in v0.0.8

func (s *Session) Client() *minecraft.Conn

func (*Session) Close

func (s *Session) Close()

func (*Session) Disconnect

func (s *Session) Disconnect(message string)

func (*Session) Latency

func (s *Session) Latency() int64

func (*Session) Login added in v0.0.18

func (s *Session) Login() (err error)

func (*Session) Opts added in v0.0.18

func (s *Session) Opts() util.Opts

func (*Session) Processor added in v0.0.8

func (s *Session) Processor() Processor

func (*Session) Server

func (s *Session) Server() *server.Conn

func (*Session) SetAnimation

func (s *Session) SetAnimation(animation animation.Animation)

func (*Session) SetOpts added in v0.0.18

func (s *Session) SetOpts(opts util.Opts)

func (*Session) SetProcessor

func (s *Session) SetProcessor(processor Processor)

func (*Session) Transfer

func (s *Session) Transfer(addr string) error

type Tracker

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

func NewTracker

func NewTracker() *Tracker

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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