Documentation ¶
Index ¶
- Constants
- func GetJwtAlgorithm() *jwt.HMACSHA
- func Set(c *Configuration)
- func SetDebugViaFlag(d bool)
- type ApiConfiguration
- type Configuration
- type ConsoleThrottles
- type DockerConfiguration
- type DockerNetworkConfiguration
- type RegistryConfiguration
- type RemoteQueryConfiguration
- type SystemConfiguration
Constants ¶
const DefaultLocationLinux = "/etc/claws/config.yml"
const DefaultLocationWindows = `C:\Claws\config.yml`
Variables ¶
This section is empty.
Functions ¶
func Set ¶
func Set(c *Configuration)
Set the global configuration instance. This is a blocking operation such that anything trying to set a different configuration value, or read the configuration will be paused until it is complete.
func SetDebugViaFlag ¶
func SetDebugViaFlag(d bool)
Types ¶
type ApiConfiguration ¶
type ApiConfiguration struct { // The interface that the internal webserver should bind to. Host string `default:"0.0.0.0" yaml:"host"` // The port that the internal webserver should bind to. Port int `default:"8080" yaml:"port"` // SSL configuration for the daemon. Ssl struct { Enabled bool `default:"false"` CertificateFile string `json:"cert" yaml:"cert"` KeyFile string `json:"key" yaml:"key"` } // The maximum size for files uploaded through the Panel in bytes. UploadLimit int `default:"100" json:"upload_limit" yaml:"upload_limit"` }
Defines the configuration for the internal API that is exposed by the daemon webserver.
type Configuration ¶
type Configuration struct { sync.RWMutex `json:"-" yaml:"-"` // Determines if wings should be running in debug mode. This value is ignored // if the debug flag is passed through the command line arguments. Debug bool // A unique identifier for this node in the Panel. Uuid string // An identifier for the token which must be included in any requests to the panel // so that the token can be looked up correctly. AuthenticationTokenId string `json:"token_id" yaml:"token_id"` // The token used when performing operations. Requests to this instance must // validate against it. AuthenticationToken string `json:"token" yaml:"token"` Api ApiConfiguration `json:"api" yaml:"api"` System SystemConfiguration `json:"system" yaml:"system"` Docker DockerConfiguration `json:"docker" yaml:"docker"` // The amount of time in seconds that should elapse between disk usage checks // run by the daemon. Setting a higher number can result in better IO performance // at an increased risk of a malicious user creating a process that goes over // the assigned disk limits. DiskCheckTimeout int `yaml:"disk_check_timeout"` // Defines internal throttling configurations for server processes to prevent // someone from running an endless loop that spams data to logs. Throttles ConsoleThrottles // The location where the panel is running that this daemon should connect to // to collect data and send events. PanelLocation string `json:"remote" yaml:"remote"` RemoteQuery RemoteQueryConfiguration `json:"remote_query" yaml:"remote_query"` // AllowedMounts is a list of allowed host-system mount points. // This is required to have the "Server Mounts" feature work properly. AllowedMounts []string `json:"-" yaml:"allowed_mounts"` // AllowedOrigins is a list of allowed request origins. // The Panel URL is automatically allowed, this is only needed for adding // additional origins. AllowedOrigins []string `json:"allowed_origins" yaml:"allowed_origins"` // contains filtered or unexported fields }
func Get ¶
func Get() *Configuration
Get the global configuration instance. This is a read-safe operation that will block if the configuration is presently being modified.
func NewFromPath ¶
func NewFromPath(path string) (*Configuration, error)
Create a new struct and set the path where it should be stored.
func ReadConfiguration ¶
func ReadConfiguration(path string) (*Configuration, error)
Reads the configuration from the provided file and returns the configuration object that can then be used.
func (*Configuration) EnsurePterodactylUser ¶
func (c *Configuration) EnsurePterodactylUser() (*user.User, error)
Ensures that the Pterodactyl core user exists on the system. This user will be the owner of all data in the root data directory and is used as the user within containers.
If files are not owned by this user there will be issues with permissions on Docker mount points.
func (*Configuration) GetPath ¶
func (c *Configuration) GetPath() string
Returns the path for this configuration file.
func (*Configuration) WriteToDisk ¶
func (c *Configuration) WriteToDisk() error
Writes the configuration to the disk as a blocking operation by obtaining an exclusive lock on the file. This prevents something else from writing at the exact same time and leading to bad data conditions.
type ConsoleThrottles ¶
type ConsoleThrottles struct { // Whether or not the throttler is enabled for this instance. Enabled bool `json:"enabled" yaml:"enabled" default:"true"` // The total number of lines that can be output in a given LineResetInterval period before // a warning is triggered and counted against the server. Lines uint64 `json:"lines" yaml:"lines" default:"2000"` // The total number of throttle activations that can accumulate before a server is considered // to be breaching and will be stopped. This value is decremented by one every DecayInterval. MaximumTriggerCount uint64 `json:"maximum_trigger_count" yaml:"maximum_trigger_count" default:"5"` // The amount of time after which the number of lines processed is reset to 0. This runs in // a constant loop and is not affected by the current console output volumes. By default, this // will reset the processed line count back to 0 every 100ms. LineResetInterval uint64 `json:"line_reset_interval" yaml:"line_reset_interval" default:"100"` // The amount of time in milliseconds that must pass without an output warning being triggered // before a throttle activation is decremented. DecayInterval uint64 `json:"decay_interval" yaml:"decay_interval" default:"10000"` // The amount of time that a server is allowed to be stopping for before it is terminated // forfully if it triggers output throttles. StopGracePeriod uint `json:"stop_grace_period" yaml:"stop_grace_period" default:"15"` }
type DockerConfiguration ¶
type DockerConfiguration struct { // Network configuration that should be used when creating a new network // for containers run through the daemon. Network DockerNetworkConfiguration `json:"network" yaml:"network"` // Domainname is the Docker domainname for all containers. Domainname string `default:"" json:"domainname" yaml:"domainname"` // Registries . Registries map[string]RegistryConfiguration `json:"registries" yaml:"registries"` // The size of the /tmp directory when mounted into a container. Please be aware that Docker // utilizes host memory for this value, and that we do not keep track of the space used here // so avoid allocating too much to a server. TmpfsSize uint `default:"100" json:"tmpfs_size" yaml:"tmpfs_size"` }
Defines the docker configuration used by the daemon when interacting with containers and networks on the system.
type DockerNetworkConfiguration ¶
type DockerNetworkConfiguration struct { // The interface that should be used to create the network. Must not conflict // with any other interfaces in use by Docker or on the system. Interface string `default:"172.18.0.1" json:"interface" yaml:"interface"` // The DNS settings for containers. Dns []string `default:"[\"1.1.1.1\", \"1.0.0.1\"]"` // The name of the network to use. If this network already exists it will not // be created. If it is not found, a new network will be created using the interface // defined. Name string `default:"pterodactyl_nw"` ISPN bool `default:"false" yaml:"ispn"` Driver string `default:"bridge"` Mode string `default:"pterodactyl_nw" yaml:"network_mode"` IsInternal bool `default:"false" yaml:"is_internal"` EnableICC bool `default:"true" yaml:"enable_icc"` Interfaces dockerNetworkInterfaces `yaml:"interfaces"` }
type RegistryConfiguration ¶
type RegistryConfiguration struct { Username string `yaml:"username"` Password string `yaml:"password"` }
RegistryConfiguration .
func (RegistryConfiguration) Base64 ¶
func (c RegistryConfiguration) Base64() (string, error)
Base64 .
type RemoteQueryConfiguration ¶
type RemoteQueryConfiguration struct { // The amount of time in seconds that Wings should allow for a request to the Panel API // to complete. If this time passes the request will be marked as failed. If your requests // are taking longer than 30 seconds to complete it is likely a performance issue that // should be resolved on the Panel, and not something that should be resolved by upping this // number. Timeout uint `default:"30" yaml:"timeout"` // The number of servers to load in a single request to the Panel API when booting the // Wings instance. A single request is initially made to the Panel to get this number // of servers, and then the pagination status is checked and additional requests are // fired off in parallel to request the remaining pages. // // It is not recommended to change this from the default as you will likely encounter // memory limits on your Panel instance. In the grand scheme of things 4 requests for // 50 servers is likely just as quick as two for 100 or one for 400, and will certainly // be less likely to cause performance issues on the Panel. BootServersPerPage uint `default:"50" yaml:"boot_servers_per_page"` }
Defines the configuration settings for remote requests from Wings to the Panel.
type SystemConfiguration ¶
type SystemConfiguration struct { // The root directory where all of the pterodactyl data is stored at. RootDirectory string `default:"/var/lib/panther" yaml:"root_directory"` // Directory where logs for server installations and other wings events are logged. LogDirectory string `default:"/var/log/panther" yaml:"log_directory"` // Directory where the server data is stored at. Data string `default:"/var/lib/panther/volumes" yaml:"data"` // Directory where server archives for transferring will be stored. ArchiveDirectory string `default:"/var/lib/panther/archives" yaml:"archive_directory"` // Directory where local backups will be stored on the machine. BackupDirectory string `default:"/var/lib/panther/backups" yaml:"backup_directory"` // The user that should own all of the server files, and be used for containers. Username string `default:"panther" yaml:"username"` // The timezone for this Wings instance. This is detected by Wings automatically if possible, // and falls back to UTC if not able to be detected. If you need to set this manually, that // can also be done. // // This timezone value is passed into all containers created by Wings. Timezone string `yaml:"timezone"` // Definitions for the user that gets created to ensure that we can quickly access // this information without constantly having to do a system lookup. User struct { Uid int Gid int } // The amount of time in seconds that can elapse before a server's disk space calculation is // considered stale and a re-check should occur. DANGER: setting this value too low can seriously // impact system performance and cause massive I/O bottlenecks and high CPU usage for the Wings // process. DiskCheckInterval int64 `default:"150" yaml:"disk_check_interval"` // Determines if Wings should detect a server that stops with a normal exit code of // "0" as being crashed if the process stopped without any Wings interaction. E.g. // the user did not press the stop button, but the process stopped cleanly. DetectCleanExitAsCrash bool `default:"true" yaml:"detect_clean_exit_as_crash"` // If set to true, file permissions for a server will be checked when the process is // booted. This can cause boot delays if the server has a large amount of files. In most // cases disabling this should not have any major impact unless external processes are // frequently modifying a servers' files. CheckPermissionsOnBoot bool `default:"true" yaml:"check_permissions_on_boot"` // If set to false Wings will not attempt to write a log rotate configuration to the disk // when it boots and one is not detected. EnableLogRotate bool `default:"true" yaml:"enable_log_rotate"` }
Defines basic system configuration settings.
func (*SystemConfiguration) ConfigureDirectories ¶
func (sc *SystemConfiguration) ConfigureDirectories() error
Ensures that all of the system directories exist on the system. These directories are created so that only the owner can read the data, and no other users.
func (*SystemConfiguration) ConfigureTimezone ¶
func (sc *SystemConfiguration) ConfigureTimezone() error
Configures the timezone data for the configuration if it is currently missing. If a value has been set, this functionality will only run to validate that the timezone being used is valid.
func (*SystemConfiguration) EnableLogRotation ¶
func (sc *SystemConfiguration) EnableLogRotation() error
Writes a logrotate file for wings to the system logrotate configuration directory if one exists and a logrotate file is not found. This allows us to basically automate away the log rotation for most installs, but also enable users to make modifications on their own.
func (*SystemConfiguration) GetInstallLogPath ¶
func (sc *SystemConfiguration) GetInstallLogPath() string
Returns the location of the JSON file that tracks server states.
func (*SystemConfiguration) GetStatesPath ¶
func (sc *SystemConfiguration) GetStatesPath() string
Returns the location of the JSON file that tracks server states.