Skip to content
Dragonium edited this page Sep 13, 2021 · 5 revisions

Few details to keep in mind

  • Default config directory is /etc/ultraviolet
  • Time values are formatted in go's duration format, valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". They can be used in combination with each other "1m30s".
  • You can use the default config values to your advantage, if you also want to have the same value for a server as the default config value you can simple exclude the value in your own config. This way it will use the default config value.
  • If its a place where you can use an ipv4, ipv6 should also work as well. Not specifying an ip and only using :25565 will/might end up using either or both.
  • The main config file needs to have the name ultraviolet.json. If this doesnt exists it will create one for you.
  • Every server config needs to end with .json. Server config files will be searched for recursively in the config directory.

Main config

Minimal

{}

Full

{
    "listenTo": ":25565",
    "defaultStatus": {
        "name": "My Shield",
        "protocol": 755,
        "text": "Some proxy didnt proxy"
    },
    "numberOfWorkers": 10,
    "numberOfListeners": 1,
    "acceptProxyProtocol": false,
    "enablePrometheus": true,
    "prometheusBind": ":9100",
    "apiBind": "127.0.0.1:9090", 
    "useTableflip": true,
    "pidFile": "/etc/ultraviolet/uv.pid"
}

Options

Listen Address

This is the address it will listen to when waiting for clients to connected. The default value is ":25565".

"listenTo": ":25565"

Default status

This will generate the status response it will send to client when they try request the status of a server which isnt known by the Ultraviolet instance.

"defaultStatus": {
    "name": "Ultraviolet",
    "protocol": 0,
    "text": "Some proxy didnt proxy"
}

Amount of workers

It will run as many 'workers' parallel to each other to process incoming connections. The worker will read the clients packets and will respond to it or create a proxy channel in a different goroutine. Dont set this value to a high number otherwise you might problems with the FD's or it might crash/freeze when its trying to process too many connections at the same time. The default value is 10 and most people probably don't need to change this.

"numberOfWorkers": "25",

Amount of listeners

This will run listeners parallel to each other and pass them to a channel which will be read by the workers. The default value is 1 and most (if not all) people dont need to change this value.

"numberOfListeners": 1

Receive Proxy Protocol V2

When enabled it will expect from every connection to receive an proxy protocol header before receiving the handshake. If it does not receive it within the given deadline, it will close the connection. There is not a way (currently) to make it optional to receive one or not.

"acceptProxyProtocol": false

Prometheus

When turned on, it will make it possible to export prometheus values to use in a dashboard. By default this is turned on.

"enablePrometheus": true

Prometheus Bind

When prometheus has been turned on, this will be used as listen address to receive the scrape requests on. By default this is ":9100".

"prometheusBind": ":9019"

Api Bind

This is the listen address ultraviolet will use for its api, even when you dont wanna use it externally it is still required to run certain commands like reload. By default this is "127.0.0.1:9090".

"apiBind": "127.0.0.1:9090"

Tableflip usage

Turn it on or off. On by default if youre not on windows or are running it in docker, in both cases it will be turned off.

 "useTableflip": true

PID file path

Set the location of the pid file which will be used when Tableflip is turned on. When left empty it will use the main config folder as location.

"pidFile": "/etc/ultraviolet/uv.pid"

Server config

Minimal

These are the config values which are necessary to use the config

{
    "domains": ["localhost"],
    "proxyTo": ":25566"
}

Full

{
    "name": "test-server",
    "domains": ["localhost", "127.0.0.1", "0.0.0.0"],
    "proxyTo": ":25566",
    "proxyBind": "127.0.0.1",
    "dialTimeout": "1s",
    "useRealIPv2.4": false,
    "useRealIPv2.5": false,
    "realIPKeyPath": "",
    "sendProxyProtocol": false,
    "disconnectMessage": "{\"text\": \"Sorry, but the server is offline.\"}",
    "cacheStatus": true,
    "validProtocol": 755,
    "cacheUpdateCooldown": "5s",
    "offlineStatus": {
        "name": "Minecraft 1.17",
        "protocol": 755,
        "text": "My awesome minecraft server"
    },
    "rateLimit": 5,
    "rateCooldown": "4s",
    "banListCooldown": "5m",
    "reconnectMsg": "{\"text\": \"Please reconnect to verify yourself.\"}",
    "stateUpdateCooldown": "10s"
}

Options

Name

This is value is used by prometheus for server specific statistics, if you leave this empty it will use the first domain as value.

"name": "my-server"

Domains

These values are the server addresses people can use to join the server. These values is necessary for Ultraviolet to be able to use the config.

"domains": ["1", "2"] 

ProxyTo

This is the address it needs to call when it wants to create a connection to the backend. This value is necessary for Ultraviolet to be able to use the config.

"proxyTo": "127.0.0.1:25566"

ProxyBind

Here you can specify which ip it should use when it want to create a connection to the server. The default value of this is empty, it will be using the main ip when creating a connection.

"proxyBind": "127.0.11.12"

DialTimeout

When Ultraviolet is creating a connection to the server it will wait the given time value before it will timeout the connection. The default value of this is "1s"

"dialTimeout": "10s"

RealIP v2.4

When you enable this, Ultraviolet will transform the handshakes of players to make it compatible with the older RealIP plugin. If both this value and the 2.5 value are set to true, it will prioritize this and use v2.4. The default value is false.

"useRealIPv2.4": false

RealIP v2.5

When you enable this, Ultraviolet will transform the handshakes of players to make it compatible with the current RealIP plugin. The default value is false.

"useRealIPv2.5": false

This version of RealIP uses a public and private key to sign the handshake to ensure the backend that it came from a valid proxy. We dont have the private key which can be used with the public key which is included as default in the RealIP plugin since version 2.5. For that reason you need to replace the public key inside the plugin with the public key generated by Ultraviolet or with the one you generated yourself. The only format which can be used is an ECDSA with SHA512.

Its possible to replace the key without rebuilding the RealIP plugin itself. You can do this in different way for example with 7zip archive GUI or with a terminal command. For example you could use:

jar -uf path/to/jarfile -C path/to/dir/in/jar path/to/file 

RealIPv2.5 Key Path

This is the path it will use to read the private key which will be used to create the encrypted part of the handshake. It will generate a key for the server when the given path does not exists or when its empty (in both cases realipv2.5 need to be set to true). If realIpv2.5 is set to false this config value will be ignored.

"realIPKeyPath": "/etc/ultraviolet/my-secret-key.priv" 

Send Proxy Protocol V2

When enabled this will send a the proxy protocol V2 header to the server when creating a connection for a player. By default this value is false

"sendProxyProtocol": true

Offline Status

This is the status which will get send to the client when its requesting the status

"offlineStatus": {
    "name": "My Server",
    "protocol": 755,
    "text": "Server is currently offline"
}

Disconnect Message

This is the message the player will get to see when he's trying to join the server but the server is offline. By default this message is "Server is offline".

"disconnectMessage": "{\"text\": \"Youre not blocked, we're just busy!\"}"

Cache Status

When enabled Ultraviolet will cache the status of a server for the given time of "cacheUpdateCooldown". This status will be used to send to players when they send a status request to this server. By default this is set to true

"cacheStatus": true

Cache Update Cooldown

This is the time Ultraviolet will assume that the status of a server didnt change. After this time has passed it wont immediately call the server to get a the new status, it will until someone requests it first. The default value of this is "1s".

"cacheUpdateCooldown": "1m31s51ms" 

Cache Protocol

When youre using the cached feature Ultraviolet will need to know which version the server is to be able to get the right status packet. This website can be used to find out which number you want to put here.

"validProtocol": 754

Rate Limit - Connections allowed

This will decide how many client can create a connection with the backend without any questions asked. The timeframe for this is decided by the "rateCooldown" value. This is a soft limit check out Rate Limiting for more info. By default this value is set to 5.

"rateLimit": 1

Rate Limit - In timeframe

The duration of which it will count the connection which are created with the backend, after the duration ended it will reset itself.

"rateCooldown": "1s"

Ban List Time

The time put an ip on the ban list when the same ip joined again with a different username while it was trying to verify another username. The default value of this is "5m".

"banListCooldown": "1h"

Verify message

The message players will be shown when they're trying to a server which is over the rateLimit within the given timeframe. The default value is "Please reconnect to verify yourself".

"reconnectMsg": "{\"text\": \"Please reconnect to verify yourself.\"}"

State Update Time

This is the time it will assume a retrieved status is still valid. For more info about State see this page. The default value for this is "1s".

"stateUpdateCooldown": "10m"

Status config

{
    "name": "Ultraviolet",
    "protocol": 755,
    "text": "Some offline server",
    "favicon": ""
}

Options

Name

This is the 'name' of the status response. Its the text which will appear on the left of the latency bar.

"name": "Ultraviolet"

Protocol

This is the protocol it will use. For more information about it or to see what numbers belong to which versions check this website

"protocol": 755

Text

This is also known as the motd of server.

"text": "Hello there user"

Favicon

This is the picture it will send to the player. If you want to use this turn the picture you wanna use into a base64 encoded string.

"favicon": ""