+ChannelConfig::ChannelConfig(std::string addr)
+ : transport(STG::SGCP::TCP)
+{
+ // unix:pass@/var/run/stg.sock
+ // tcp:secret@192.168.0.1:12345
+ // udp:key@isp.com.ua:54321
+
+ size_t pos = addr.find_first_of(':');
+ if (pos == std::string::npos)
+ throw Error("Missing transport name.");
+ transport = toTransport(addr.substr(0, pos));
+ addr = addr.substr(pos + 1);
+ if (addr.empty())
+ throw Error("Missing address to connect to.");
+ pos = addr.find_first_of('@');
+ if (pos != std::string::npos) {
+ key = addr.substr(0, pos);
+ addr = addr.substr(pos + 1);
+ if (addr.empty())
+ throw Error("Missing address to connect to.");
+ }
+ if (transport == STG::SGCP::UNIX)