Documentation ¶
Index ¶
- Constants
- Variables
- func GenerateSessionHash(serverID string, sharedSecret, publicKey []byte) string
- func Handle(state protocol.State, packetID byte, handler Handler)
- func HandleFunc(state protocol.State, packetID byte, ...)
- func ListenAndServe(addr string, handler Handler) error
- func MojangSessionServerURLHasJoined(username, sessionHash string) string
- func MojangSessionServerURLHasJoinedWithIP(username, sessionHash, ip string) string
- type Conn
- type DefaultSessionEncrypter
- type Handler
- type HandlerFunc
- type Listener
- type MojangSessionAuthenticator
- type PacketPeeker
- type PacketReader
- type PacketWriter
- type Player
- type PlayerInfo
- type PlayersInfo
- type Request
- func (r Request) ClonePacket() protocol.Packet
- func (r Request) Conn() Conn
- func (r *Request) Player() Player
- func (r Request) ProtocolState() protocol.State
- func (r Request) Server() *Server
- func (r *Request) UpdatePlayerSkin(skin Skin)
- func (r *Request) UpdatePlayerUUID(uuid uuid.UUID)
- func (r *Request) UpdatePlayerUsername(username string)
- type ResponseWriter
- type ServeMux
- type Server
- type Session
- type SessionAuthenticator
- type SessionEncrypter
- type Sha1Hash
- type Skin
- type StatusResponse
- type Version
Constants ¶
View Source
const DefaultAddr string = ":25565"
Variables ¶
View Source
var DefaultServeMux = NewServeMux()
Functions ¶
func GenerateSessionHash ¶
func HandleFunc ¶
func HandleFunc(state protocol.State, packetID byte, handler func(w ResponseWriter, r *Request))
func ListenAndServe ¶
Types ¶
type Conn ¶
type Conn interface { net.Conn PacketWriter PacketReader PacketPeeker State() protocol.State Threshold() int }
Conn is a minecraft Connection
type DefaultSessionEncrypter ¶
type DefaultSessionEncrypter struct {
// contains filtered or unexported fields
}
func (*DefaultSessionEncrypter) DecryptAndVerifySharedSecret ¶
func (encrypter *DefaultSessionEncrypter) DecryptAndVerifySharedSecret(r *Request, sharedSecret, verifyToken []byte) ([]byte, error)
func (*DefaultSessionEncrypter) GenerateVerifyToken ¶
func (encrypter *DefaultSessionEncrypter) GenerateVerifyToken(r *Request) ([]byte, error)
func (*DefaultSessionEncrypter) PublicKey ¶
func (encrypter *DefaultSessionEncrypter) PublicKey() []byte
type Handler ¶
type Handler interface {
ServeProtocol(w ResponseWriter, r *Request)
}
type HandlerFunc ¶
type HandlerFunc func(w ResponseWriter, r *Request)
func (HandlerFunc) ServeProtocol ¶
func (f HandlerFunc) ServeProtocol(w ResponseWriter, r *Request)
type MojangSessionAuthenticator ¶
type MojangSessionAuthenticator struct{}
func (*MojangSessionAuthenticator) AuthenticateSession ¶
func (auth *MojangSessionAuthenticator) AuthenticateSession(username, sessionHash string) (Session, error)
func (*MojangSessionAuthenticator) AuthenticateSessionPreventProxy ¶
func (auth *MojangSessionAuthenticator) AuthenticateSessionPreventProxy(username, sessionHash, ip string) (Session, error)
type PacketPeeker ¶
type PacketReader ¶
type PacketWriter ¶
type PlayerInfo ¶
type PlayersInfo ¶
type PlayersInfo struct { MaxPlayers int `json:"max"` PlayersOnline int `json:"online"` Players []PlayerInfo `json:"sample"` }
type Request ¶
func (Request) ClonePacket ¶
ClonePacket makes a deep copy of the packet and returns it.
func (Request) ProtocolState ¶
func (*Request) UpdatePlayerSkin ¶
func (*Request) UpdatePlayerUUID ¶
func (*Request) UpdatePlayerUsername ¶
type ResponseWriter ¶
type ServeMux ¶
type ServeMux struct {
// contains filtered or unexported fields
}
func NewServeMux ¶
func NewServeMux() *ServeMux
func (*ServeMux) HandleFunc ¶
func (*ServeMux) ServeProtocol ¶
func (mux *ServeMux) ServeProtocol(w ResponseWriter, r *Request)
type Server ¶
type Server struct { ID string Addr string Encryption bool MaxPlayers int SessionEncrypter SessionEncrypter SessionAuthenticator SessionAuthenticator Handler Handler // contains filtered or unexported fields }
Server defines the struct of a running Minecraft server
func (*Server) ListenAndServe ¶
func (*Server) PlayersInfo ¶
func (srv *Server) PlayersInfo() PlayersInfo
type SessionAuthenticator ¶
type SessionEncrypter ¶
type SessionEncrypter interface { PublicKey() []byte GenerateVerifyToken(r *Request) ([]byte, error) }
func NewDefaultSessionEncrypter ¶
func NewDefaultSessionEncrypter() (SessionEncrypter, error)
type Sha1Hash ¶
func NewSha1Hash ¶
func NewSha1Hash() Sha1Hash
type StatusResponse ¶
type StatusResponse struct { Version Version PlayersInfo PlayersInfo IconPath string MOTD string }
func (StatusResponse) JSON ¶
func (sr StatusResponse) JSON() ([]byte, error)
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
_examples
|
|
cfb8
All credits go to Ilmari Karonen Source: https://stackoverflow.com/questions/23897809/different-results-in-go-and-pycrypto-when-using-aes-cfb/37234233#37234233
|
All credits go to Ilmari Karonen Source: https://stackoverflow.com/questions/23897809/different-results-in-go-and-pycrypto-when-using-aes-cfb/37234233#37234233 |
Click to show internal directories.
Click to hide internal directories.