mirror of
https://bitbucket.org/King_DuckZ/keepupnpup.git
synced 2024-11-07 21:29:00 +00:00
Hardcode the parts that I need right now
This commit is contained in:
parent
7dcf565a21
commit
fe0182e73d
1 changed files with 21 additions and 5 deletions
26
src/main.cpp
26
src/main.cpp
|
@ -208,6 +208,14 @@ namespace {
|
||||||
//printf("AddPortMapping(%s, %s, %s) failed with code %d (%s)\n",
|
//printf("AddPortMapping(%s, %s, %s) failed with code %d (%s)\n",
|
||||||
//eport, iport, iaddr, r, strupnperror(r));
|
//eport, iport, iaddr, r, strupnperror(r));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool has_mapping (const std::vector<Redirection>& parRedirs, const std::string& parAddr, uint16_t parPort, Protocol parProtocol) {
|
||||||
|
for (auto& redir : parRedirs) {
|
||||||
|
if (redir.protocol == parProtocol and redir.internal_port == parPort and redir.internal_client == parAddr)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
} //unnamed namespace
|
} //unnamed namespace
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
@ -257,11 +265,19 @@ int main() {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const auto redirs = get_redirections(urls);
|
const auto redirs = get_redirections(urls);
|
||||||
for (auto& redir : redirs) {
|
|
||||||
std::cout << redir.protocol << ", " << redir.remote_host << ":" << redir.external_port << " --> " <<
|
if (not has_mapping(redirs, urls.lanaddr(), 6881, Protocol::TCP))
|
||||||
redir.internal_client << ":" << redir.internal_port << ", " << redir.duration << ", " <<
|
add_port_mapping(urls, 6881, 6881, urls.lanaddr(), "RoutArm redir", 0, Protocol::TCP);
|
||||||
redir.enabled << R"(, ")" << redir.desc << "\"\n";
|
if (not has_mapping(redirs, urls.lanaddr(), 49164, Protocol::TCP))
|
||||||
}
|
add_port_mapping(urls, 49164, 49164, urls.lanaddr(), "RoutArm redir", 0, Protocol::TCP);
|
||||||
|
if (not has_mapping(redirs, urls.lanaddr(), 49164, Protocol::UDP))
|
||||||
|
add_port_mapping(urls, 49164, 49164, urls.lanaddr(), "RoutArm redir", 0, Protocol::UDP);
|
||||||
|
|
||||||
|
//for (auto& redir : redirs) {
|
||||||
|
// std::cout << redir.protocol << ", " << redir.remote_host << ":" << redir.external_port << " --> " <<
|
||||||
|
// redir.internal_client << ":" << redir.internal_port << ", " << redir.duration << ", " <<
|
||||||
|
// redir.enabled << R"(, ")" << redir.desc << "\"\n";
|
||||||
|
//}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue