Documentation
¶
Index ¶
- Variables
- func DecodePacket(header packet.Header, payload []byte, shieldID int32) (pk packet.Packet, ok bool)
- func NewPacketLogger(verbose, clientSide bool) (*packetLogger, error)
- type Context
- type Handler
- type Handlers
- func (h Handlers) FilterResourcePack(s *Session, id string) bool
- func (h Handlers) GameDataModifier(s *Session, gameData *minecraft.GameData)
- func (h Handlers) OnBlobs(s *Session, blobs []protocol.CacheBlob)
- func (h Handlers) OnConnect(s *Session) (cancel bool)
- func (h Handlers) OnFinishedPack(s *Session, pack resource.Pack) error
- func (h Handlers) OnPlayerMove(s *Session)
- func (h Handlers) OnServerConnect(s *Session) (cancel bool, err error)
- func (h Handlers) OnSessionEnd(s *Session, wg *sync.WaitGroup)
- func (h Handlers) PacketCallback(s *Session, pk packet.Packet, toServer bool, timeReceived time.Time, ...) (packet.Packet, error)
- func (h Handlers) PacketRaw(s *Session, header packet.Header, payload []byte, src, dst net.Addr, ...)
- func (h Handlers) PlayerDataModifier(s *Session, identity *login.IdentityData, data *login.ClientData)
- func (h Handlers) SessionStart(s *Session, serverName string) error
- type PacketFunc
- type Player
- type ProxySettings
- type Session
- func (s *Session) AddCommand(exec func([]string) bool, cmd protocol.Command)
- func (s *Session) ClientWritePacket(pk packet.Packet) error
- func (s *Session) Disconnect()
- func (s *Session) DisconnectClient()
- func (s *Session) DisconnectServer()
- func (s *Session) IsClient(addr net.Addr) bool
- func (s *Session) Now() time.Time
- func (s *Session) Run() error
- func (s *Session) SendMessage(text string)
- func (s *Session) SendPopup(text string)
Constants ¶
This section is empty.
Variables ¶
View Source
var NewPacketCapturer func() *Handler
Functions ¶
func DecodePacket ¶
func NewPacketLogger ¶ added in v1.40.0
Types ¶
type Context ¶
type Context struct {
OnPlayerMove []func()
// contains filtered or unexported fields
}
func New ¶
func New(ctx context.Context, settings ProxySettings) (*Context, error)
New creates a new proxy context
func (*Context) AddHandler ¶
AddHandler adds a handler to the proxy
type Handler ¶
type Handler struct {
Name string
SessionStart func(s *Session, serverName string) error
PlayerDataModifier func(s *Session, identity *login.IdentityData, data *login.ClientData)
GameDataModifier func(s *Session, gameData *minecraft.GameData)
FilterResourcePack func(s *Session, id string) bool
OnFinishedPack func(s *Session, pack resource.Pack) error
PacketRaw func(s *Session, header packet.Header, payload []byte, src, dst net.Addr, timeReceived time.Time)
PacketCallback func(s *Session, pk packet.Packet, toServer bool, timeReceived time.Time, preLogin bool) (packet.Packet, error)
OnServerConnect func(s *Session) (cancel bool, err error)
OnConnect func(s *Session) (cancel bool)
OnSessionEnd func(s *Session, wg *sync.WaitGroup)
OnBlobs func(s *Session, blobs []protocol.CacheBlob)
OnPlayerMove func(s *Session)
}
type Handlers ¶ added in v1.39.1
type Handlers []*Handler
func (Handlers) FilterResourcePack ¶ added in v1.39.1
func (Handlers) GameDataModifier ¶ added in v1.39.1
func (Handlers) OnFinishedPack ¶ added in v1.39.1
func (Handlers) OnPlayerMove ¶ added in v1.51.0
func (Handlers) OnServerConnect ¶ added in v1.39.1
func (Handlers) OnSessionEnd ¶ added in v1.39.1
func (Handlers) PacketCallback ¶ added in v1.39.1
func (Handlers) PlayerDataModifier ¶ added in v1.46.0
func (h Handlers) PlayerDataModifier(s *Session, identity *login.IdentityData, data *login.ClientData)
type PacketFunc ¶
type ProxySettings ¶ added in v1.45.1
type ProxySettings struct {
ConnectInfo *connectinfo.ConnectInfo `opt:"Address" flag:"address" desc:"locale.remote_address"`
Debug bool `opt:"Debug" flag:"debug" desc:"locale.debug_mode"`
ExtraDebug bool `opt:"Extra Debug" flag:"extra-debug" desc:"extra debug info (packet.log)"`
Capture bool `opt:"Packet Capture" flag:"capture" desc:"Capture pcap2 file"`
ClientCache bool `opt:"Client Cache" flag:"client-cache" default:"true" desc:"Enable Client Cache"`
ListenAddress string `opt:"Listen Address" flag:"listen" default:"0.0.0.0:19132" desc:"example :19132 or 127.0.0.1:19132"`
}
type Session ¶ added in v1.39.1
type Session struct {
Server minecraft.IConn
Client minecraft.IConn
Player Player
// contains filtered or unexported fields
}
func NewSession ¶ added in v1.39.1
func NewSession(ctx context.Context, settings ProxySettings, addedPacks []resource.Pack, connectInfo *connectinfo.ConnectInfo, withClient bool) *Session
func (*Session) AddCommand ¶ added in v1.39.1
AddCommand adds a command to the command handler
func (*Session) ClientWritePacket ¶ added in v1.39.1
ClientWritePacket sends a packet to the client, nop if no client connected
func (*Session) Disconnect ¶ added in v1.39.1
func (s *Session) Disconnect()
Disconnect disconnects both the client and server
func (*Session) DisconnectClient ¶ added in v1.39.1
func (s *Session) DisconnectClient()
Disconnect disconnects the client
func (*Session) DisconnectServer ¶ added in v1.39.1
func (s *Session) DisconnectServer()
Disconnect disconnects from the server
func (*Session) SendMessage ¶ added in v1.39.1
SendMessage sends a chat message to the client
Source Files
¶
Click to show internal directories.
Click to hide internal directories.