proxy

package
v0.0.0-...-82a22e8 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2023 License: GPL-3.0 Imports: 46 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeLoginPayload

func EncodeLoginPayload(payload LoginPayload) (val string)

func FormatUUID

func FormatUUID(uuid string) (val string)

func GenNameUUID

func GenNameUUID(name string) (val string)

func GenSalt

func GenSalt() (str string, err error)

func MinecraftVersion

func MinecraftVersion() string

func NewAPIContext

func NewAPIContext(server *Server) *apiContext

func NewEventBus

func NewEventBus() *eventBus

func RandomBytes

func RandomBytes(size int) (bytes []byte, err error)

func RandomInt

func RandomInt(max int) (val int)

func Sha1Hex

func Sha1Hex(str string) (val string)

Types

type Localizer

type Localizer interface {
	LocaleFull() string
	LocaleOffline() string
	LocaleLoggedIn() string
	LocaleLostConn() string
	LocaleShutdown() string
}

type LoginPayload

type LoginPayload struct {
	SecurityKey string                 `json:"s"`
	Host        string                 `json:"h"`
	RealIp      string                 `json:"rIp"`
	RealPort    int                    `json:"rP"`
	Name        string                 `json:"n"`
	UUID        string                 `json:"u"`
	Properties  []LoginPayloadProperty `json:"p"`
}

func DecodeLoginPayload

func DecodeLoginPayload(val string) (payload LoginPayload)

type LoginPayloadProperty

type LoginPayloadProperty struct {
	Name      string `json:"n"`
	Value     string `json:"v"`
	Signature string `json:"s"`
}

type Router

type Router interface {
	Route(domain string) (servers []string)
	RouteMotds(domain string) (motds []string)
	RouteIcons(domain string) (iconPath []string)
	RouteSample(domain string) (samplePath string)
}

type Server

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

func NewServer

func NewServer(bind *string, motd *string, maxPlayers *uint16, syncMaxPlayers *bool, authenticate *bool, router Router, localizer Localizer, connect *connect.ProxyConnect) (this *Server, err error)

func (*Server) Authenticate

func (this *Server) Authenticate() bool

func (*Server) Close

func (this *Server) Close()

func (*Server) ListenAddr

func (this *Server) ListenAddr() string

func (*Server) ListenAndServe

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

func (*Server) MaxPlayers

func (this *Server) MaxPlayers() uint16

func (*Server) Motd

func (this *Server) Motd() string

func (*Server) SyncMaxPlayers

func (this *Server) SyncMaxPlayers() bool

type Session

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

func NewSession

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

func (*Session) Authenticated

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

func (*Session) Disconnect

func (this *Session) Disconnect(reason string)

func (*Session) DisconnectJson

func (this *Session) DisconnectJson(json string)

func (*Session) ErrorCaught

func (this *Session) ErrorCaught(err error)

func (*Session) HandlePacket

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

func (*Session) Initializing

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

func (*Session) Redirect

func (this *Session) Redirect(server *connect.Server)

func (*Session) Remote

func (this *Session) Remote() (ip string, port string)

func (*Session) RemoteOverride

func (this *Session) RemoteOverride(ip string, port string)

func (*Session) Serve

func (this *Session) Serve()

func (*Session) SetAuthenticated

func (this *Session) SetAuthenticated(result bool)

func (*Session) SetCompression

func (this *Session) SetCompression(threshold int)

func (*Session) SetEncryption

func (this *Session) SetEncryption(sharedSecret []byte) (err error)

func (*Session) SetState

func (this *Session) SetState(state SessionState)

func (*Session) Write

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

type SessionOutBridge

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

func NewSessionOutBridge

func NewSessionOutBridge(session *Session, server *connect.Server, conn net.Conn) (this *SessionOutBridge)

func (*SessionOutBridge) EnsureCompression

func (this *SessionOutBridge) EnsureCompression()

func (*SessionOutBridge) ErrorCaught

func (this *SessionOutBridge) ErrorCaught(err error)

func (*SessionOutBridge) HandlePacket

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

func (*SessionOutBridge) Serve

func (this *SessionOutBridge) Serve()

func (*SessionOutBridge) SetCompression

func (this *SessionOutBridge) SetCompression(threshold int)

func (*SessionOutBridge) Write

func (this *SessionOutBridge) 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) GetByName

func (this *SessionRegistry) GetByName(name string) (session *Session)

func (*SessionRegistry) GetByUuid

func (this *SessionRegistry) GetByUuid(uuid uuid.UUID) (session *Session)

func (*SessionRegistry) HasName

func (this *SessionRegistry) HasName(name string) (val bool)

func (*SessionRegistry) HasUuid

func (this *SessionRegistry) HasUuid(uuid uuid.UUID) (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 SessionState

type SessionState int
const (
	STATE_DISCONNECTED SessionState = iota
	STATE_STATUS
	STATE_STATUS_PING
	STATE_LOGIN
	STATE_LOGIN_ENCRYPT
	STATE_INIT
	STATE_CONNECTED
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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