Documentation ¶
Overview ¶
Package config handles the launcher configuration.
Index ¶
- Variables
- type Config
- func (cfg *Config) NeedsUpdateCheck() bool
- func (cfg *Config) ResetDirty()
- func (cfg *Config) Sanitize()
- func (cfg *Config) SetChannel(c string)
- func (cfg *Config) SetFirstLaunch(b bool)
- func (cfg *Config) SetForceUpdate(b bool)
- func (cfg *Config) SetLastUpdateCheck(t int64)
- func (cfg *Config) SetLocale(l string)
- func (cfg *Config) SetSkipPartialUpdate(b bool)
- func (cfg *Config) Sync() error
- type Manifest
- type Sandbox
- func (sb *Sandbox) SetDesktopDir(s string)
- func (sb *Sandbox) SetDisplay(s string)
- func (sb *Sandbox) SetDownloadsDir(s string)
- func (sb *Sandbox) SetEnableAVCodec(b bool)
- func (sb *Sandbox) SetEnableAmnesiacProfileDirectory(b bool)
- func (sb *Sandbox) SetEnableCircuitDisplay(b bool)
- func (sb *Sandbox) SetEnablePulseAudio(b bool)
- type Tor
- func (t *Tor) SetCustomBridges(s string)
- func (t *Tor) SetInternalBridgeSeed(i int64)
- func (t *Tor) SetInternalBridgeType(s string)
- func (t *Tor) SetProxyAddress(s string)
- func (t *Tor) SetProxyPassword(s string)
- func (t *Tor) SetProxyPort(s string)
- func (t *Tor) SetProxyType(s string)
- func (t *Tor) SetProxyUsername(s string)
- func (t *Tor) SetUseBridges(b bool)
- func (t *Tor) SetUseCustomBridges(b bool)
- func (t *Tor) SetUseProxy(b bool)
Constants ¶
This section is empty.
Variables ¶
var TorProxyTypes = []string{"SOCKS 4", "SOCKS 5", "HTTP(S)"}
TorProxyTypes are the proxy protocols supported by tor.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Architecture is the current architecture derived at runtime ("linux32", // "linux64"). Architecture string `json:"-"` // Channel is the Tor Browser channel to install ("release", "alpha") Channel string `json:"channel,omitempty"` // Locale is the Tor Browser locale to install ("en-US", "ja"). Locale string `json:"locale,omitempty"` // LastUpdateCheck is the UNIX time when the last update check was // sucessfully completed. LastUpdateCheck int64 `json:"lastUpdateCheck,omitEmpty"` // ForceUpdate is set if the installed bundle is known to be obsolete. ForceUpdate bool `json:"forceUpdate"` // SkipPartialUpdate is set if the partial update has failed to apply. SkipPartialUpdate bool `json:"skipPartialUpdate"` // Tor is the Tor network configuration. Tor Tor `json:"tor,omitEmpty"` // Sandbox is the sandbox configuration. Sandbox Sandbox `json:"sandbox,omitEmpty"` // FirstLaunch is set for the first launch post install. FirstLaunch bool `json:"firstLaunch"` // LastVersion is the last `sandboxed-tor-browser` version that wrote // the config file. LastVersion string `json:"lastVersion"` // UseSystemTor indicates if a system tor daemon should be used. UseSystemTor bool `json:"-"` // SystemTorControlPort is the system tor daemon control port network. SystemTorControlNet string `json:"-"` // SystemTorControlAddr is the system tor daemon control port address. SystemTorControlAddr string `json:"-"` // RumtineDir is `$XDG_RUNTIME_DIR/appDir`. RuntimeDir string `json:"-"` // UserDataDir is `$XDG_USER_DATA_DIR/appDir`. UserDataDir string `json:"-"` // BundeInstallDir is `UserDataDir/bundleInstallDir`. BundleInstallDir string `json:"-"` // TorDataDir is `UserDataDir/torDataDir`. TorDataDir string `json:"-"` // ConfigDir is `XDG_CONFIG_HOME/appDir`. ConfigDir string `json:"-"` // ConfigVersionChanged indicates that the config file was from an old // version. ConfigVersionChanged bool `json:"-"` // contains filtered or unexported fields }
Config is the sandboxed-tor-browser configuration instance.
func New ¶
New creates a new config object and populates it with the configuration from disk if available, default values otherwise.
func (*Config) NeedsUpdateCheck ¶
NeedsUpdateCheck returns true if the bundle needs to be checked for updates, and possibly updated.
func (*Config) ResetDirty ¶
func (cfg *Config) ResetDirty()
ResetDirty resets the config's dirty flag, causing changes to be discarded on the Sync call. This routine should only be used immediately prior to termination.
func (*Config) Sanitize ¶
func (cfg *Config) Sanitize()
Sanitize validates the config, and brings it inline with reality.
func (*Config) SetChannel ¶
SetChannel sets the configured channel, and marks the config dirty.
func (*Config) SetFirstLaunch ¶
SetFirstLaunch sets the first launch flag and marks the config dirty.
func (*Config) SetForceUpdate ¶
SetForceUpdate sets the bundle as needed an update and marks the config dirty.
func (*Config) SetLastUpdateCheck ¶
SetLastUpdateCheck sets the last update check time and marks the config dirty.
func (*Config) SetSkipPartialUpdate ¶
SetSkipPartailUpdate sets the bundle as needing a complete update as opposed to a partial one, and marks the config dirty.
type Manifest ¶
type Manifest struct { // Version is the installed version. Version string `json:"version,omitEmpty"` // Architecture is the installed Tor Browser architecture. Architecture string `json:"architecture,omitEmpty"` // Channel is the installed Tor Browser channel. Channel string `json:"channel,omitEmpty"` // Locale is the installed Tor Browser locale. Locale string `json:"locale,omitEmpty"` // contains filtered or unexported fields }
Manifest contains the installed Tor Browser information.
func LoadManifest ¶
LoadManifest loads a manifest if present. Note that a missing manifest is not treated as an error.
func NewManifest ¶
NewManifest returns a new manifest.
func (*Manifest) BundleUpdateVersionValid ¶
BundleUpdateVersionValid returns true if the proposed update version is actually an update.
func (*Manifest) BundleVersionAtLeast ¶
BundleVersionAtLeast returns true if the bundle version is greater than or equal to the specified version.
func (*Manifest) SetVersion ¶
SetVersion sets the manifest version and marks the config dirty.
type Sandbox ¶
type Sandbox struct { // Display is the X11 DISPLAY to use in the sandbox. If omitted, the // host system DISPLAY from the env var will be used. Display string `json:"display,omitEmpty"` // EnablePulseAudio enables access to the host PulseAudio daemon inside the // sandbox. EnablePulseAudio bool `json:"enablePulseAudio"` // EnableAVCodec enables extra codecs via ffmpeg's libavcodec.so inside // the sandbox. EnableAVCodec bool `json:"enableAVCodec"` // EnableCircuitDisplay enables the Tor Browser circuit display. EnableCircuitDisplay bool `json:"enableCircuitDisplay"` // EnableAmnesiacProfileDirectory enables amnesiac profile directories. EnableAmnesiacProfileDirectory bool `json:"enableAmnesiacProfileDirectory"` // DesktopDir is the directory to be bind mounted instead of the default // bundle Desktop directory. DesktopDir string `json:"desktopDir,omitEmpty"` // DownloadsDir is the directory to be bind mounted instead of the default // bundle Downloads directory. DownloadsDir string `json:"downloadsDir,omitEmpty"` // contains filtered or unexported fields }
Sandbox contains the sandbox specific config options.
func (*Sandbox) SetDesktopDir ¶
SetDesktopDir sets the sandbox `~/Desktop` bind mount source and marks the config dirty.
func (*Sandbox) SetDisplay ¶
SetDisplay sets the sandbox `DISPLAY` override and marks the config dirty.
func (*Sandbox) SetDownloadsDir ¶
SetDownloadsDir sets the sandbox `~/Downloads` bind mount source and marks the config dirty.
func (*Sandbox) SetEnableAVCodec ¶
SetEnableAVCodec sets the sandbox libavcodec enable and marks the config dirty.
func (*Sandbox) SetEnableAmnesiacProfileDirectory ¶
SetEnableAmnesiacProfileDirectory sets the amnesiac profile directory enable and marks the config dirty.
func (*Sandbox) SetEnableCircuitDisplay ¶
SetEnableCircuitDisplay sets the circit display enable and marks the config dirty.
func (*Sandbox) SetEnablePulseAudio ¶
SetEnablePulseAudio sets the sandbox pulse audo enable and marks the config dirty.
type Tor ¶
type Tor struct { // CtrlPassword is the unhashed onctol port password. CtrlPassword string `json:"-"` // UseProxy is if the Tor network should be reached via a local proxy. UseProxy bool `json:"useProxy"` // ProxyType is the proxy protocol that should be used. ProxyType string `json:"proxyType"` // ProxyAddress is the proxy address that should be used. ProxyAddress string `json:"proxyAddress"` // ProxyPort is the proxy port that should be used. ProxyPort string `json:"proxyPort"` // ProxyUsername is the optional proxy username. ProxyUsername string `json:"proxyUsername"` // ProxyPassword is the optional proxy password. ProxyPassword string `json:"proxyPassword"` // UseBridges is if the Tor network should be reached via a bridge. UseBridges bool `json:"useBridges"` // InternalBridgeType is the bridge transport to use when using built in // bridges. InternalBridgeType string `json:"internalBridgeType"` // InternalBridgeSeed is the seed to use when permuting the internal // bridges for load balancing purposes. InternalBridgeSeed int64 `json:"internalBridgeSeed"` // UseCustomBridges is if the user provided bridges should be used. UseCustomBridges bool `json:"useCustomBridges"` // CustomBridges is the user provided bridge lines. CustomBridges string `json:"customBridges"` // contains filtered or unexported fields }
Tor contains the Tor network config options.
func (*Tor) SetCustomBridges ¶
SetCustomBridges sets the user provided custom bridge lines, and maarks the config dirty.
func (*Tor) SetInternalBridgeSeed ¶
SetInternalBridgeSeed sets the seed to use when permuting the internal bridges for load balancing purposes and marks the config dirty.
func (*Tor) SetInternalBridgeType ¶
SetInternalBridgeType sets the transport to be used when using built in bridges and marks the config dirty.
func (*Tor) SetProxyAddress ¶
SetProxyAddress sets the proxy address to be used by tor and marks the config dirty.
func (*Tor) SetProxyPassword ¶
SetProxyPassword sets the proxy password to be used by tor and marks the config dirty.
func (*Tor) SetProxyPort ¶
SetProxyPort sets the proxy port to be used by tor and marks the config dirty.
func (*Tor) SetProxyType ¶
SetProxyType sets the proxy protocol to be used by tor and marks the config dirty.
func (*Tor) SetProxyUsername ¶
SetProxyUsername sets the proxy username to be used by tor and marks the config dirty.
func (*Tor) SetUseBridges ¶
SetUseBridges sets if the Tor network should be reached via a Bridge and marks the config dirty.
func (*Tor) SetUseCustomBridges ¶
SetUseCustomBridges sets if the user provided custom bridges should be used and marks the config dirty.
func (*Tor) SetUseProxy ¶
SetUseProxy sets if the Tor network should be reached via a local proxy and marks the config dirty.