Skip to content

server.conf

Constants #

const default_join_port = 19132

default_join_port is the port a Bedrock client tries first when it is given an address with no port of its own.

fn difficulty_from_string #

fn difficulty_from_string(s string) int

difficulty_from_string maps a human-readable difficulty name to its protocol constant. Unknown values fall back to normal.

fn difficulty_name #

fn difficulty_name(value int) string

difficulty_name returns the canonical name for a protocol difficulty constant.

fn load #

fn load() !Config

fn load_from #

fn load_from(path string) !Config

fn update_difficulty_in_file #

fn update_difficulty_in_file(path string, new_name string) !

update_difficulty_in_file rewrites the difficulty line in a vedrock.toml shaped file. Callers pass the specific Config's own config_file (not a shared default), so persisting a runtime difficulty change never touches another instance's settings file.

struct Config #

struct Config {
pub mut:
	motd     string = 'Vedrock Server'
	sub_motd string = 'A V Bedrock server'
	address  string = '0.0.0.0'
	// port is where a client joining by address reaches the server. LAN
	// discovery is not configurable: a client only ever broadcasts to 7551.
	port          int    = default_join_port
	max_players   int    = 20
	view_distance int    = 8
	gamemode      string = 'survival'
	difficulty    string = 'normal'
	// xbox_auth verifies the Xbox Live chain in the client's Login packet. It
	// says nothing about the transport: NetherNet's own identity assertion is
	// a separate binding, and the game omits it more often than not.
	xbox_auth bool = true
	// require_identity rejects a NetherNet offer that carries no identity
	// assertion. On by default: an anonymous offer gives up the binding between
	// the peer's key and the connection, which is the only thing keeping a login
	// chain captured elsewhere from being replayed onto it. Turn it off for a LAN
	// where the game connects without one and the network is trusted.
	require_identity bool = true
	// verify_identity_token checks the identity token in an offer against
	// Microsoft's published signing keys before the offer is answered. Off leaves
	// the token unverified: the peer still has to hold the key its token names,
	// but the token itself may say anything.
	verify_identity_token bool = true
	// ice_servers are "stun:host:port" or "turn:host:port" entries used to gather
	// candidates. A LAN needs none; a server on the internet whose peers sit
	// behind NAT usually needs at least STUN.
	ice_servers []string
	// advertise_addresses, when non-empty, is the only set of local addresses
	// put into an answer. Set it on a host whose interface list includes
	// container or overlay addresses nothing outside can reach.
	advertise_addresses []string
	// media_port_min and media_port_max bound the UDP ports media binds. Zero
	// lets the kernel pick a port per peer, which nobody can write a firewall
	// rule for.
	media_port_min int
	media_port_max int
	// encryption negotiates Bedrock protocol encryption. NetherNet already
	// encrypts every byte over DTLS and reports so, in which case the handshake
	// is skipped no matter what this says.
	encryption            bool   = true
	compression_threshold int    = 256
	generator             string = 'flat'
	language              string = 'en'
	resource_packs        bool   = true
	resource_packs_dir    string = 'resource_packs'
	force_resource_packs  bool
	allow_client_packs    bool = true
	cdn_packs             string
	default_world         string = 'world'
	load_all_worlds       bool
	debug                 bool
	// worlds_dir/crashdumps_dir/*_file are per instance.
	worlds_dir              string = 'worlds'
	players_dir             string = 'players'
	crashdumps_dir          string = 'crashdumps'
	ops_file                string = 'ops.txt'
	permissions_file        string = 'permissions.yml'
	player_permissions_file string = 'player_permissions.yml'
	whitelist_file          string = 'whitelist.txt'
	// identity_file stores the key the server presents in its NetherNet answers,
	// as PEM. Keeping it means a client that remembers the server still
	// recognises it after a restart, so it is worth sharing across a fleet that
	// should look like one operator.
	identity_file string = 'keys/identity.pem'
	// identity_domain names the issuer of that key to a joining player. Empty
	// uses the MOTD, which is the name they already know the server by. It is
	// display text, so changing it costs nothing; changing the key costs every
	// player a fresh trust prompt.
	identity_domain string
	// config_file is set automatically by load_from to the path it was
	// loaded from, so runtime settings changes (e.g. /difficulty) persist
	// back to the same per instance file this Config actually came from.
	config_file string = default_file
}

fn (Config) bind_address #

fn (c &Config) bind_address() string