forked from realDragonium/Ultraviolet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored listener code, tests dont work atm
- Loading branch information
1 parent
aac5121
commit f59f4ac
Showing
17 changed files
with
329 additions
and
323 deletions.
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
@@ -1,13 +1,9 @@ | ||
# UltraViolet | ||
# Ultraviolet | ||
## What is it | ||
[Infrared](https://github.com/haveachin/infrared) but different. Not even sure or this will be a real production ready product some day, its a different structure I want to try. | ||
|
||
|
||
## Some notes | ||
### Tableflip | ||
This has implemented [tableflip](https://github.com/cloudflare/tableflip) which should make it able to reload/restart UltraViolet without closing existing connections on Linux and macOS. UltraViolet should still be usable on windows (testing purposes only pls). | ||
This has implemented [tableflip](https://github.com/cloudflare/tableflip) which should make it able to reload/restart Ultraviolet without closing existing connections on Linux and macOS. Ultraviolet should still be usable on windows (testing purposes only pls). | ||
Check their [documentation](https://pkg.go.dev/github.com/cloudflare/tableflip) to know what or how. | ||
|
||
|
||
## Lists on things to try out | ||
- https://github.com/cenkalti/backoff |
This file contains 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,70 @@ | ||
package config | ||
|
||
import "github.com/realDragonium/Ultraviolet/mc" | ||
|
||
type ServerConfig struct { | ||
BackendCfg BackendConnConfig `json:"backend"` | ||
ListenCfg ListenConfig `json:"listen"` | ||
FallOverCfg FallOverConfig `json:"fallOver"` | ||
|
||
ConnLimitBackend int `json:"connPerSec"` | ||
} | ||
|
||
type BackendConnConfig struct { | ||
ProxyBind string `json:"proxyBind"` | ||
ProxyTo string `json:"proxyTo"` | ||
SendProxyProtocol bool `json:"sendProxyProtocol"` | ||
RealIP bool `json:"realIp"` | ||
} | ||
|
||
type ListenConfig struct { | ||
MainDomain string `json:"mainDomain"` | ||
ExtraDomains []string `json:"extraDomains"` | ||
ListenTo string `json:"listenTo"` | ||
} | ||
|
||
type FallOverConfig struct { | ||
DisconnectMessage string `json:"disconnectMessage"` | ||
OfflineStatus mc.AnotherStatusResponse `json:"offlineStatus"` | ||
} | ||
|
||
func DefaultServerConfig() ServerConfig { | ||
return ServerConfig{ | ||
BackendCfg: BackendConnConfig{ | ||
ProxyBind: "0.0.0.0", | ||
ProxyTo: ":25566", | ||
}, | ||
ListenCfg: ListenConfig{ | ||
MainDomain: "localhost", | ||
ListenTo: ":25565", | ||
}, | ||
FallOverCfg: FallOverConfig{ | ||
DisconnectMessage: "Sorry {{username}}, but the server is offline.", | ||
OfflineStatus: mc.AnotherStatusResponse{ | ||
Name: "Ultraviolet", | ||
Protocol: 755, | ||
Description: "Some broken proxy", | ||
}, | ||
}, | ||
ConnLimitBackend: 5, | ||
} | ||
} | ||
|
||
type UltravioletConfig struct { | ||
NumberOfWorkers int `json:"numberOfWorkers"` | ||
ReceiveProxyProtocol bool `json:"receiveProxyProtocol"` | ||
|
||
DefaultStatus mc.AnotherStatusResponse `json:"defaultStatus"` | ||
} | ||
|
||
func DefaultUltravioletConfig() UltravioletConfig { | ||
return UltravioletConfig{ | ||
NumberOfWorkers: 5, | ||
ReceiveProxyProtocol: false, | ||
DefaultStatus: mc.AnotherStatusResponse{ | ||
Name: "Ultraviolet", | ||
Protocol: 755, | ||
Description: "Some broken proxy", | ||
}, | ||
} | ||
} |
This file contains 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.