Documentation
¶
Index ¶
- type Spectrum
- func (s *Spectrum) Accept() (*session.Session, error)
- func (s *Spectrum) Close() error
- func (s *Spectrum) Discovery() server.Discovery
- func (s *Spectrum) Listen(config minecraft.ListenConfig) (err error)
- func (s *Spectrum) Listener() *minecraft.Listener
- func (s *Spectrum) Opts() util.Opts
- func (s *Spectrum) Registry() *session.Registry
- func (s *Spectrum) Transport() tr.Transport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Spectrum ¶
type Spectrum struct {
// contains filtered or unexported fields
}
Spectrum represents a proxy server managing server discovery, network transport, and connections through an underlying minecraft.Listener.
func NewSpectrum ¶
func NewSpectrum(discovery server.Discovery, logger *slog.Logger, opts *util.Opts, transport tr.Transport) *Spectrum
NewSpectrum creates a new Spectrum instance using the provided server.Discovery. It initializes opts with default options from util.DefaultOpts() if opts is nil, and defaults to TCP transport if transport is nil transport.TCP.
func (*Spectrum) Accept ¶
Accept accepts an incoming minecraft.Conn and creates a new session for it. This method should be called in a loop to continuously accept new connections.
func (*Spectrum) Listen ¶
func (s *Spectrum) Listen(config minecraft.ListenConfig) (err error)
Listen sets up a minecraft.Listener for incoming connections based on the provided minecraft.ListenConfig. The listener is then used by the Accept() method for accepting incoming connections.