Documentation
¶
Index ¶
- type Conn
- type IpcClient
- func (c *IpcClient) BlockAddress(addr net.IP, duration time.Duration)
- func (c *IpcClient) DialContext(ctx context.Context, address string) (net.Conn, error)
- func (c *IpcClient) GetConn(key string) (*Conn, bool)
- func (c *IpcClient) GetOrCreateConn(path string) (*Conn, error)
- func (c *IpcClient) Listen(address string) (minecraft.NetworkListener, error)
- func (c *IpcClient) PingContext(ctx context.Context, address string) ([]byte, error)
- func (c *IpcClient) UnblockAddress(addr net.IP)
- type IpcHandler
- type IpcOptions
- type IpcServer
- func (l *IpcServer) BlockAddress(addr net.IP, duration time.Duration)
- func (l *IpcServer) Close()
- func (l *IpcServer) DialContext(ctx context.Context, address string) (net.Conn, error)
- func (l *IpcServer) GetConn(key string) (*Conn, bool)
- func (l *IpcServer) Listen(address string) (minecraft.NetworkListener, error)
- func (l *IpcServer) PingContext(ctx context.Context, address string) (response []byte, err error)
- func (l *IpcServer) UnblockAddress(addr net.IP)
- type IpcStatusProvider
- type RakNetUpstream
- type UpstreamHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
func (*Conn) OpenSession ¶
OpenSession opens a new session on the PM server
func (*Conn) ReadPacket ¶
func (c *Conn) ReadPacket() (packets []ipcprotocol.Packet, err error)
ReadPacket reads an IPC packet from the conn
func (*Conn) WriteCustomPacket ¶
WriteCustomPacket writes a custom packet (Encapsulated with session id set to -1)
func (*Conn) WritePacket ¶
func (c *Conn) WritePacket(pk ipcprotocol.Packet) error
WritePacket writes an IPC packet to the conn
type IpcClient ¶
type IpcClient struct {
// contains filtered or unexported fields
}
IpcClient implements a client that connects to an ipc server in PM. This is not recommended for proxy usage.
func NewIpcClient ¶
func NewIpcClient(opts *IpcOptions) *IpcClient
NewIpcClient returns a new IPC client
func (*IpcClient) BlockAddress ¶
BlockAddress blocks an IP address from accessing the server
func (*IpcClient) DialContext ¶
func (*IpcClient) Listen ¶
func (c *IpcClient) Listen(address string) (minecraft.NetworkListener, error)
func (*IpcClient) PingContext ¶
func (*IpcClient) UnblockAddress ¶
UnblockAddress allows a blocked IP address to access te server
type IpcHandler ¶
type IpcHandler interface {
minecraft.Network
// BlockAddress blocks an IP address from accessing the server
BlockAddress(addr net.IP, duration time.Duration)
// UnblockAddress allows a blocked IP address to access te server
UnblockAddress(addr net.IP)
GetConn(key string) (*Conn, bool)
// contains filtered or unexported methods
}
type IpcOptions ¶
type IpcOptions struct {
// Handler function for custom packets
CustomPacketHandler func(b []byte, serverKey string)
// Upstream handler for additional features intended for proxy usage
Upstream *UpstreamHandler
// Logger
Log *slog.Logger
}
type IpcServer ¶
type IpcServer struct {
// contains filtered or unexported fields
}
IpcServer implements a server that PM clients connect to. This is recommended for proxy usage.
func NewIPCServer ¶
func NewIPCServer(socketPath string, opts *IpcOptions) (*IpcServer, error)
NewIpcServer returns a new IPC server
func (*IpcServer) BlockAddress ¶
BlockAddress blocks an IP address from accessing the server
func (*IpcServer) DialContext ¶
func (*IpcServer) Listen ¶
func (l *IpcServer) Listen(address string) (minecraft.NetworkListener, error)
func (*IpcServer) PingContext ¶
func (*IpcServer) UnblockAddress ¶
UnblockAddress allows a blocked IP address to access te server
type IpcStatusProvider ¶
type IpcStatusProvider struct {
// contains filtered or unexported fields
}
func NewIpcStatusProvider ¶
func NewIpcStatusProvider(key string, handler IpcHandler) *IpcStatusProvider
func (*IpcStatusProvider) ServerStatus ¶
func (i *IpcStatusProvider) ServerStatus(int, int) minecraft.ServerStatus
type RakNetUpstream ¶
type RakNetUpstream struct {
// contains filtered or unexported fields
}
RakNet is an implementation of a RakNet v10 Network with an upstream handler.
func (RakNetUpstream) DialContext ¶
DialContext ...
func (RakNetUpstream) Listen ¶
func (r RakNetUpstream) Listen(address string) (minecraft.NetworkListener, error)
Listen ...
func (RakNetUpstream) PingContext ¶
func (r RakNetUpstream) PingContext(ctx context.Context, address string) (response []byte, err error)
PingContext ...
type UpstreamHandler ¶
type UpstreamHandler struct {
// contains filtered or unexported fields
}
func CreateGophertunnelUpstreamHandler ¶
func CreateGophertunnelUpstreamHandler(name string) *UpstreamHandler
func NewUpstreamHandler ¶
func NewUpstreamHandler(parent raknet.UpstreamPacketListener) *UpstreamHandler
NewUpstreamHandler returns an upstream packet listener with ip block and bandwidth monitoring
func (*UpstreamHandler) ListenPacket ¶
func (q *UpstreamHandler) ListenPacket(network, address string) (conn net.PacketConn, err error)