blob: 3ad2113a65f6faa9906125cdaaa1fa0bda51f585 [file] [log] [blame]
henrike@webrtc.orgf0488722014-05-13 18:00:26 +00001/*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#include <iostream>
12
13#include "webrtc/base/natserver.h"
14#include "webrtc/base/host.h"
15#include "webrtc/base/physicalsocketserver.h"
16
17using namespace rtc;
18
19int main(int argc, char* argv[]) {
20 if (argc != 3) {
21 std::cerr << "usage: natserver <internal-ip> <external-ip>" << std::endl;
22 exit(1);
23 }
24
25 SocketAddress internal = SocketAddress(argv[1]);
26 SocketAddress external = SocketAddress(argv[2]);
27 if (internal.EqualIPs(external)) {
28 std::cerr << "internal and external IPs must differ" << std::endl;
29 exit(1);
30 }
31
32 Thread* pthMain = Thread::Current();
33 PhysicalSocketServer* ss = new PhysicalSocketServer();
34 pthMain->set_socketserver(ss);
35 NATServer* server = new NATServer(NAT_OPEN_CONE, ss, internal, ss, external);
36 server = server;
37
38 pthMain->Run();
39 return 0;
40}