tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

ObliviousHttpService.h (1293B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim: set sw=2 ts=8 et tw=80 : */
      3 
      4 /* This Source Code Form is subject to the terms of the Mozilla Public
      5 * License, v. 2.0. If a copy of the MPL was not distributed with this
      6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      7 
      8 #ifndef mozilla_net_ObliviousHttpService_h
      9 #define mozilla_net_ObliviousHttpService_h
     10 
     11 #include "mozilla/DataMutex.h"
     12 #include "nsCOMPtr.h"
     13 #include "nsIObliviousHttp.h"
     14 #include "nsIObserver.h"
     15 #include "nsIStreamLoader.h"
     16 
     17 namespace mozilla::net {
     18 
     19 class ObliviousHttpConfig {
     20 public:
     21  nsCOMPtr<nsIURI> mRelayURI;
     22  nsTArray<uint8_t> mEncodedConfig;
     23 };
     24 
     25 class ObliviousHttpService final : public nsIObliviousHttpService,
     26                                   public nsIObserver,
     27                                   public nsIStreamLoaderObserver {
     28 public:
     29  NS_DECL_THREADSAFE_ISUPPORTS
     30  NS_DECL_NSIOBLIVIOUSHTTPSERVICE
     31  NS_DECL_NSIOBSERVER
     32  NS_DECL_NSISTREAMLOADEROBSERVER
     33 
     34  ObliviousHttpService();
     35 
     36 private:
     37  ~ObliviousHttpService() = default;
     38  void ReadPrefs(const nsACString& whichPref);
     39  void FetchConfig(bool aConfigURIChanged);
     40 
     41  DataMutex<ObliviousHttpConfig> mTRRConfig;
     42 };
     43 
     44 }  // namespace mozilla::net
     45 
     46 #endif  // mozilla_net_ObliviousHttpService_h