responsive design
This commit is contained in:
parent
63644ecc7f
commit
c617ddffc4
|
@ -18,8 +18,10 @@ h3 {
|
|||
margin: calc(2*var(--margin)) 0
|
||||
}
|
||||
|
||||
h1,h2,h3 {
|
||||
margin-bottom:0px;
|
||||
h1,
|
||||
h2,
|
||||
h3 {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
.header h1 {
|
||||
|
@ -130,3 +132,17 @@ body {
|
|||
align-content: center;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@media (max-width:600px) {
|
||||
#content {
|
||||
grid-template-areas:
|
||||
"header1"
|
||||
"content1"
|
||||
"content2"
|
||||
"footer1"
|
||||
"footer2"
|
||||
"footer3"
|
||||
;
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -316,7 +316,7 @@ ${indent}<li><a href="#${header.content.replace(/\s+/g, '-')}">${header.content}
|
|||
output += "<div class=\"toc\"><h2>Table of Contents</h2>" + listHTML + "</div>";
|
||||
break;
|
||||
case "title":
|
||||
output += `<h1>${title}</h1>`
|
||||
output += `<h1 style="margin-bottom:0.5em;text-align:center">${title}</h1>`
|
||||
break;
|
||||
case "span":
|
||||
output += `<span>${token.content}</span>`;
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
2
|
||||
Minecraft Rust Async Networking Proxy CRIU
|
||||
\title
|
||||
|
||||
\toc
|
||||
|
||||
# Minecraft servers are HUNGRY
|
||||
|
||||
They hunger for your ram and your cpu. This makes it either expensive or
|
||||
|
@ -50,21 +52,65 @@ minecraft protocol instead of HTTP.
|
|||
|
||||
## The Minecraft protocol
|
||||
|
||||
Minecraft implements its own protocol consistent of packets. My first idea was to see if anybody had created a
|
||||
rust library for dealing with minecraft packets.
|
||||
Minecraft implements its own protocol consistent of packets. My first idea
|
||||
was to see if anybody had created a rust library for dealing with minecraft
|
||||
packets.
|
||||
|
||||
While some did exist, most of them where unfinished or couldn't do what I wanted. [One crate](https://www.youtube.com/watch?v=E4WlUXrJgy4)
|
||||
was useful for seeing how an implementation of parsing packets was done, but ultimately I had to write my own parser.
|
||||
While some did exist, most of them where unfinished or couldn't do what I
|
||||
wanted. [One crate](https://www.youtube.com/watch?v=E4WlUXrJgy4) was useful
|
||||
for seeing how an implementation of parsing packets was done, but ultimately
|
||||
I had to write my own parser.
|
||||
|
||||
*images of minecraft protocol*
|
||||
***images of minecraft protocol***
|
||||
|
||||
## Detecting the subdomain
|
||||
|
||||
Luckily for me, the Minecraft procotol sends the full address it is trying to connect to during the handshake. This meant that I simply
|
||||
had to parse the handshake and extract the subdomain from the address, see if it matches any configured server, and then redirect all
|
||||
traffic to the internal port that server runs on.
|
||||
Luckily for me, the Minecraft procotol sends the full address it is trying to
|
||||
connect to during the handshake. This meant that I simply had to parse the
|
||||
handshake and extract the subdomain from the address, see if it matches any
|
||||
configured server, and then redirect all traffic to the internal port that
|
||||
server runs on.
|
||||
|
||||
*code explanation*
|
||||
***code explanation***
|
||||
|
||||
***show images of hibernation and starting***
|
||||
|
||||

|
||||

|
||||
|
||||
I've talked a bunch about this hibernation, but how does it actually work?
|
||||
|
||||
# cat /proc/$(ps aux | grep server.jar) > hibernation.txt
|
||||
|
||||
Finally being able to connect to the server it was time for the next item on the list.
|
||||
|
||||
<p style="text-align: center">✨**Hibernation**✨</p>
|
||||
|
||||
Now, instead of closing the server and restarting it when a player joined I
|
||||
wanted to hibernate the server and unhibernate it when someone joined.
|
||||
|
||||
I had a feeling this would be possible as this is basically how hibernation
|
||||
works for your system; it saves the memory to disk and loads it into memory
|
||||
again upon boot.
|
||||
|
||||
After a bit of searching I found [CRIU](https://criu.org/Main_Page), a program
|
||||
capable of suspending another program to disk.
|
||||
|
||||
Not only does it save the memory, it also saves all the file descriptors the
|
||||
program was using (and fails with a million cryptic error messages if any of the
|
||||
files where changed during hibernation)
|
||||
|
||||
There was a Rust crate for CRIU, however it was poorly documented and didnt support
|
||||
all the command line arguments I needed, so I resorted to calling the binary.
|
||||
|
||||
This led to the program halting until the unhibernated server closed again, but
|
||||
it was fixed with a simple fork.
|
||||
|
||||
The only downside to this approach is that CRIU requires root access in order
|
||||
to read the memory and file descriptors of another process.
|
||||
Running your minecraft server as root is probably not the smartest idea...
|
||||
|
||||
My solution was to not care about it and hope for the best :D
|
||||
|
||||
# Why aren't my chunks loading?
|
||||
|
||||
|
|
Loading…
Reference in a new issue