Updated SubData (markdown)

ME1312 2019-06-26 14:48:54 -04:00
parent ba3df4439f
commit 5e05023be0

@ -1,28 +1,20 @@
SubData, in a similar fashion to the [Plugin Messaging Channel (PMC)](https://www.spigotmc.org/wiki/bukkit-bungee-plugin-messaging-channel/), allows for the various components in your SubServers network to communicate with each other. However, unlike the PMC, it doesn't rely on a player's connection to send and receive data. This ultimately makes it a better choice to use if you need to send data which is unrelated to players.
# SubData Direct
This is the current edition of SubData. SubServers.Bungee opens a TCP port (default 4391) for other programs to communicate to each other with via [MessagePack](https://msgpack.org) encoded Packets. The packets are structured like this:
```
{
"f": "/127.0.0.1:54366",
"n": "exampleplugin",
"h": "ExamplePacket",
"v": "2.11.0a",
"c": {
"data": "This is a test packet"
}
}
```
`f` &mdash; Packet Forward Address (Server-bound only, Optional): Destination to forward packet to.<br>
`n` &mdash; Packet Channel: Used to determine which set of decoders to select from.<br>
`h` &mdash; Packet Handle: Used to determine which decoder to use from the set selected.<br>
`v` &mdash; Packet Version: Used to verify that the incoming packet is compatible with the decoder.<br>
`c` &mdash; Packet Contents (Optional): This is the data that will be passed to the receiving code.<br>
# SubData 2
This is the latest edition of SubData. SubServers.Bungee will open port 4391 (by default) so that all the SubServers apps can communicate with each other.
Of course, SubAPI handles all this internal stuff for you, but if you are looking to create a custom application this information may be useful to you. The SubAPI way to create a packet is to create a new class and implement `PacketIn` and/or `PacketOut` and register it via `SubData.registerPacket()`.
## Usage
SubData has grown beyond SubServers into [its very own project](https://github.com/ME1312/SubData-2). This means that some things, like the API and Protocol Formatting, have been moved to more appropriate locations on [its new wiki](https://github.com/ME1312/SubData-2/wiki). Here are some topics you may be interested in:
> Sending and Receiving Messages<br>
> Working with Multiple Data Channels<br>
> Creating Custom Ciphers<br>
> [Network States](https://github.com/ME1312/SubData-2/wiki/Protocol-States)<br>
> [Protocol Formatting](https://github.com/ME1312/SubData-2/wiki/Protocol-Format)<br>
<br>
## Encryption
SubData packets may be encrypted. To disable encryption, go to your SubData settings and set `Encryption` to `None`.
SubServers allows SubData packets to be encrypted with the cipher you choose via the configuration. To disable encryption, go to your SubData settings and set `Encryption` to `None`.
### AES
`Encryption`: `AES`, `AES-128`, `AES-192`, `AES-256`<br>
<br>
@ -30,11 +22,9 @@ SubData natively supports AES 128, 192, and 256 bit password-based encryption if
For some java installations, AES 192 and/or 256 bit encryption has been disabled. You can download a fix for this [here](http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html). For more information, [click here](https://crypto.stackexchange.com/questions/20524/why-there-are-limitations-on-using-encryption-with-keys-beyond-certain-length).<br>
### Custom Ciphers
SubData allows it's packet structure to be modified before the data is actually sent through the [SubData Cipher API](https://src.me1312.net/jenkins/job/SubServers%20Platform/javadoc/SubServers.Bungee/net/ME1312/SubServers/Bungee/Network/Cipher.html). The idea is that the sender will modify the way the packet is presented, and the receiver should be able to interpret the sender's presentation in order to revert it to it's original state.
### RSA + AES
`Encryption`: `RSA/AES`, `RSA-2048/AES-128`, `RSA-3072/AES-192`, `RSA-4096/AES-256`<br>
<br>
So, what's better than some good ol' password-based encryption? How about a system where we login using a signature file, send over a completely randomized password that was encrypted using that signature, and then start encrypting using that randomized password. Yeah, sounds better to me, too.
There are two limitations to Ciphers:
* Ciphers can only work with the data types provided by MessagePack
* Ciphers must be able to read what they have written
Once you have [registered your cipher](https://src.me1312.net/jenkins/job/SubServers%20Platform/javadoc/SubServers.Bungee/net/ME1312/SubServers/Bungee/Network/SubDataServer.html#addCipher-java.lang.String-net.ME1312.SubServers.Bungee.Network.Cipher-), you may specify it by name in the SubData settings for `Encryption`. Make sure it is registered before SubData is initialized!
In this mode, each SubData connection uses it's own randomized password to AES encrypt and decrypt data after login. Even though you may be sending the same data, no two connections are the same.<br>