connect

package
v0.0.0-...-d3751e6 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: GPL-3.0 Imports: 14 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenSalt

func GenSalt() (str string, err error)

func GenUUID

func GenUUID() (str string, err error)

func Keepalive

func Keepalive(sessionRegistry *SessionRegistry, done chan bool)

func PasswordAndSaltHash

func PasswordAndSaltHash(password string, passwordSalt string) (val string)

func RandomInt

func RandomInt() (n int32)

func Sha1Hex

func Sha1Hex(str string) (val string)

Types

type Authenticator

type Authenticator interface {
	Authenticate(username string, password string, passwordSalt string) (ok bool, err error)
}

type NetworkCache

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

func NewNetworkCache

func NewNetworkCache() (this *NetworkCache)

func (*NetworkCache) AddPlayer

func (this *NetworkCache) AddPlayer(name string, uuid uuid.UUID, session *Session) (ok bool)

func (*NetworkCache) Address

func (this *NetworkCache) Address() (val string)

func (*NetworkCache) MaxPlayers

func (this *NetworkCache) MaxPlayers() (val uint16)

func (*NetworkCache) Motd

func (this *NetworkCache) Motd() (val string)

func (*NetworkCache) Players

func (this *NetworkCache) Players() (players []string)

func (*NetworkCache) Port

func (this *NetworkCache) Port() (val uint16)

func (*NetworkCache) ProxyByPlayer

func (this *NetworkCache) ProxyByPlayer(name string) (session *Session)

func (*NetworkCache) Rebuild

func (this *NetworkCache) Rebuild()

func (*NetworkCache) RegisterProxy

func (this *NetworkCache) RegisterProxy(session *Session)

func (*NetworkCache) RemovePlayer

func (this *NetworkCache) RemovePlayer(name string, uuid uuid.UUID)

func (*NetworkCache) RemovePlayersByProxy

func (this *NetworkCache) RemovePlayersByProxy(session *Session)

func (*NetworkCache) UnregisterProxy

func (this *NetworkCache) UnregisterProxy(session *Session)

func (*NetworkCache) Version

func (this *NetworkCache) Version() (val string)

type Server

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

func NewServer

func NewServer(authenticator Authenticator) (this *Server)

func (*Server) Close

func (this *Server) Close()

func (*Server) ListenAndServe

func (this *Server) ListenAndServe(addr string) (err error)

func (*Server) SessionRegistry

func (this *Server) SessionRegistry(sessionRole SessionRole) (sessionRegistry *SessionRegistry)

type Session

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

func NewSession

func NewSession(server *Server, conn net.Conn) (this *Session)

func (*Session) Authorized

func (this *Session) Authorized() (val bool)

func (*Session) ErrorCaught

func (this *Session) ErrorCaught(err error)

func (*Session) HandlePacket

func (this *Session) HandlePacket(packet packet.Packet) (err error)

func (*Session) Id

func (this *Session) Id() (id string)

func (*Session) Keepalive

func (this *Session) Keepalive() (err error)

func (*Session) RegisterAuthorized

func (this *Session) RegisterAuthorized(username string)

func (*Session) RegisterProxy

func (this *Session) RegisterProxy(address string, port uint16, motd string, version string, maxPlayers uint16) (ok bool)

func (*Session) RegisterServer

func (this *Session) RegisterServer(address string, port uint16) (ok bool)

func (*Session) Serve

func (this *Session) Serve()

func (*Session) Unregister

func (this *Session) Unregister()

func (*Session) Write

func (this *Session) Write(packet packet.Packet) (err error)

type SessionRegistry

type SessionRegistry struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewSessionRegistry

func NewSessionRegistry() (this *SessionRegistry)

func (*SessionRegistry) Clear

func (this *SessionRegistry) Clear()

func (*SessionRegistry) GetAll

func (this *SessionRegistry) GetAll() (sessions []*Session)

func (*SessionRegistry) GetById

func (this *SessionRegistry) GetById(id string) (session *Session)

func (*SessionRegistry) HasId

func (this *SessionRegistry) HasId(id string) (val bool)

func (*SessionRegistry) Len

func (this *SessionRegistry) Len() (val int)

func (*SessionRegistry) Register

func (this *SessionRegistry) Register(session *Session)

func (*SessionRegistry) Unregister

func (this *SessionRegistry) Unregister(session *Session)

type SessionRole

type SessionRole int
const (
	ROLE_UNAUTHORIZED SessionRole = iota
	ROLE_AUTHORIZED
	ROLE_PROXY
	ROLE_SERVER
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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