Sunshine master
Self-hosted game stream host for Moonlight.
config.h File Reference

Declarations for the configuration of Sunshine. More...

#include <bitset>
#include <chrono>
#include <optional>
#include <string>
#include <unordered_map>
#include <vector>
#include "nvenc/nvenc_config.h"
Include dependency graph for config.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  config::audio_t
 Audio capture and encoder settings loaded from configuration. More...
 
struct  config::sunshine_t::cmd_t
 Command-line options parsed before configuration loading. More...
 
struct  config::video_t::dd_t
 Display-device integration settings. More...
 
struct  config::input_t
 Input emulation settings loaded from configuration. More...
 
struct  config::video_t::dd_t::mode_remapping_entry_t
 Single display mode remapping rule from configuration. More...
 
struct  config::video_t::dd_t::mode_remapping_t
 Collection of display mode remapping rules. More...
 
struct  config::nvhttp_t
 HTTP and HTTPS settings used by the GameStream pairing server. More...
 
struct  config::prep_cmd_t
 External preparation command plus its privilege requirement. More...
 
struct  config::stream_t
 Network stream settings shared by audio, video, and control channels. More...
 
struct  config::sunshine_t
 Top-level Sunshine configuration and credential state. More...
 
struct  config::video_t
 Video encoder, capture, and color settings loaded from configuration. More...
 
struct  config::video_t::dd_t::workarounds_t
 Compatibility workarounds for display-device control. More...
 

Enumerations

enum  config::flag::flag_e : std::size_t {
  config::flag::PIN_STDIN = 0 , config::flag::FRESH_STATE , config::flag::FORCE_VIDEO_HEADER_REPLACE , config::flag::UPNP ,
  config::flag::CONST_PIN , config::flag::FLAG_SIZE
}
 Enumerates supported flag options. More...
 

Functions

void config::log_config_settings (const std::unordered_map< std::string, std::string > &vars, bool save)
 Log parsed configuration entries and optionally record them as modified.
 
int config::parse (int argc, char *argv[])
 Parse serialized text into the corresponding runtime representation.
 
std::unordered_map< std::string, std::string > config::parse_config (const std::string_view &file_content)
 Parse Sunshine configuration text into key-value entries.
 

Variables

constexpr int config::ENCRYPTION_MODE_MANDATORY = 2
 Encryption policy that rejects clients without video encryption support.
 
constexpr int config::ENCRYPTION_MODE_NEVER = 0
 Encryption policy that always sends unencrypted video.
 
constexpr int config::ENCRYPTION_MODE_OPPORTUNISTIC = 1
 Encryption policy that uses encrypted video only when the client supports it.
 
std::unordered_map< std::string, std::string > config::modified_config_settings
 Configuration keys changed during the current parse or UI update.
 
constexpr int config::PACKETSIZE_LARGE = 1456
 Default large packet size that avoids common MTU fragmentation.
 
constexpr int config::PACKETSIZE_MAX = 65535
 Highest accepted configured packet size in bytes.
 
constexpr int config::PACKETSIZE_MIN = 200
 Lowest accepted configured packet size in bytes.
 
constexpr int config::PACKETSIZE_SMALL = 500
 Conservative packet size used for low-MTU links.
 
constexpr std::array config::redacted_config
 Configuration keys whose values must be hidden in logs.
 

Detailed Description

Declarations for the configuration of Sunshine.

Enumeration Type Documentation

◆ flag_e

enum config::flag::flag_e : std::size_t

Enumerates supported flag options.

Enumerator
PIN_STDIN 

Read PIN from stdin instead of http.

FRESH_STATE 

Do not load or save state.

FORCE_VIDEO_HEADER_REPLACE 

force replacing headers inside video data

UPNP 

Try Universal Plug 'n Play.

CONST_PIN 

Use "universal" pin.

FLAG_SIZE 

Number of flags.

Function Documentation

◆ log_config_settings()

void config::log_config_settings ( const std::unordered_map< std::string, std::string > & vars,
bool save )

Log parsed configuration entries and optionally record them as modified.

Log configuration entries and optionally mark them for persistence.

Parameters
varsParsed configuration entries to log.
saveWhether modified configuration values should be written back to disk.

◆ parse()

int config::parse ( int argc,
char * argv[] )

Parse serialized text into the corresponding runtime representation.

Parameters
argcNumber of command-line arguments.
argvCommand-line argument vector.
Returns
0 on success; nonzero when command-line or configuration parsing fails.

◆ parse_config()

std::unordered_map< std::string, std::string > config::parse_config ( const std::string_view & file_content)

Parse Sunshine configuration text into key-value entries.

Parameters
file_contentRaw configuration file contents to parse.
Returns
Parsed configuration key-value entries.

Variable Documentation

◆ redacted_config

std::array config::redacted_config
inlineconstexpr
Initial value:
= {
"csrf_allowed_origins"
}

Configuration keys whose values must be hidden in logs.