From 221ccbe3c88a87b6ecb970cbb129fb3eafc77db8 Mon Sep 17 00:00:00 2001 From: Bensong Liu <bensl@microsoft.com> Date: Thu, 30 Jul 2020 16:13:42 +0800 Subject: [PATCH] update prot name --- src/forwarder.hpp | 4 ++-- src/protocols/{misc.hpp => dynport.hpp} | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) rename src/protocols/{misc.hpp => dynport.hpp} (84%) diff --git a/src/forwarder.hpp b/src/forwarder.hpp index c408b37..9dfaea3 100644 --- a/src/forwarder.hpp +++ b/src/forwarder.hpp @@ -20,7 +20,7 @@ public: Forwarder(const rlib::string &inboundConfig, const rlib::string &outboundConfig, const std::list<rlib::string> &filterConfigs) { if (inboundConfig.starts_with("plain")) ptrInbound = new Protocols::PlainInbound; - else if (inboundConfig.starts_with("misc")) + else if (inboundConfig.starts_with("dynport")) ptrInbound = nullptr; // TODO else throw std::invalid_argument("Unknown protocol in inboundConfig " + inboundConfig); @@ -28,7 +28,7 @@ public: if (outboundConfig.starts_with("plain")) ptrOutbound = new Protocols::PlainOutbound; - else if (outboundConfig.starts_with("misc")) + else if (outboundConfig.starts_with("dynport")) ptrOutbound = nullptr; // TODO else throw std::invalid_argument("Unknown protocol in outboundConfig " + outboundConfig); diff --git a/src/protocols/misc.hpp b/src/protocols/dynport.hpp similarity index 84% rename from src/protocols/misc.hpp rename to src/protocols/dynport.hpp index ceef4e5..bb039b6 100644 --- a/src/protocols/misc.hpp +++ b/src/protocols/dynport.hpp @@ -10,11 +10,10 @@ namespace Protocols { public: virtual loadConfig(string config) override { auto ar = rlib::string(config).split('@'); // Also works for ipv6. - if (ar.size() != 4) - throw std::invalid_argument("Wrong parameter string for protocol 'misc'. Example: plain@fe00:1e10:ce95:1@1080-3080@MyPassword"); + if (ar.size() != 3) + throw std::invalid_argument("Wrong parameter string for protocol 'misc'. Example: plain@fe00:1e10:ce95:1@1080-3080"); listenAddr = ar[1]; // listenPort = ar[2].as<uint16_t>(); - psk = ar[3]; // listen these ports. -- GitLab