@@ -2,12 +2,12 @@ unit class Net::RCON;
22
33use experimental : pack;
44
5- constant {
6- SERVERDATA_RESPONSE_VALUE => 0 ,
7- SERVERDATA_AUTH_RESPONSE => 2 ,
8- SERVERDATA_EXECCOMMAND => 2 ,
9- SERVERDATA_AUTH => 3
10- } ;
5+ enum SERVERDATA (
6+ RESPONSE_VALUE => 0 ,
7+ AUTH_RESPONSE => 2 ,
8+ EXECCOMMAND => 2 ,
9+ AUTH => 3 ,
10+ ) ;
1111
1212sub connect (: $ hostname , : $ port , : $ password ) {
1313
@@ -24,15 +24,15 @@ sub connect(:$hostname, :$port, :$password) {
2424
2525sub authenticate (: $ connection , : $ password ) {
2626
27- my $ type = SERVERDATA_AUTH ;
27+ my $ packet- type = SERVERDATA::AUTH ;
2828 my $ data = $ password ;
2929
30- send(: $ connection , : $ type , : $ data );
30+ send(: $ connection , : $ packet- type , : $ data );
3131}
3232
33- sub send (: $ connection , : $ type , : $ data ) {
33+ sub send (: $ connection , : $ packet- type , : $ data ) {
3434
35- my $ payload = pack (" VV" , 1 , $ type ) ~ $ data ~ pack (" xx" );
35+ my $ payload = pack (" VV" , 1 , $ packet- type ) ~ $ data ~ pack (" xx" );
3636 $ payload = pack (" V" , $ payload . bytes ) ~ $ payload ;
3737
3838 $ connection . write ($ payload );
0 commit comments