go-mc: github.com/Tnze/go-mc/net Index | Files | Directories

package net

import "github.com/Tnze/go-mc/net"

Package net pack network connection for Minecraft.

Index

Package Files

conn.go interface.go rcon.go

type Conn Uses

type Conn struct {
    Socket net.Conn
    io.ByteReader
    io.Writer
    // contains filtered or unexported fields
}

Conn is a minecraft Connection

func DialMC Uses

func DialMC(addr string) (*Conn, error)

DialMC create a Minecraft connection

func DialMCTimeout Uses

func DialMCTimeout(addr string, timeout time.Duration) (*Conn, error)

DialMCTimeout acts like DialMC but takes a timeout.

func WrapConn Uses

func WrapConn(conn net.Conn) *Conn

WrapConn warp an net.Conn to MC-Conn Helps you modify the connection process (eg. using DialContext).

func (*Conn) Close Uses

func (c *Conn) Close() error

Close close the connection

func (*Conn) ReadPacket Uses

func (c *Conn) ReadPacket() (pk.Packet, error)

ReadPacket read a Packet from Conn.

func (*Conn) SetCipher Uses

func (c *Conn) SetCipher(ecoStream, decoStream cipher.Stream)

SetCipher load the decode/encode stream to this Conn

func (*Conn) SetThreshold Uses

func (c *Conn) SetThreshold(t int)

SetThreshold set threshold to Conn. The data packet with length longer then threshold will be compress when sending.

func (*Conn) WritePacket Uses

func (c *Conn) WritePacket(p pk.Packet) error

WritePacket write a Packet to Conn.

type Listener Uses

type Listener struct{ net.Listener }

A Listener is a minecraft Listener

func ListenMC Uses

func ListenMC(addr string) (*Listener, error)

ListenMC listen as TCP but Accept a mc Conn

func (Listener) Accept Uses

func (l Listener) Accept() (Conn, error)

Accept a minecraft Conn

type RCONClientConn Uses

type RCONClientConn interface {
    Cmd(cmd string) error
    Resp() (resp string, err error)
}

func DialRCON Uses

func DialRCON(addr string, password string) (client RCONClientConn, err error)

type RCONConn Uses

type RCONConn struct {
    net.Conn
    ReqID int32
}

func (*RCONConn) AcceptCmd Uses

func (r *RCONConn) AcceptCmd() (string, error)

func (*RCONConn) AcceptLogin Uses

func (r *RCONConn) AcceptLogin(password string) error

func (*RCONConn) Cmd Uses

func (r *RCONConn) Cmd(cmd string) error

func (*RCONConn) ReadPacket Uses

func (r *RCONConn) ReadPacket() (RequestID, Type int32, Payload string, err error)

func (*RCONConn) Resp Uses

func (r *RCONConn) Resp() (resp string, err error)

func (*RCONConn) RespCmd Uses

func (r *RCONConn) RespCmd(resp string) error

func (*RCONConn) WritePacket Uses

func (r *RCONConn) WritePacket(RequestID, Type int32, Payload string) error

type RCONListener Uses

type RCONListener struct{ net.Listener }

func ListenRCON Uses

func ListenRCON(addr string) (*RCONListener, error)

func (*RCONListener) Accept Uses

func (r *RCONListener) Accept() (RCONServerConn, error)

type RCONServerConn Uses

type RCONServerConn interface {
    AcceptLogin(password string) error
    AcceptCmd() (cmd string, err error)
    RespCmd(resp string) error
}

type ReadWriter Uses

type ReadWriter interface {
    Reader
    Writer
}

type Reader Uses

type Reader interface {
    ReadPacket() (pk.Packet, error)
}

type Writer Uses

type Writer interface {
    WritePacket(p pk.Packet) error
}

Directories

PathSynopsis
CFB8
packet

Package net imports 11 packages (graph) and is imported by 1 packages. Updated 2019-10-20. Refresh now. Tools for package owners.