winget-cli

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

NetworkSettings.h (1054B)


      1 // Copyright (c) Microsoft Corporation.
      2 // Licensed under the MIT License.
      3 #pragma once
      4 
      5 #include <optional>
      6 #include <string>
      7 #include "winget/UserSettings.h"
      8 
      9 namespace AppInstaller::Settings
     10 {
     11     // Network related settings.
     12     // Merges information from user settings, admin settings, command line, and group policy.
     13     // TODO: This is currently a process global. It should be converted to a thread local
     14     //       (like telemetry) once we expose configuring a proxy through the COM API
     15     struct NetworkSettings
     16     {
     17         static NetworkSettings& Instance();
     18 
     19         const std::optional<std::string>& GetProxyUri() const { return m_proxyUri; }
     20         // Sets the proxy URI; may do nothing depending on admin settings and group policy
     21         void SetProxyUri(const std::optional<std::string>& proxyUri);
     22 
     23         InstallerDownloader GetInstallerDownloader() const;
     24 
     25     protected:
     26         NetworkSettings();
     27         ~NetworkSettings() = default;
     28 
     29         std::optional<std::string> m_proxyUri;
     30     };
     31 
     32     NetworkSettings& Network();
     33 }