proxy

package
v0.0.0-...-0d76806 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2014 License: GPL-3.0 Imports: 26 Imported by: 0

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 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 {
	SessionRegistry *SessionRegistry
	// contains filtered or unexported fields
}

func NewServer

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

func (*Server) Authenticate

func (this *Server) Authenticate() (val bool)

func (*Server) Close

func (this *Server) Close()

func (*Server) ListenAndServe

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

func (*Server) MaxPlayers

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

func (*Server) Motd

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

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) 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) 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) HasName

func (this *SessionRegistry) HasName(name 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 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