-
-
Notifications
You must be signed in to change notification settings - Fork 51
feat(auto-scale-up): add fake online, server status cache, and seamless connection during scale-up #406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
alexfrs69
wants to merge
13
commits into
itzg:main
Choose a base branch
from
alexfrs69:feat/autoscale-status-response
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat(auto-scale-up): add fake online, server status cache, and seamless connection during scale-up #406
Changes from 10 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
e5ad0f3
feat: add a fake status response when autoscaling is up
alexfrs69 5c0baf8
feat: add client connection hang
alexfrs69 18f8aaa
fix: indentation convertion
alexfrs69 0132bac
refactor: use retry library
alexfrs69 b0a5a2e
refactor: bundle config for connector
alexfrs69 e2e7b91
fix: fmt
alexfrs69 9f3262c
feat: add status cache
alexfrs69 9ef5492
fix: test
alexfrs69 8e71b2a
fix: enable fakeOnline only if autoscale up && kube
alexfrs69 861322b
fix: logs
alexfrs69 9cb38c6
refactor: separate functions
alexfrs69 8b02552
fix: remove ttl from cache
alexfrs69 096cdb6
fix: `StatusPlayerEntry`
alexfrs69 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| package mcproto | ||
|
|
||
| import ( | ||
| "encoding/json" | ||
| "io" | ||
| ) | ||
|
|
||
| func WriteStatusResponse(w io.Writer, status *StatusResponse) error { | ||
| data, err := json.Marshal(status) | ||
| if err != nil { | ||
| return err | ||
| } | ||
|
|
||
| jsonLen := encodeVarInt(len(data)) | ||
| payload := append(jsonLen, data...) | ||
| return WritePacket(w, 0x00, payload) | ||
| } | ||
|
|
||
| func WritePacket(w io.Writer, packetID int, data []byte) error { | ||
| packet := append(encodeVarInt(packetID), data...) | ||
| length := encodeVarInt(len(packet)) | ||
| _, err := w.Write(append(length, packet...)) | ||
| return err | ||
| } | ||
|
|
||
| // encodeVarInt encodes an int as a Minecraft VarInt. | ||
| func encodeVarInt(value int) []byte { | ||
| var buf []byte | ||
| for { | ||
| temp := byte(value & 0x7F) | ||
| value >>= 7 | ||
| if value != 0 { | ||
| temp |= 0x80 | ||
| } | ||
| buf = append(buf, temp) | ||
| if value == 0 { | ||
| break | ||
| } | ||
| } | ||
| return buf | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.