BlockServerProject / JRakLib

A port of the PHP MCPE RakNet networking library: RakLib.
http://blockserverproject.github.io/JRakLib/
GNU Lesser General Public License v3.0
5 stars 5 forks source link

Add connection type support #5

Closed whirvis closed 7 years ago

whirvis commented 7 years ago

This is not a bug, but rather a feature request.

~~You see, I have added a feature to my API, JRakNet, that allows for the user to get the protocol implementation when their server is pinged, they discover a server, when they connect to a server, or when a client connects to them. The way this works is by appending a sequence of magic bytes at the end of packets that would be needed to accomplish this (Which is only 4) and when receiving said packets seeing if there is enough data to check the magic header and ID byte. The current ID's in JRakNet mean the following:~

- ID 0: Vanilla (Official RakNet client/server) - ID 1: JRakNet - ID 2: RakLib - ID 3: JRakLib+

The code needed to accomplish this can be found in this commit. Whether or not you want to have this feature is of course up to you, and if you want me to code it in myself I would be happy to do a pull request! :D

Thanks! -Whirvis

The fork for the code to do this has been deleted, as the code to accomplish this feature has been rewritten out of necessity.

alejzeis commented 7 years ago

Currently I'm not really working on this project much more, but if you want to you can create a pull request and I'll review it and merge it. It would be a good help to.

On Aug 9, 2017 20:59, "Trent Summerlin" notifications@github.com wrote:

This is not a bug, but rather a feature request.

You see, I have added a feature to my API, JRakNet, that allows for the user to get the protocol implementation when their server is pinged, they discover a server, when they connect to a server, or when a client connects to them. The way this works is by appending a sequence of magic bytes at the end of packets that would be needed to accomplish this (Which is only 4) and when receiving said packets seeing if there is enough data to check the magic header and ID byte. The current ID's in JRakNet mean the following:

  • ID 0: Vanilla (Regular RakNet client/Implementation without support for sending it's implementation)
  • ID 1: JRakNet
  • ID 2: RakLib
  • ID 3: JRakLib
  • ID 4: JRakLib+ (JRakLib Plus)

The code needed to accomplish this can be found in this commit https://github.com/JRakNet/JRakNet/commit/9ada391ba0a34b4967795a2db131e7618f369ae3. Whether or not you want to have this feature is of course up to you, and if you want me to code it in myself I would be happy to do a pull request! :D

Thanks! -MarfGamer

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/BlockServerProject/JRakLib/issues/5, or mute the thread https://github.com/notifications/unsubscribe-auth/AFtT5s5eTonjcQ-LXBpAi7n7A4I8kG_jks5sWmQbgaJpZM4Oy2c6 .

whirvis commented 7 years ago

@jython234 Thanks! I'm assuming this goes for JRakLibPlus as well?

alejzeis commented 7 years ago

Yeah, if you had to have a priority I would prefer jraklibplus get it first as it is what I think is the more advanced of the two as this is just a direct port from the PHP version.

On Aug 9, 2017 21:32, "Trent Summerlin" notifications@github.com wrote:

@jython234 https://github.com/jython234 Thanks! I'm assuming this goes for JRakLibPlus as well?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/BlockServerProject/JRakLib/issues/5#issuecomment-321433601, or mute the thread https://github.com/notifications/unsubscribe-auth/AFtT5iI0AyCb7vFrlTYOAtDe2mkfBQ-Eks5sWmuygaJpZM4Oy2c6 .

whirvis commented 7 years ago

I realized that JRakLib was stuck on protocol 7, and not 8, meaning it could not connect to any servers. I'm going to only add this support for JRakLibPlus, as me adding it to JRakLib would be completely meaningless.

I found that out the hard way after spending an hour on coding the functionality D:

alejzeis commented 7 years ago

Makes sense, yeah I stopped updating JRakLib a while back.

On Aug 9, 2017 22:55, "Trent Summerlin" notifications@github.com wrote:

Closed #5 https://github.com/BlockServerProject/JRakLib/issues/5.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/BlockServerProject/JRakLib/issues/5#event-1200237393, or mute the thread https://github.com/notifications/unsubscribe-auth/AFtT5uz1NWNHRfJ4UYbXLFIC-_vkRGcFks5sWn8zgaJpZM4Oy2c6 .

whirvis commented 7 years ago

I'm making progress on the JRakLibPlus feature! However I was thinking, should I use an ID system or just use Strings for the connection types? Because if we used ID's then it would be really hard to list your implementation as all versions of it had to have your ID, but if we used strings as long as the implementation had support it would work!

whirvis commented 7 years ago

I found a glitch in the OpenConnectionRequest2Packet class, in the decode you are using an unsigned short to get the client ID instead of reading a long

alejzeis commented 7 years ago

I think ID is the best choice as to reduce overhead as much as possible. Also, doesn't official raknet drop packets which have extra bytes, which would cause problems for this?

whirvis commented 7 years ago

Well this is setup so RakNet does not have to change at all, this works by adding a few extra bytes at the end of UnconnectedPing, UnconnectedPong, OpenConnectionRequestTwo, and OpenConnectionResponseTwo. As long as your API implementation does not drop extra bytes it should not be a problem. What I think will do is add a note in the documentation that says to message me if you want your implementation listed and I'll make forks for all the other implementations that are listed. Does that sound good?

alejzeis commented 7 years ago

I guess as long as vanilla raknet still works with those extra bytes.

On Aug 10, 2017 12:20, "Trent Summerlin" notifications@github.com wrote:

Well this is setup so RakNet does not have to change at all, this works by adding a few extra bytes at the end of UnconnectedPing, UnconnectedPong, OpenConnectionRequestTwo, and OpenConnectionResponseTwo. As long as your API implementation does not drop extra bytes it should not be a problem. What I think will do is add a note in the documentation that says to message me if you want your implementation listed and I'll make forks for all the other implementations that are listed. Does that sound good?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/BlockServerProject/JRakLib/issues/5#issuecomment-321617228, or mute the thread https://github.com/notifications/unsubscribe-auth/AFtT5sFb3nVxMf7_MMSiDFZhav2uR6xDks5sWzuygaJpZM4Oy2c6 .

whirvis commented 7 years ago

Vanilla RakNet is not affected by it at all :) I have also finished the pull request! :D

alejzeis commented 7 years ago

Sounds good then.

On Aug 10, 2017 15:17, "Trent Summerlin" notifications@github.com wrote:

Vanilla RakNet is not affected by it at all :)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/BlockServerProject/JRakLib/issues/5#issuecomment-321661710, or mute the thread https://github.com/notifications/unsubscribe-auth/AFtT5r5yRnnwYvjN_iXbF4AG7yTzP6Fiks5sW2VhgaJpZM4Oy2c6 .