OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2012 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include <iostream> // NOLINT | 11 #include <iostream> // NOLINT |
12 | 12 |
13 #include "webrtc/p2p/base/basicpacketsocketfactory.h" | 13 #include "webrtc/p2p/base/basicpacketsocketfactory.h" |
14 #include "webrtc/p2p/base/turnserver.h" | 14 #include "webrtc/p2p/base/turnserver.h" |
15 #include "webrtc/base/asyncudpsocket.h" | 15 #include "webrtc/rtc_base/asyncudpsocket.h" |
16 #include "webrtc/base/optionsfile.h" | 16 #include "webrtc/rtc_base/optionsfile.h" |
17 #include "webrtc/base/stringencode.h" | 17 #include "webrtc/rtc_base/stringencode.h" |
18 #include "webrtc/base/thread.h" | 18 #include "webrtc/rtc_base/thread.h" |
19 | 19 |
20 static const char kSoftware[] = "libjingle TurnServer"; | 20 static const char kSoftware[] = "libjingle TurnServer"; |
21 | 21 |
22 class TurnFileAuth : public cricket::TurnAuthInterface { | 22 class TurnFileAuth : public cricket::TurnAuthInterface { |
23 public: | 23 public: |
24 explicit TurnFileAuth(const std::string& path) : file_(path) { | 24 explicit TurnFileAuth(const std::string& path) : file_(path) { |
25 file_.Load(); | 25 file_.Load(); |
26 } | 26 } |
27 virtual bool GetKey(const std::string& username, const std::string& realm, | 27 virtual bool GetKey(const std::string& username, const std::string& realm, |
28 std::string* key) { | 28 std::string* key) { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 server.set_auth_hook(&auth); | 76 server.set_auth_hook(&auth); |
77 server.AddInternalSocket(int_socket, cricket::PROTO_UDP); | 77 server.AddInternalSocket(int_socket, cricket::PROTO_UDP); |
78 server.SetExternalSocketFactory(new rtc::BasicPacketSocketFactory(), | 78 server.SetExternalSocketFactory(new rtc::BasicPacketSocketFactory(), |
79 rtc::SocketAddress(ext_addr, 0)); | 79 rtc::SocketAddress(ext_addr, 0)); |
80 | 80 |
81 std::cout << "Listening internally at " << int_addr.ToString() << std::endl; | 81 std::cout << "Listening internally at " << int_addr.ToString() << std::endl; |
82 | 82 |
83 main->Run(); | 83 main->Run(); |
84 return 0; | 84 return 0; |
85 } | 85 } |
OLD | NEW |