NetworkProxy.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Copyright 1999-2019 Alibaba Cloud All rights reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_NETWORKPROXY_H_
  17. #define CORE_INCLUDE_ALIBABACLOUD_CORE_NETWORKPROXY_H_
  18. #include <string>
  19. #include "CoreExport.h"
  20. namespace AlibabaCloud {
  21. class ALIBABACLOUD_CORE_EXPORT NetworkProxy {
  22. public:
  23. enum Type {
  24. None = 0,
  25. Http,
  26. Socks5
  27. };
  28. NetworkProxy(Type type = None,
  29. const std::string &hostName = "",
  30. uint16_t port = 0,
  31. const std::string &user = "",
  32. const std::string &password = "");
  33. ~NetworkProxy();
  34. std::string hostName() const;
  35. std::string password() const;
  36. uint16_t port() const;
  37. void setHostName(const std::string &hostName);
  38. void setPassword(const std::string &password);
  39. void setPort(uint16_t port);
  40. void setType(Type type);
  41. void setUser(const std::string &user);
  42. Type type() const;
  43. std::string user() const;
  44. private:
  45. std::string hostName_;
  46. std::string password_;
  47. uint16_t port_;
  48. Type type_;
  49. std::string user_;
  50. };
  51. } // namespace AlibabaCloud
  52. #endif // CORE_INCLUDE_ALIBABACLOUD_CORE_NETWORKPROXY_H_