spockbot.plugins.core.net module¶
Provides an asynchronous, crypto and compression aware socket for connecting to servers and processing incoming packet data. Coordinates with the Timers plugin to honor wall-clock timers
-
class
spockbot.plugins.core.net.
AESCipher
(shared_secret)¶ Bases:
object
-
decrypt
(data)¶
-
encrypt
(data)¶
-
-
class
spockbot.plugins.core.net.
NetCore
(sock, event, select)¶ Bases:
object
-
connect
(host='localhost', port=25565)¶
-
disable_crypto
()¶
-
enable_crypto
(secret_key)¶
-
push
(packet)¶
-
push_packet
(ident, data)¶
-
read_packet
(data=b'')¶
-
reset
(sock)¶
-
set_comp_state
(threshold)¶
-
set_proto_state
(state)¶
-
-
class
spockbot.plugins.core.net.
NetPlugin
(ploader, settings)¶ Bases:
spockbot.plugins.base.PluginBase
-
check_quit
()¶
-
defaults
= {'sock_quit': True, 'bufsize': 4096}¶
-
events
= {'event_kill': 'handle_kill', 'select_recv': 'handle_recv', 'SOCKET_HUP': 'handle_hup', 'PLAY<Disconnect': 'handle_disconnect', 'PLAY<Set Compression': 'handle_comp', 'LOGIN<Set Compression': 'handle_comp', 'select_send': 'handle_send', 'LOGIN<Disconnect': 'handle_login_disconnect', 'select_err': 'handle_err', 'HANDSHAKE>Handshake': 'handle_handshake', 'SOCKET_ERR': 'handle_err', 'LOGIN<Login Success': 'handle_login_success', 'event_tick': 'tick'}¶
-
handle_comp
(name, packet)¶ Handle Set Compression packets
-
handle_disconnect
(name, packet)¶
-
handle_err
(name, error)¶ Socket Error has occured
-
handle_handshake
(name, packet)¶ Change to whatever the next state is going to be
-
handle_hup
(name, data)¶ Socket has hung up
-
handle_kill
(name, data)¶ Try to shutdown the socket politely
-
handle_login_disconnect
(name, packet)¶
-
handle_login_success
(name, packet)¶ Change to Play state
-
handle_recv
(name, fileno)¶ Socket is ready to recieve data
-
handle_select_err
(name, fileno)¶
-
handle_send
(name, fileno)¶ Socket is ready to send data and send buffer has data to send
-
pl_announce
= ('Net',)¶
-
requires
= ('Event', 'Select', 'Timers')¶
-
reset_sock
()¶
-
tick
(name, data)¶
-