Skip to content
Snippets Groups Projects
Unverified Commit 33bc11f5 authored by Bensong Liu's avatar Bensong Liu
Browse files

compiles

parent 0b1df4e0
No related branches found
No related tags found
No related merge requests found
......@@ -15,14 +15,20 @@ class Forwarder {
public:
Forwarder(const rlib::string &inboundConfig, const rlib::string &outboundConfig) {
if (inboundConfig.starts_with("plain"))
ptrInbound = new Protocols::PlainInbound(inboundConfig);
ptrInbound = new Protocols::PlainInbound;
else if (inboundConfig.starts_with("misc"))
ptrInbound = nullptr; // TODO
else
throw std::invalid_argument("Unknown protocol in inboundConfig " + inboundConfig);
ptrInbound->loadConfig(inboundConfig);
if (outboundConfig.starts_with("plain"))
ptrOutbound = nullptr; // TODO
ptrOutbound = new Protocols::PlainOutbound;
else if (outboundConfig.starts_with("misc"))
ptrOutbound = nullptr; // TODO
else
throw std::invalid_argument("Unknown protocol in outboundConfig " + outboundConfig);
ptrOutbound->loadConfig(outboundConfig);
}
~Forwarder() {
......
......@@ -22,9 +22,6 @@ namespace Protocols {
// senderId is "$ip@$port", for example, `fe80:8100::1@1080`.
// Note: this interface works for both TCP and UDP.
struct BaseOutbound : rlib::noncopyable {
BaseOutbound(string outboundConfig) {
loadConfig(outboundConfig);
}
virtual ~BaseOutbound() = default;
// Init data structures.
......@@ -42,9 +39,6 @@ namespace Protocols {
};
struct BaseInbound : rlib::noncopyable {
BaseInbound(string inboundConfig) {
loadConfig(inboundConfig);
}
virtual ~BaseInbound() = default;
// Init data structures.
......
......@@ -34,7 +34,6 @@ namespace Protocols {
class PlainInbound : public BaseInbound {
public:
using BaseInbound::BaseInbound;
virtual void loadConfig(string config) override {
auto ar = rlib::string(config).split('@'); // Also works for ipv6.
if (ar.size() != 3)
......@@ -104,7 +103,6 @@ namespace Protocols {
class PlainOutbound : public BaseOutbound {
public:
using BaseOutbound::BaseOutbound;
virtual void loadConfig(string config) override {
auto ar = rlib::string(config).split('@'); // Also works for ipv6.
if (ar.size() != 3)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment