mirror of
https://github.com/ME1312/SubServers-2.git
synced 2024-11-25 03:35:26 +01:00
Updated SubData (markdown)
parent
6a3c0d0e80
commit
69f74c58bb
28
SubData.md
28
SubData.md
@ -1,7 +1,7 @@
|
||||
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 JSON Packets. The packets look like this before they are minified and converted to Base64:
|
||||
# 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",
|
||||
@ -19,14 +19,22 @@ This is the current edition of SubData. SubServers.Bungee opens a TCP port (defa
|
||||
`v` — Packet Version: Used to verify that the incoming packet is compatible with the decoder.<br>
|
||||
`c` — Packet Contents (Optional): This is the data that will be passed to the receiving code.<br>
|
||||
|
||||
Of course, SubAPI handles this all 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()`.
|
||||
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()`.
|
||||
|
||||
### Encryption
|
||||
SubData supports AES 128, 192, and 256 bit password-based encryption if you need to turn up the security. It does this by encrypting the previously mentioned JSON packets with AES before converting the output to Base64. Here is an example of what this type of encryption can do for you:<br>
|
||||
`{"n":"subservers","h":"DownloadLang","v":"2.11.0a"}`<br>
|
||||
This simple language file request now becomes:<br>
|
||||
`eyJoIjoiRG93bmxvYWRMYW5nIiwibiI6InN1YnNlcnZlcnMiLCJ2IjoiMi4xMS4wYSJ9`<br>
|
||||
## Encryption
|
||||
SubData packets may be encrypted. To disable encryption, go to your SubData settings and set `Encryption` to `None`.
|
||||
### AES
|
||||
`Encryption`: `AES`, `AES-128`, `AES-192`, `AES-256`<br>
|
||||
<br>
|
||||
SubData natively supports AES 128, 192, and 256 bit password-based encryption if you need to turn up the security. It does this by turning those previously mentioned packets into AES encrypted binary data and sending that instead.
|
||||
|
||||
For some installs, java has disabled 192 and/or 256 bit encryption. 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).
|
||||
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>
|
||||
|
||||
To enable/disable encryption, go to your SubData settings and use one of the following values for `Encryption`: `None`, `AES-128` (`AES` for short), `AES-192`, or `AES-256`.
|
||||
### 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.
|
||||
|
||||
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!
|
Loading…
Reference in New Issue
Block a user